简体   繁体   中英

Org-Mode: call the noweb insertion from the noweb insertion

a and b -- python functions, c -- simple noweb insertion to python source-blocks, and d -- noweb insertion to function with noweb insertion. Function c -- is working, but function d -- not, because python trying execute insertions but this is invalid syntax. Is it possible to run noweb insertion from the noweb insertion?

#+NAME: a
#+BEGIN_SRC python
a = 1
#+END_SRC

#+NAME: b
#+BEGIN_SRC python
b = 1
#+END_SRC

#+NAME: c
#+BEGIN_SRC python :noweb yes :results output
<<a>>
<<b>>
c = a + b
print c
#+END_SRC

#+NAME: d
#+BEGIN_SRC python :noweb yes :results output
<<c>>

d = c * 2
print d
#+END_SRC

During the experiments, I found that this construction works (all noweb insertion must be in the last code block):

#+NAME: a
#+BEGIN_SRC python
a = 1
#+END_SRC

#+NAME: b
#+BEGIN_SRC python
b = 1
#+END_SRC

#+NAME: c
#+BEGIN_SRC python
c = a + b
#+END_SRC

#+NAME: d
#+BEGIN_SRC python :noweb yes :results output
<<a>>
<<b>>
<<c>>

d = c * 2
print d
#+END_SRC

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM