emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Please help with a filter
@ 2014-09-02 18:55 Rafael
  2014-09-03  2:55 ` Charles Berry
  0 siblings, 1 reply; 3+ messages in thread
From: Rafael @ 2014-09-02 18:55 UTC (permalink / raw)
  To: Emacs-orgmode list


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,

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-09-03 22:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-02 18:55 Please help with a filter Rafael
2014-09-03  2:55 ` Charles Berry
2014-09-03 22:32   ` Rafael

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).