/dtepr

Delegating text processor for Unix systems.

Primary LanguageCMIT LicenseMIT

dtepr

Delegating text processor for Unix systems.

Reads and processes text from the standard input, and writes the result to either the standard output or an internal program buffer. Flow is controlled through directives in the text. The program buffer can be executed through an external command, whose output will be read back and inserted into the standard output.

Example

infile.html.dte

<p>Here's a HTML file. It was generated by <code><:p:>echo $USER<:x:></code>
on <i><:p:>date -Iseconds<:x:></i>.</p>

Invocation through dtepr:

cat infile.html.dte|dtepr $SHELL

Example output:

<p>Here's a HTML file. It was generated by <code>radiant</code>
on <i>2022-11-08T21:13:11+01:00</i>.</p>

Building and installing

Requires CMake 3.12 or newer, and a decently POSIX compliant system.

An out-of-source build is recommended:

$ cmake -B build -DCMAKE_RELEASE_TYPE=Release -DBUILD_TESTS=0
$ cmake --build build

Installing is optional (may require superuser privileges):

$ cmake --install build

Directives

The following directives are supported:

  • <:i:> - Redirects output to a null buffer. (For comments.)
  • <:n:> - Redirects output back to the standard output.
  • <:p:> - Redirects output to the program buffer.
  • <:x:> - Executes the program in the program buffer by invoking the command specified on the command line using the program buffer as input, redirects output back to the standard output, copies the output from the command to the standard output.

Directives can be escaped with backslash:

  • \<:i:> -> just writes <:i:> to the current output.

Backslashes can also be escaped as expected: \\