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,

Reply via email to