diff options
author | Case Duckworth | 2019-07-01 12:42:31 -0500 |
---|---|---|
committer | Case Duckworth | 2019-07-01 12:42:31 -0500 |
commit | 37dcb0a1663a28ed70653777130d2054e54d876e (patch) | |
tree | 7e61c9341e4cc9af962857c4e07b5ee3e5983310 | |
parent | Move README to I/index.lh and symlink (diff) | |
download | unk-37dcb0a1663a28ed70653777130d2054e54d876e.tar.gz unk-37dcb0a1663a28ed70653777130d2054e54d876e.zip |
Reverse symlink direction for sr.ht
l---------[-rw-r--r--] | I/index.lh | 179 | ||||
-rw-r--r--[l---------] | README.md | 179 |
2 files changed, 179 insertions, 179 deletions
diff --git a/I/index.lh b/I/index.lh index 3b84431..32d46ee 100644..120000 --- a/I/index.lh +++ b/I/index.lh | |||
@@ -1,178 +1 @@ | |||
1 | <h1>UNK</h1> | ../README.md \ No newline at end of file | |
2 | |||
3 | <h2>a very small static site generator</h2> | ||
4 | |||
5 | __UNK__ is an experiment in minimalism. | ||
6 | It is a templating static site generator | ||
7 | with an included markup language | ||
8 | that all fits with 1000 bytes. | ||
9 | There are three main scripts: | ||
10 | |||
11 | <ul> | ||
12 | <li><strong>UNK</strong, a bash script that applies the template | ||
13 | to each page and publishes them to the output dir,</li> | ||
14 | <li><strong>LHT</strong, an awk script that serves as a (very) basic | ||
15 | markup language, and</li> | ||
16 | <li><strong>TM</strong, | ||
17 | the default template script for <strong>UNK</strong>.</li> | ||
18 | </ul> | ||
19 | |||
20 | __UNK__ and __LHT__ are 250 bytes each, for a total of 500 bytes. | ||
21 | __TM__ takes up the remaining 500 bytes | ||
22 | of the target 1000 bytes. | ||
23 | You are, of course, free to make the template file as large | ||
24 | and involved as you like. | ||
25 | |||
26 | <h1>DETAILS</h1> | ||
27 | |||
28 | <h2>unk</h2> | ||
29 | |||
30 | __UNK__ takes a set of files in a directory, applies a template to them, | ||
31 | and output them into another directory as HTML files ready for a server. | ||
32 | To keep a very small size, __UNK__ delegates most file processing to __TM__, | ||
33 | the main template. It delegates by using an idea found in | ||
34 | <a href="https://github.com/zimbatm/shab">shab</a>: | ||
35 | each input file is read as a `heredoc`, which enables | ||
36 | shell interpolation. | ||
37 | So the template, as opposed to the engine, | ||
38 | can do all the heavy-lifting of index generation and navigation and such. | ||
39 | |||
40 | Content goes into the following (hard-coded) directories: | ||
41 | |||
42 | <ul> | ||
43 | <li><strong>I/</strong>, | ||
44 | for written (<em><strong>I</strong>nput</em>) content | ||
45 | (the pages of the site),</li> | ||
46 | <li><strong>S/</strong>, for <em><strong>S</strong>tatic</em> content | ||
47 | (css, images, etc.), &</li> | ||
48 | <li><strong>O/</strong>, for the (<em><strong>O</strong>utput</em>) | ||
49 | website, ready for <code>rsync</code>ing to a server.</li> | ||
50 | </ul> | ||
51 | |||
52 | If there is no __TM__ in the directory where __UNK__ is run, | ||
53 | one will be created that will simply `cat` the file being processed. | ||
54 | |||
55 | The following variables are made available to __TM__: | ||
56 | |||
57 | <ul> | ||
58 | <li><strong>FN</strong>: the <em>FileName</em> | ||
59 | (with directories removed) of the file being processed</li> | ||
60 | <li><strong>TT</strong>: the <em>TiTle</em> | ||
61 | (the first line) of the file</li> | ||
62 | <li><strong>BD</strong>: the <em>BoDy</em> | ||
63 | (the rest) of the file</li> | ||
64 | </ul> | ||
65 | |||
66 | as well as this function: | ||
67 | |||
68 | <ul> | ||
69 | <li><strong>X</strong, for <em>eXpand</em>: | ||
70 | the <code>shab</code> stand-in. | ||
71 | It is much simpler than <code>shab</code>, | ||
72 | and will fail if the template | ||
73 | (or if it nests templates, one of the nested ones) | ||
74 | has a <code>ZZ</code> on a line by itself, | ||
75 | due to its <code>heredoc</code> nature.</li> | ||
76 | </ul> | ||
77 | |||
78 | and these aliases (though they're more an artefact of saving space | ||
79 | in the script, but they can be used in templates): | ||
80 | |||
81 | <ul> | ||
82 | <li><strong>c</strong>: <code>cat</code></li> | ||
83 | <li><strong>q</strong>: <code>test</code></li> | ||
84 | <li><strong>e</strong>: <code>echo</code></li> | ||
85 | </ul> | ||
86 | |||
87 | As mentioned above, templates can be nested. | ||
88 | Simply call another template from __TM__ with the __X__ function. | ||
89 | |||
90 | <h2>lht</h2> | ||
91 | |||
92 | __LHT__ stands for *Less HyperText*, | ||
93 | because that's what you're writing when you're writing it | ||
94 | (though not much less than HTML). | ||
95 | Basically, | ||
96 | blank lines are interpreted as <code><p></code> tag breaks, | ||
97 | unless the previous source paragraph started with | ||
98 | <code><</code> and ended with <code>></code>. | ||
99 | It also has support for three inline spans: | ||
100 | |||
101 | <ul> | ||
102 | <li><code>*em*</code> | ||
103 | as <em>em</em></li> | ||
104 | <li><code>__strong__</code> | ||
105 | as <strong>strong</strong></li> | ||
106 | <li><code>`code` as <code>code</code></li> | ||
107 | </ul> | ||
108 | |||
109 | Everything else is just HTML. | ||
110 | This means that a valid `.lht` file is *almost* a valid `.md` file, | ||
111 | except where it nests HTML and Markdown | ||
112 | (so it's not really, but you can run it through Markdown in a pinch | ||
113 | and get the basic idea across. | ||
114 | This file, for example, is both `index.lht` and `README.md` | ||
115 | (they're just symlinked to each other), | ||
116 | so it's got some weirdness to keep things compatible between Markdown and LHT. | ||
117 | But if you're just writing for LHT, it can be much simpler.). | ||
118 | |||
119 | __LHT__ was inspired, in part, by | ||
120 | <a href="http://john.ankarstrom.se/html">Writing HTML in HTML</a> | ||
121 | by John Ankarstrom, | ||
122 | as well as some other articles I can't think of right now. | ||
123 | I liked the idea, but some tags in HTML are just annoying to write | ||
124 | over and over, and take me out of the flow of writing prose. | ||
125 | So I fixed those few tags. | ||
126 | __The inline tags are definitely subject to change.__ | ||
127 | |||
128 | <h1>Why?</h1> | ||
129 | |||
130 | I was bored and decided I'd try to write a static site generator | ||
131 | that could fit in a | ||
132 | <a href="https://writing.exchange/web/statuses/102333562361891512">toot</a> | ||
133 | (500 characters). | ||
134 | I | ||
135 | <a href="https://writing.exchange/web/statuses/102334522981990897">wrote</a> | ||
136 | <a href="https://writing.exchange/web/statuses/102334522981990897">a few</a> | ||
137 | <a href="https://writing.exchange/web/statuses/102339851501562648">of them</a>, | ||
138 | making them smaller and smaller each time. | ||
139 | By the end, I was left with a *tiny* script | ||
140 | that delegated almost *all* the work to the template file. | ||
141 | That script became __UNK__ in this repo. | ||
142 | |||
143 | I was feeling pretty high on my horse after writing the tiny SSG, | ||
144 | so I thought, | ||
145 | <em><a href="https://writing.exchange/@acdw/102339290120562386">maybe | ||
146 | I could try for a tootable Markdown converter next</a></em> | ||
147 | boy, was I wrong about that. | ||
148 | Markdown is *way* too complicated to fit in 500 bytes. | ||
149 | So I just wrote the Really Important Parts: <code><p></code> | ||
150 | and some inlines. | ||
151 | |||
152 | <h1>LEGAL</h1> | ||
153 | |||
154 | Copyright © 2019 Case Duckworth | ||
155 | <a href="mailto:acdw@acdw.net"><acdw@acdw.net></a>. | ||
156 | |||
157 | This work is free. | ||
158 | You can redistribute it and/or modify it under the terms of | ||
159 | the Do What The Fuck You Want To Public License, Version 2, | ||
160 | as published by Sam Hocevar. | ||
161 | See the LICENSE file for more details. | ||
162 | |||
163 | <h2>Why this license?</h2> | ||
164 | |||
165 | I was going to go with a stricter license like the GPL, | ||
166 | but realized that | ||
167 | |||
168 | <ol> | ||
169 | <li>this software isn't so important or time-consuming that I need | ||
170 | others to credit me or redistribute the project under the same terms, | ||
171 | and</li> | ||
172 | <li>the GPL is <em>way</em> too long for a project like this. | ||
173 | It's over 35 times <em>bigger</em> than the entirety of this project, | ||
174 | not counting the content or this README. | ||
175 | It would weigh down the entire undertaking. | ||
176 | The WTFPL, by contrast, is a trim 443 characters, | ||
177 | which is right in keeping with the smallness of this project.</li> | ||
178 | </ol> | ||
diff --git a/README.md b/README.md index b23acff..3b84431 120000..100644 --- a/README.md +++ b/README.md | |||
@@ -1 +1,178 @@ | |||
1 | I/index.lh \ No newline at end of file | 1 | <h1>UNK</h1> |
2 | |||
3 | <h2>a very small static site generator</h2> | ||
4 | |||
5 | __UNK__ is an experiment in minimalism. | ||
6 | It is a templating static site generator | ||
7 | with an included markup language | ||
8 | that all fits with 1000 bytes. | ||
9 | There are three main scripts: | ||
10 | |||
11 | <ul> | ||
12 | <li><strong>UNK</strong, a bash script that applies the template | ||
13 | to each page and publishes them to the output dir,</li> | ||
14 | <li><strong>LHT</strong, an awk script that serves as a (very) basic | ||
15 | markup language, and</li> | ||
16 | <li><strong>TM</strong, | ||
17 | the default template script for <strong>UNK</strong>.</li> | ||
18 | </ul> | ||
19 | |||
20 | __UNK__ and __LHT__ are 250 bytes each, for a total of 500 bytes. | ||
21 | __TM__ takes up the remaining 500 bytes | ||
22 | of the target 1000 bytes. | ||
23 | You are, of course, free to make the template file as large | ||
24 | and involved as you like. | ||
25 | |||
26 | <h1>DETAILS</h1> | ||
27 | |||
28 | <h2>unk</h2> | ||
29 | |||
30 | __UNK__ takes a set of files in a directory, applies a template to them, | ||
31 | and output them into another directory as HTML files ready for a server. | ||
32 | To keep a very small size, __UNK__ delegates most file processing to __TM__, | ||
33 | the main template. It delegates by using an idea found in | ||
34 | <a href="https://github.com/zimbatm/shab">shab</a>: | ||
35 | each input file is read as a `heredoc`, which enables | ||
36 | shell interpolation. | ||
37 | So the template, as opposed to the engine, | ||
38 | can do all the heavy-lifting of index generation and navigation and such. | ||
39 | |||
40 | Content goes into the following (hard-coded) directories: | ||
41 | |||
42 | <ul> | ||
43 | <li><strong>I/</strong>, | ||
44 | for written (<em><strong>I</strong>nput</em>) content | ||
45 | (the pages of the site),</li> | ||
46 | <li><strong>S/</strong>, for <em><strong>S</strong>tatic</em> content | ||
47 | (css, images, etc.), &</li> | ||
48 | <li><strong>O/</strong>, for the (<em><strong>O</strong>utput</em>) | ||
49 | website, ready for <code>rsync</code>ing to a server.</li> | ||
50 | </ul> | ||
51 | |||
52 | If there is no __TM__ in the directory where __UNK__ is run, | ||
53 | one will be created that will simply `cat` the file being processed. | ||
54 | |||
55 | The following variables are made available to __TM__: | ||
56 | |||
57 | <ul> | ||
58 | <li><strong>FN</strong>: the <em>FileName</em> | ||
59 | (with directories removed) of the file being processed</li> | ||
60 | <li><strong>TT</strong>: the <em>TiTle</em> | ||
61 | (the first line) of the file</li> | ||
62 | <li><strong>BD</strong>: the <em>BoDy</em> | ||
63 | (the rest) of the file</li> | ||
64 | </ul> | ||
65 | |||
66 | as well as this function: | ||
67 | |||
68 | <ul> | ||
69 | <li><strong>X</strong, for <em>eXpand</em>: | ||
70 | the <code>shab</code> stand-in. | ||
71 | It is much simpler than <code>shab</code>, | ||
72 | and will fail if the template | ||
73 | (or if it nests templates, one of the nested ones) | ||
74 | has a <code>ZZ</code> on a line by itself, | ||
75 | due to its <code>heredoc</code> nature.</li> | ||
76 | </ul> | ||
77 | |||
78 | and these aliases (though they're more an artefact of saving space | ||
79 | in the script, but they can be used in templates): | ||
80 | |||
81 | <ul> | ||
82 | <li><strong>c</strong>: <code>cat</code></li> | ||
83 | <li><strong>q</strong>: <code>test</code></li> | ||
84 | <li><strong>e</strong>: <code>echo</code></li> | ||
85 | </ul> | ||
86 | |||
87 | As mentioned above, templates can be nested. | ||
88 | Simply call another template from __TM__ with the __X__ function. | ||
89 | |||
90 | <h2>lht</h2> | ||
91 | |||
92 | __LHT__ stands for *Less HyperText*, | ||
93 | because that's what you're writing when you're writing it | ||
94 | (though not much less than HTML). | ||
95 | Basically, | ||
96 | blank lines are interpreted as <code><p></code> tag breaks, | ||
97 | unless the previous source paragraph started with | ||
98 | <code><</code> and ended with <code>></code>. | ||
99 | It also has support for three inline spans: | ||
100 | |||
101 | <ul> | ||
102 | <li><code>*em*</code> | ||
103 | as <em>em</em></li> | ||
104 | <li><code>__strong__</code> | ||
105 | as <strong>strong</strong></li> | ||
106 | <li><code>`code` as <code>code</code></li> | ||
107 | </ul> | ||
108 | |||
109 | Everything else is just HTML. | ||
110 | This means that a valid `.lht` file is *almost* a valid `.md` file, | ||
111 | except where it nests HTML and Markdown | ||
112 | (so it's not really, but you can run it through Markdown in a pinch | ||
113 | and get the basic idea across. | ||
114 | This file, for example, is both `index.lht` and `README.md` | ||
115 | (they're just symlinked to each other), | ||
116 | so it's got some weirdness to keep things compatible between Markdown and LHT. | ||
117 | But if you're just writing for LHT, it can be much simpler.). | ||
118 | |||
119 | __LHT__ was inspired, in part, by | ||
120 | <a href="http://john.ankarstrom.se/html">Writing HTML in HTML</a> | ||
121 | by John Ankarstrom, | ||
122 | as well as some other articles I can't think of right now. | ||
123 | I liked the idea, but some tags in HTML are just annoying to write | ||
124 | over and over, and take me out of the flow of writing prose. | ||
125 | So I fixed those few tags. | ||
126 | __The inline tags are definitely subject to change.__ | ||
127 | |||
128 | <h1>Why?</h1> | ||
129 | |||
130 | I was bored and decided I'd try to write a static site generator | ||
131 | that could fit in a | ||
132 | <a href="https://writing.exchange/web/statuses/102333562361891512">toot</a> | ||
133 | (500 characters). | ||
134 | I | ||
135 | <a href="https://writing.exchange/web/statuses/102334522981990897">wrote</a> | ||
136 | <a href="https://writing.exchange/web/statuses/102334522981990897">a few</a> | ||
137 | <a href="https://writing.exchange/web/statuses/102339851501562648">of them</a>, | ||
138 | making them smaller and smaller each time. | ||
139 | By the end, I was left with a *tiny* script | ||
140 | that delegated almost *all* the work to the template file. | ||
141 | That script became __UNK__ in this repo. | ||
142 | |||
143 | I was feeling pretty high on my horse after writing the tiny SSG, | ||
144 | so I thought, | ||
145 | <em><a href="https://writing.exchange/@acdw/102339290120562386">maybe | ||
146 | I could try for a tootable Markdown converter next</a></em> | ||
147 | boy, was I wrong about that. | ||
148 | Markdown is *way* too complicated to fit in 500 bytes. | ||
149 | So I just wrote the Really Important Parts: <code><p></code> | ||
150 | and some inlines. | ||
151 | |||
152 | <h1>LEGAL</h1> | ||
153 | |||
154 | Copyright © 2019 Case Duckworth | ||
155 | <a href="mailto:acdw@acdw.net"><acdw@acdw.net></a>. | ||
156 | |||
157 | This work is free. | ||
158 | You can redistribute it and/or modify it under the terms of | ||
159 | the Do What The Fuck You Want To Public License, Version 2, | ||
160 | as published by Sam Hocevar. | ||
161 | See the LICENSE file for more details. | ||
162 | |||
163 | <h2>Why this license?</h2> | ||
164 | |||
165 | I was going to go with a stricter license like the GPL, | ||
166 | but realized that | ||
167 | |||
168 | <ol> | ||
169 | <li>this software isn't so important or time-consuming that I need | ||
170 | others to credit me or redistribute the project under the same terms, | ||
171 | and</li> | ||
172 | <li>the GPL is <em>way</em> too long for a project like this. | ||
173 | It's over 35 times <em>bigger</em> than the entirety of this project, | ||
174 | not counting the content or this README. | ||
175 | It would weigh down the entire undertaking. | ||
176 | The WTFPL, by contrast, is a trim 443 characters, | ||
177 | which is right in keeping with the smallness of this project.</li> | ||
178 | </ol> | ||