Literate Programming Examples on my Website
This page lists the pages of this website which use literate programming.
First of all, we find all occurrences of
#+BEGIN_SRC in the source
files (with the exception of this file) which are required to produce
results. We use
sed to process the output, using a TAB to
separate the filename from the content and by extracting the
programming language, which is the first word after
grep BEGIN_SRC \ $(find ../.. -name "*.org" -a \! -name literate-programming-references.org ) | \ grep results | grep -v "_site" | sed 's/:/\t/' | \ sed -E 's/#\+BEGIN_SRC +([^ ]+) .*/\1/'
The output, which is not exported in the HTML page, looks like:
| ../../bookstream.org | ruby | | ../../notes/covid/new-cases.org | R | | ../../notes/covid/new-cases.org | ruby |
We now use
datamash to make the data into a Pivot table, with the
command. Sed is used to generate links to the files, by prepending
the filenames and to remove the “N/A” entries.
echo "$table" | sort | \ datamash crosstab 1,2 | sed 's-N/A--'g | sed -E 's/\.\./file:../'