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

#### 14.8.2.14 `: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 sub-tree 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 file172.

     #+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

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.

#### Footnotes

### (172)

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