From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Berry, Charles" Subject: Re: Exporting noweb-ref's without disabling org-babel processing Date: Wed, 23 Oct 2019 16:50:40 +0000 Message-ID: <13AFA234-5B6C-4526-9838-03EB57B82899@ucsd.edu> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:52927) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNJql-0004re-C0 for emacs-orgmode@gnu.org; Wed, 23 Oct 2019 12:51:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNJqj-0001W9-ML for emacs-orgmode@gnu.org; Wed, 23 Oct 2019 12:51:06 -0400 Received: from mx0a-00395d01.pphosted.com ([148.163.133.170]:12712) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iNJqh-0001Tc-B9 for emacs-orgmode@gnu.org; Wed, 23 Oct 2019 12:51:05 -0400 In-Reply-To: Content-Language: en-US Content-ID: <963BE25E00326046844D0F6344391ECF@AD.UCSD.EDU> 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" To: Diego Zamboni Cc: Org-mode Diego, I am not sure I understand. Here is my interpretation: You wish to have `:exports both' behavior in your org export. You want noweb references in the exported code to render as angle-bracketed= chunk names, such as <> rather than being expanded in place. If that is what you want, you can use the feature of CALL keywords that res= ets the header arguments for the src block it calls to obtain different beh= avior with the same code. For example: #+begin_src org ,#+name: template-chunk ,#+begin_src emacs-lisp :noweb no (concat c b a <> ) ,#+end_src ,#+CALL: template-chunk() :noweb yes :var a=3D"A" b=3D"B" c=3D"C" ,#+begin_src emacs_lisp :noweb-ref super-duper-code (concat a b c) ,#+end_src #+end_src exports as=20 --8<---------------cut here---------------start------------->8--- ,---- | (concat c b a | <> | ) `---- ,---- | CBAABC `---- ,---- | (concat a b c) `---- --8<---------------cut here---------------end--------------->8--- HTH, Chuck > On Oct 22, 2019, at 1:29 PM, Diego Zamboni wrote: >=20 > Hi, >=20 > I'm working on a Leanpub Markua exporter (not quite complete yet but alre= ady usable, if you are interested: https://github.com/zzamboni/ox-leanpub/t= ree/book-and-markua) >=20 > I would like to include the value of :noweb-ref for code blocks in export= ed output, like noweb originally did, e.g. something like this: >=20 > #begin_src emacs_lisp :noweb-ref super-duper-code > ... > #end_src >=20 > to produce something like this in the export: >=20 > <>=3D > ... >=20 > After much poking around, I figured that the :noweb and :noweb-ref header= args are removed by org-babel *before* the src block makes it to the expor= ter. I also discovered that by setting org-export-use-babel to nil I could = disable this behavior, which means that my exporter can access the :noweb-r= ef argument by parsing the :parameters property (see https://github.com/zza= mboni/ox-leanpub/blob/book-and-markua/ox-leanpub-markua.el#L388). >=20 > This was good for my original purpose, but I just realized that this also= disables other useful org-babel features on export, such as the processing= of the :exports header argument, which means that both code and results ar= e always included in the export regardless of what :exports says :) >=20 > I have tried using org-babel-exp-code-template, but unfortunately if I tr= y to use "%noweb-ref" as a key in its value, it gets replaced by the value = of :noweb followed by "-ref" in every case. >=20 > Is there some other way of accessing org-babel header arguments like :now= eb-ref from the exporter, but without having to disable org-babel processin= g completely? Any other ideas for achieving what I want? >=20 > Thanks for any ideas, > --Diego >=20