Skip to content

Commit

Permalink
Proper support for source code blocks.
Browse files Browse the repository at this point in the history
Only language is supported right now

Pending future work is to support other options for the jekyll code
templates.

http://octopress.org/docs/plugins/codeblock/

{% codeblock [lang:language] [title] [url] [link text] [start:#]
[mark:#,#-#] [linenos:false] %}
code snippet
{% endcodeblock %}
  • Loading branch information
justin808 committed Nov 25, 2013
1 parent 290f01e commit 27357ca
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions ox-jekyll.el
Expand Up @@ -62,6 +62,7 @@
(?h "As HTML file" org-jekyll-export-to-html)))
:translate-alist
'((template . org-jekyll-template) ;; add YAML front matter.
(src-block . org-jekyll-src-block)
(inner-template . org-jekyll-inner-template)) ;; force body-only
:options-alist
'((:jekyll-layout "JEKYLL_LAYOUT" nil org-jekyll-layout)
Expand All @@ -72,6 +73,18 @@

;;; Internal Filters


(defun org-jekyll-src-block (src-block contents info)
"Transcode SRC-BLOCK element into jekyll code template format.
CONTENTS is nil. INFO is a plist used as a communication
channel."
(let ((language (org-element-property :language src-block))
(value (org-remove-indentation (org-element-property :value src-block))))
(format "{%% codeblock lang:%s %%}\n%s{%% endcodeblock %%}" language value)))




;;; Template

(defun org-jekyll-template (contents info)
Expand Down

0 comments on commit 27357ca

Please sign in to comment.