emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] Exporter and src blocks


From: Justin Gordon
Subject: [O] Exporter and src blocks
Date: Wed, 5 Mar 2014 23:09:29 -1000

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

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 | sugarranchmaui.com | Sugar Ranch Blog

reply via email to

[Prev in Thread] Current Thread [Next in Thread]