about summary refs log tree commit diff stats
path: root/pages/pp.md
blob: af76bc68ed4c9eb7d87ca33af058eef964b70f04 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<!--
title: pp(1)
description: Introduction to pp(1)
author: gbmor
-->

# pp(1)

`pp(1)` is a shell preprocessor developed by our own user [adi](https://adi.tilde.institute).
It allows one to embed shell into any text file between instances of the token `#!`. This powerful
tool allows the dynamic generation of static pages using standard bourne shell.

For example:
```
<!doctype html>
<title>pp(1) example</title>
<ul>
#!
i=1
while test $i -le 10
do
if test $((i % 2)) -eq 0
then
#!
	<li class=even>$i</li>
#!
else
#!
	<li class=odd>$i</li>
#!
fi
i=$((i + 1))
done
#!
</ul>
```
Will output, per the manual page:
```
<!doctype html>
<title>pp(1) example</title>
<ul>
        <li class=odd>1</li>
        <li class=even>2</li>
        <li class=odd>3</li>
        <li class=even>4</li>
        <li class=odd>5</li>
        <li class=even>6</li>
        <li class=odd>7</li>
        <li class=even>8</li>
        <li class=odd>9</li>
        <li class=even>10</li>
</ul>
```

The manpage includes more information on advanced features, such as piping `stdin` and debugging.

## Notes
* Full Guide: [adi.tilde.institute/](https://adi.tilde.institute/)

[back](/)