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

Table of Contents

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


14.8.2.16 :noweb-ref

When expanding “noweb” style references, Org concatenates ‘src’ code blocks by matching the reference name to either the 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 file1.

      #+BEGIN_SRC sh :tangle yes :noweb yes :shebang #!/bin/sh
        <<fullest-disk>>
      #+END_SRC
      * the mount point of the fullest disk
        :PROPERTIES:
        :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
     
      ** sort by the percent full
      #+BEGIN_SRC sh
        |awk '{print $5 " " $6}'|sort -n |tail -1 \
      #+END_SRC
     
      ** extract the mount point
      #+BEGIN_SRC sh
        |awk '{print $2}'
      #+END_SRC

Footnotes

[1] (For the example to work, turn on the property inheritance for noweb-ref, see Property inheritance).