emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Rafael <rvf0068@gmail.com>
To: Emacs-orgmode list <emacs-orgmode@gnu.org>
Subject: Please help with a filter
Date: Tue, 02 Sep 2014 13:55:37 -0500	[thread overview]
Message-ID: <87oauxetsm.fsf@gmail.com> (raw)


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	other threads:[~2014-09-02 18:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-02 18:55 Rafael [this message]
2014-09-03  2:55 ` Please help with a filter Charles Berry
2014-09-03 22:32   ` Rafael

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87oauxetsm.fsf@gmail.com \
    --to=rvf0068@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).