Next: , Previous: , Up: Specific header arguments   [Contents][Index]


14.8.2.16 :noweb-ref

When expanding Noweb style references, Org concatenates ‘src’ code blocks by matching the reference name to either the code block name or the :noweb-ref header argument.

For simple concatenation, set this :noweb-ref header argument at the sub-tree or file level. In the example Org file shown next, the body of the source code in each block is extracted for concatenation to a pure code file when tangled.

 #+BEGIN_SRC sh :tangle yes :noweb yes :shebang #!/bin/sh
   <<fullest-disk>>
 #+END_SRC
 * the mount point of the fullest disk
   :PROPERTIES:
   :header-args: :noweb-ref fullest-disk
   :END:

 ** query all mounted disks
 #+BEGIN_SRC sh
   df \
 #+END_SRC

 ** strip the header row
 #+BEGIN_SRC sh
   |sed '1d' \
 #+END_SRC

 ** output mount point of fullest disk
 #+BEGIN_SRC sh
   |awk '{if (u < +$5) {u = +$5; m = $6}} END {print m}'
 #+END_SRC