[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[O] Please help with a filter
From: |
Rafael |
Subject: |
[O] Please help with a filter |
Date: |
Tue, 02 Sep 2014 13:55:37 -0500 |
User-agent: |
Gnus/5.130012 (Ma Gnus v0.12) Emacs/24.3 (gnu/linux) |
I want that the result of exporting to markdown the following two blocks
be identical:
#+begin_src org
#+BEGIN_MARKDOWN
<div class="sage">
<script type="text/x-sage">2+3</script>
</div>
#+END_MARKDOWN
#+BEGIN_SRC sage
2+3
#+END_SRC
#+end_src
I have tried the following, which seems similar to examples in the web,
and I think it should work, but it doesn't:
#+begin_src emacs-lisp
(defun org-octopress-src-block (contents backend info)
(when (eq backend 'md)
(let (
(lang (org-element-property :language info))
(value (org-element-property :value info)))
(message "Language is %s. Value is %s" lang value)
(when (eq lang "sage" )
(format
"<div class=\"sage\">
<script type=\"text/x-sage\">%s</script>
</div>\n"
value
))
))
)
(add-to-list 'org-export-filter-src-block-functions
'org-octopress-src-block)
#+end_src
My debugging message says: 'Language is nil. Value is nil', so I cannot
get the name of the language from the source code. What should I do to
get the filter to work?
Thanks in advance,
- [O] Please help with a filter,
Rafael <=