From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rafael Subject: Please help with a filter Date: Tue, 02 Sep 2014 13:55:37 -0500 Message-ID: <87oauxetsm.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:52192) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOtF9-0003uC-OM for emacs-orgmode@gnu.org; Tue, 02 Sep 2014 14:56:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XOtF0-0001P7-Nf for emacs-orgmode@gnu.org; Tue, 02 Sep 2014 14:55:51 -0400 Received: from mail-pd0-x22f.google.com ([2607:f8b0:400e:c02::22f]:43182) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOtF0-0001P2-Fk for emacs-orgmode@gnu.org; Tue, 02 Sep 2014 14:55:42 -0400 Received: by mail-pd0-f175.google.com with SMTP id ft15so9310603pdb.34 for ; Tue, 02 Sep 2014 11:55:40 -0700 (PDT) Received: from ladell ([200.57.62.44]) by mx.google.com with ESMTPSA id n2sm6500088pdh.41.2014.09.02.11.55.39 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 02 Sep 2014 11:55:40 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Emacs-orgmode list I want that the result of exporting to markdown the following two blocks be identical: #+begin_src org #+BEGIN_MARKDOWN
#+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 "
\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, From mboxrd@z Thu Jan 1 00:00:00 1970 From: Charles Berry Subject: Re: Please help with a filter Date: Wed, 3 Sep 2014 02:55:49 +0000 (UTC) Message-ID: References: <87oauxetsm.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57296) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XP0jz-0006MH-JT for emacs-orgmode@gnu.org; Tue, 02 Sep 2014 22:56:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XP0jr-0008TD-TW for emacs-orgmode@gnu.org; Tue, 02 Sep 2014 22:56:11 -0400 Received: from plane.gmane.org ([80.91.229.3]:40103) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XP0jr-0008T2-NP for emacs-orgmode@gnu.org; Tue, 02 Sep 2014 22:56:03 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1XP0jp-0000UP-F0 for emacs-orgmode@gnu.org; Wed, 03 Sep 2014 04:56:01 +0200 Received: from 172-7-166-26.lightspeed.sndgca.sbcglobal.net ([172.7.166.26]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 03 Sep 2014 04:56:01 +0200 Received: from ccberry by 172-7-166-26.lightspeed.sndgca.sbcglobal.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 03 Sep 2014 04:56:01 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Rafael gmail.com> writes: > > > I want that the result of exporting to markdown the following two blocks > be identical: Rafael, You probably want a derived backend taking 'md as the parent. You want to tool up a src-block transcoder. Look at org-html-src-block (which is what markdown uses) and create org-md-sage-src-block (say) based on that. The :language property in `info' - the communication channel - is a human language not a computer language. Confusingly, babel has an `info' variable that has different contents. Filters might be made to work, but it seems like more work than a derived backend. HTH, Chuck From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rafael Subject: Re: Please help with a filter Date: Wed, 03 Sep 2014 17:32:07 -0500 Message-ID: <86lhq0s5co.fsf@gmail.com> References: <87oauxetsm.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33874) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPJ6M-0008Ak-T1 for emacs-orgmode@gnu.org; Wed, 03 Sep 2014 18:32:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XPJ6H-0001wA-7e for emacs-orgmode@gnu.org; Wed, 03 Sep 2014 18:32:30 -0400 Received: from mail-pa0-x234.google.com ([2607:f8b0:400e:c03::234]:36466) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPJ6G-0001tj-Vs for emacs-orgmode@gnu.org; Wed, 03 Sep 2014 18:32:25 -0400 Received: by mail-pa0-f52.google.com with SMTP id eu11so18577627pac.11 for ; Wed, 03 Sep 2014 15:32:13 -0700 (PDT) Received: from lahp ([200.57.62.35]) by mx.google.com with ESMTPSA id k8sm10214354pdo.64.2014.09.03.15.32.10 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 03 Sep 2014 15:32:10 -0700 (PDT) In-Reply-To: (Charles Berry's message of "Wed, 3 Sep 2014 02:55:49 +0000 (UTC)") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Charles Berry writes: > Rafael gmail.com> writes: > >> I want that the result of exporting to markdown the following two blocks >> be identical: > > > You probably want a derived backend taking 'md as the parent. Yes, that's what I feared.. :) I thought I could delay creating a derived backend for later, but I guess now is the time. Thanks for your answer, it was helpful indeed.