emacsorg-modeliterate-programmingorg-babel

noweb style weaving in org-babel


I'm using Emacs 23 with Org 7.8.04. My code structure is as follows:

#+TITLE: hello, world!

#+BEGIN_SRC python :tangle yes :noweb yes
<<go_function>>
if __name__ == "__main__":
    go()
#+END_SRC

Define =go_function= as follows.

#+name:go_function
#+BEGIN_SRC python
def go:
    print "hello, world!"
#+END_SRC

When I tried to weave documentation, the <<go_function>> in the first code chunk is exported to html too so that I have two html exports of <<go_function>>. I'd like the <<go_function>> is exported as a link which points to the actual definition at the end of the document.How can I do that?


Solution

  • Try changing :noweb yes to :noweb tangle. The manual is very helpful in cases like this (see https://orgmode.org/manual/Noweb-Reference-Syntax.html).