summaryrefslogtreecommitdiffstats
path: root/dmt/template.awk (follow)
AgeCommit message (Collapse)AuthorFilesLines
2023-11-15dmt: Add server-side templating functionalityMalfurious1-0/+55
This file is taken from the "werc" web "anti-framework" project, which is made available as Public Domain as well as MIT code. It is an awk script that implements a simple templating markup syntax. When run on an input file, it translates the content into equivalent shell syntax which can then be executed to produce the desired result. Therefore, the script should be invoked as `template.awk FILE | bash`, and the output can be streamed to the client. An overview of the template syntax follows: Lines beginning with '%' (no leading whitespace allowed) are taken as shell commands. Inline %{ ... %} gives the inner content taken as a shell command. Inline %( ... %) gives the inner content taken as a shell expression (which is substituted). All other text is echoed as-is. Signed-off-by: Malfurious <m@lfurio.us>