Skip to content

Commit

Permalink
use both language and name, or only language
Browse files Browse the repository at this point in the history
``` src blocks in Octopress support language and name, or only
language, but not only name
  • Loading branch information
michiakig committed Sep 2, 2013
1 parent 9bfd90f commit 09485f4
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions octorgopress.el
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,16 @@ categories:
(let* ((lang (get-lang (org-element-property :language src-block)))
(value (org-element-property :value src-block))
(name (org-element-property :name src-block))
(name-or-nil (if name (format " %s\n" name) "\n")))
(lang-and-name
;; backtick code blocks support lang or lang and name, but not name alone
(cond ((and lang name)
(concat " " lang " " name "\n"))
(lang
(concat " " lang "\n"))
(t "\n"))))
(concat
"```"
lang
name-or-nil
lang-and-name
value
"```\n"
contents)))
Expand Down

0 comments on commit 09485f4

Please sign in to comment.