emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Justin Gordon <justin.gordon@gmail.com>
To: emacs-orgmode@gnu.org
Cc: Yoshinari Nomura <nom@quickhack.net>
Subject: Exporter and src blocks
Date: Wed, 5 Mar 2014 23:09:29 -1000	[thread overview]
Message-ID: <CAK1wbkFBf6uQ-unFK0kVP3=Yb1D3iVcZFNjNuEW-bYycsf8DEQ@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 2486 bytes --]

I'm trying to fix this issue:
https://github.com/yoshinari-nomura/org-octopress/issues/14

Here's a copy of that message

Per: justin808@27357ca<https://github.com/justin808/org-octopress/commit/27357caf41bb82d78059015c3d6048d11444f62b>

I would like this to work:

#+BEGIN_SRC css sass/custom/_fonts.scss
b { font-weight: bold; }
i { font-style: italic; }
#+END_SRC

And have that generate

{% codeblock lang:css sass/custom/_fonts.scss %}
b { font-weight: bold; }
i { font-style: italic; }
{% endcodeblock %}

The lang goes in fine. I'd like the ability to have the other parameters
picked up.

Any chance you can give me a tip on the right change to the ox-jekyll.el?

Here's an example of "header arguments":
http://orgmode.org/manual/Code-block-specific-header-arguments.html#Code-block-specific-header-arguments

I'm guessing that it's not necessary to use this syntax (prepend :title
before the title)

#+BEGIN_SRC css :title sass/custom/_fonts.scss
b { font-weight: bold; }
i { font-style: italic; }
#+END_SRC



In the method of ox-jekyll, if I print out the value of src-block, i get
this:

src-block is (src-block (:language css :switches nil :parameters nil :begin
1 :end 78 :number-lines nil :preserve-indent nil :retain-labels t
:use-labels t :label-fmt nil :value b { font-weight: bold; }
i { font-style: italic; }
 :post-blank 0 :post-affiliated 1 :parent (section (:begin 1 :end 78
:contents-begin 1 :contents-end 78 :post-blank 0 :parent (org-data nil #2))
#0)))

I never can see the title.

Here's the method to fix:

(defun org-jekyll-src-block (src-block contents info)
  "Transcode SRC-BLOCK element into jekyll code template format
if `org-jekyll-use-src-plugin` is t. Otherwise, perform as
`org-html-src-block`. CONTENTS holds the contents of the item.
INFO is a plist used as a communication channel."
  (if org-jekyll-use-src-plugin
      (let ((language (org-element-property :language src-block))
            (value (org-remove-indentation
                    (org-element-property :value src-block))))
        (message "src-block is %s" src-block)
        (format "{%% codeblock lang:%s %%}\n%s{%% endcodeblock %%}"
                language value))
    (org-export-with-backend 'html src-block contents info)))







-- 
Justin Gordon | 808-877-6461 | m: 808-281-7272
www.railsonmaui.com | twitter: @railsonmaui<https://twitter.com/railsonmaui>
 | sugarranchmaui.com <http://www.sugarranchmaui.com/> | Sugar Ranch
Blog<https://www.facebook.com/SugarRanch>

[-- Attachment #2: Type: text/html, Size: 8664 bytes --]

                 reply	other threads:[~2014-03-06  9:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAK1wbkFBf6uQ-unFK0kVP3=Yb1D3iVcZFNjNuEW-bYycsf8DEQ@mail.gmail.com' \
    --to=justin.gordon@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=nom@quickhack.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).