This is the official manual for the latest Org-mode release.

Table of Contents

Next: , Previous: noweb, Up: Specific header arguments :noweb-ref

When expanding “noweb” style references, the bodies of all code block with either a block name matching the reference name or a :noweb-ref header argument matching the reference name will be concatenated together to form the replacement text.

By setting this header argument at the subtree or file level, simple code block concatenation may be achieved. For example, when tangling the following Org mode file, the bodies of code blocks will be concatenated into the resulting pure code file1.

      #+BEGIN_SRC sh :tangle yes :noweb yes :shebang #!/bin/sh
      * the mount point of the fullest disk
        :noweb-ref: fullest-disk
      ** query all mounted disks
      #+BEGIN_SRC sh
        df \
      ** strip the header row
      #+BEGIN_SRC sh
        |sed '1d' \
      ** sort by the percent full
      #+BEGIN_SRC sh
        |awk '{print $5 " " $6}'|sort -n |tail -1 \
      ** extract the mount point
      #+BEGIN_SRC sh
        |awk '{print $2}'

The :noweb-sep (see noweb-sep) header argument holds the string used to separate accumulate noweb references like those above. By default a newline is used.


[1] (The example needs property inheritance to be turned on for the noweb-ref property, see Property inheritance).