From 6dd4caf947f2997698ebf7354172a6476ad0bf25 Mon Sep 17 00:00:00 2001 From: Joe Carstairs Date: Wed, 17 Jun 2026 21:46:49 +0100 Subject: adds pp sources --- http/pp/README.md | 188 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 188 insertions(+) create mode 100644 http/pp/README.md (limited to 'http/pp/README.md') diff --git a/http/pp/README.md b/http/pp/README.md new file mode 100644 index 0000000..f69faf1 --- /dev/null +++ b/http/pp/README.md @@ -0,0 +1,188 @@ +# `pp(1)` + +a preprocessor + +`pp(1)` allows embedding +[`sh(1)`](https://pubs.opengroup.org/onlinepubs/9699919799/utilities/sh.html) +code in files of any type by nesting it inside the `#!\n` token, where +`\n` is a new line. That means that if you'd like a simple loop or an +`if` inside an HTML file for instance, +you could use `pp(1)`. + +## Basic usage + +For the following code: + + + pp(1) example + + +`pp(1)` outputs: + + + pp(1) example + + +## Arguments + +You can also pass arguments to it by appending them to the command call: + + + $1 +

+ #! + echo $2 + #! +

+ +Calling the above code with +`pp tmp.upphtml 'pp(1) example' 'hello, world'` +will result in: + + + pp(1) example +

+ hello world +

+ +## Pipes + +`pp(1)`'s `stdin` is sent to the child +[`sh(1)`](https://pubs.opengroup.org/onlinepubs/9699919799/utilities/sh.html) + + + pp(1) example +

+ #! + cat + #! +

+ +`echo 'hello, world' | pp tmp.upphtml` will output: + + + pp(1) example +

+ hello, world +

+ +## Debugging + +`pp(1)` also takes an optional `-d` flag. If passed, `pp(1)` will dump +the generated +[`sh(1)`](https://pubs.opengroup.org/onlinepubs/9699919799/utilities/sh.html) +code instead of executing it: + + + pp(1) example + + +`pp -d tmp.upphtml` will output: + + echo " + pp(1) example + " + +## Example + + + + pp(1) + + + + + Home + #! + addcls() { + sed "s///g" + } + smu README | addcls + #! +

Files

+
    + #! + for f in * + do + case $f in + *.upp*|*.html|*.tgz) + continue + ;; + esac + #! +
  • $f
  • + #! + done + #! +
+

Download

+ pp.tgz + + + + + +## See also + +* +* +* -- cgit v1.2.3