5

When exporting the documentation (HTML or PDF) for a literate program that uses noweb references in blocks, how can I get the output to actually hyperlink the <<noweb_snippet_name>> line (in the parent source code block) to the block named “noweb_snippet_name”?

Or, better yet, how can I make that noweb reference link to an arbitrary part of the exported document? The child block might not be exported, so I would want the reference to link to the discussion of the snippet.

For example:

#+BEGIN_SRC klingon-lisp :noweb tangle :exports code
...
<<declare_variables>>
<<conquer_worlds>>
<<declare_victory>>
...
#+END_SRC

...
... /much later in the org file/
* Global variables
Blah blah discussion of variables, blah blah...
| Variable name | Description |

#+NAME: declare_variables
#+BEGIN_SRC klingon-lisp :exports none
(defvar yuQ nil
  "yuQmey chargh tetlh.")
#+END_SRC

Here, the main program source block is exported, to document the structure of the program. The subsidiary block declare_variables does not need to be included in the export, since the text describes the variables and lists them in a table. Ideally, <<declare_variables>> in the exported main program block would link to the * Global variables header. But I could live with it linking to the declare_variables source block, and having to export that as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.