From mboxrd@z Thu Jan 1 00:00:00 1970 From: Brian Beckman Subject: export: noweb blocks substituted versus verbatim ? Date: Sat, 26 Sep 2015 21:26:14 +0000 (UTC) Message-ID: 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]:45679) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zfx2z-0004X2-EC for emacs-orgmode@gnu.org; Sat, 26 Sep 2015 17:30:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zfx2u-0000US-Eo for emacs-orgmode@gnu.org; Sat, 26 Sep 2015 17:30:21 -0400 Received: from plane.gmane.org ([80.91.229.3]:53188) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zfx2u-0000U5-99 for emacs-orgmode@gnu.org; Sat, 26 Sep 2015 17:30:16 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Zfx2h-0002Xs-SN for emacs-orgmode@gnu.org; Sat, 26 Sep 2015 23:30:04 +0200 Received: from 50-245-150-254-static.hfc.comcastbusiness.net ([50-245-150-254-static.hfc.comcastbusiness.net]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 26 Sep 2015 23:30:03 +0200 Received: from bc.beckman by 50-245-150-254-static.hfc.comcastbusiness.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 26 Sep 2015 23:30:03 +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 Hello -- I have a situation where some code blocks with noweb references in them <> are substituted inline when I export the document, and other code blocks with noweb references, are copied verbatim into the exported PDF. I do not know what causes this difference in behavior and I don't know how to control it, but I'd like to control it. I'd like to be able to specify that some blocks have behavior 1 (references substituted inline) and other blocks have behavior 2 (references verbatim). I'm sure this is pilot error, but I'm stumped and would be grateful for advice. My Minimal Viable Example (MVE) follows below, and the PDF file that's exported is here https://drive.google.com/file/d/0B4v0MzmZfdm8TzRLeFlreUFnbEk/view #+BEGIN_COMMENT The emacs lisp block must export results, even though the exports are none, otherwise the block will not be eval'ed on export, and we will get unacceptable confirmation requests for all the subsequent python blocks. #+END_COMMENT #+BEGIN_SRC emacs-lisp :exports results :results none (setq org-confirm-babel-evaluate nil) #+END_SRC ** PyTests Define the test and cases. This code must be tangled out to an external file so =py.test= can see it. When I /export/ this to PDF, the noweb references, namely =<>= and =<>=, are substituted inline, so the typeset version of this block in the PDF shows ALL the code. This is not what I want. #+NAME: test-block #+BEGIN_SRC python :noweb yes :tangle test_foo.py <> <> def test_smoke (): np.testing.assert_approx_equal (foo_func (), foo_constant) #+END_SRC #+RESULTS: test-block : None The following blocks import prerequisites and do a quick smoke test: ** Do Some Imports #+NAME: imports #+BEGIN_SRC python import numpy as np #+END_SRC #+RESULTS: imports : None ** Define Some Variables However, in the typeset PDF, the noweb reference =<>= in the block below is /not/ substituted in-line, but rather appears verbatim. I want /all/ noweb references to appear verbatim in the exported, typeset, PDF document, just like this one. #+NAME: definitions #+BEGIN_SRC python foo_constant = 42.0 <> #+END_SRC #+RESULTS: definitions ** Define Some Functions *** Foo Function is Really Interesting #+NAME: foo-func #+BEGIN_SRC python def foo_func () : return 42.000 #+END_SRC #+RESULTS: foo-func : None We want results from pytest whether it succeeds or fails, hence the /OR/ with =true= in the shell #+BEGIN_SRC sh :results output replace :exports both py.test || true #+END_SRC #+RESULTS: : ============================= test session starts ============================== : platform darwin -- Python 2.7.10, pytest-2.8.0, py-1.4.30, pluggy-0.3.1 : rootdir: /Users/bbeckman/foo, inifile: : collected 1 items : : test_foo.py . : : =========================== 1 passed in 0.06 seconds ===========================