about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2019-06-30 23:42:27 -0500
committerCase Duckworth2019-06-30 23:42:27 -0500
commitcd1a4e64646b1d314b48d134693125007b65118c (patch)
tree629813e1a2cc7b0d121be860d2d7a75518d2c1cc
parentRename (diff)
downloadunk-cd1a4e64646b1d314b48d134693125007b65118c.tar.gz
unk-cd1a4e64646b1d314b48d134693125007b65118c.zip
Add README and LICENSE
-rw-r--r--LICENSE13
-rw-r--r--README.md141
2 files changed, 154 insertions, 0 deletions
diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..edae74f --- /dev/null +++ b/LICENSE
@@ -0,0 +1,13 @@
1DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
2Version 2, December 2004
3
4Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
5
6Everyone is permitted to copy and distribute verbatim or modified
7copies of this license document, and changing it is allowed as long
8as the name is changed.
9
10DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
11TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
12
130. You just DO WHAT THE FUCK YOU WANT TO.
diff --git a/README.md b/README.md new file mode 100644 index 0000000..dc310d1 --- /dev/null +++ b/README.md
@@ -0,0 +1,141 @@
1# UNK
2
3## a very small static site generator
4
5**UNK** is an experiment in minimalism.
6It is a templating static site generator
7with an included markup language
8that all fits with 1000 bytes.
9There are three main scripts:
10
11- **UNK**, a bash script that applies the template
12 to each page and publishes them to the output dir, and
13- **LHT**, an awk script that serves as a (very) basic
14 markup language.
15- **TM**, the default template file for **UNK**.
16
17Both scripts are 250 bytes each, for a total of 500 bytes.
18The default template file takes up the remaining 500 bytes
19of the target 1000 bytes.
20You are, of course, free to make the template file as large
21and involved as you like.
22
23# DETAILS
24
25## UNK
26
27**UNK** takes a set of files in a directory, applies a template to them,
28and output them into another directory as HTML files ready for a server.
29To keep a very small size, **UNK** delegates most file processing to **TM**,
30the main template. It delegates by using an idea found in
31[shab](https://github.com/zimbatm/shab):
32each input file is read as a `heredoc`, which enables
33shell interpolation.
34So the template, as opposed to the engine,
35can do all the heavy-lifting of index generation and navigation and such.
36That means all the
37
38Content goes into the following (hard-coded) directories:
39
40- **I/**, for written (*__i__nput*) content (the pages of the site),
41- **S/**, for ***s***tatic content (css, images, etc.), &
42- **O/**, for the (*__o__utput*) website, ready for `rsync`ing
43 to a server.
44
45If there is no **TM** in the directory where **UNK** is run,
46one will be created that will simply echo the file being processed.
47
48The following variables are made available to **TM**:
49
50- **FN**: the *FileName* (with directories removed)
51 of the file being processed
52- **TT**: the *TiTle* (the first line) of the file
53- **BD**: the *BoDy* (the rest) of the file
54
55as well as this function:
56
57- **X**, for *eXpand*: the `shab` stand-in.
58 It is much simpler than `shab`, and will fail if the template
59 (or if it nests templates, one of the nested ones)
60 has a `ZZ` on a line by itself, due to its `heredoc` nature.
61
62and these aliases (though they're more an artefact of saving space
63in the script, but they can be used in templates):
64
65- **c**: `cat`
66- **q**: `test`
67- **e**: `echo`
68
69As mentioned above, templates can be nested.
70Simply call another template from **TM** with the **X** function.
71
72## LHT
73
74**LHT** stands for *Less HyperText*,
75because that's what you're writing when you're writing it
76(though not much less than HTML).
77Basically,
78blank lines are interpreted as `<p>` tag breaks,
79unless the previous source paragraph started with `<` and ended with `>`.
80It also has support for three inline spans:
81
82- `*em*` or `_em_` as *em*
83- `**strong**` or `__strong__` as **strong**
84- `\`code\`` as `code`.
85
86Everything else is just HTML.
87
88**LHT** was inspired, in part, by
89[Writing HTML in HTML](http://john.ankarstrom.se/html) by John Ankarstrom,
90as well as some other articles I can't think of right now.
91I liked the idea, but some tags in HTML are just annoying to write
92over and over, and take me out of the flow of writing prose.
93So I fixed those few tags.
94**The inline tags are definitely subject to change.**
95
96# Why?
97
98I was bored and decided I'd try to write a static site generator
99that could fit in a [toot] (500 characters).
100I [wrote][1] [a few][2] [of them][3],
101making them smaller and smaller each time.
102By the end, I was left with a *tiny* script
103that delegated almost *all* the work to the template file.
104That script became **UNK** in this repo.
105
106[toot]: https://writing.exchange/web/statuses/102333562361891512
107[1]: https://writing.exchange/web/statuses/102334522981990897
108[2]: https://writing.exchange/web/statuses/102334522981990897
109[3]: https://writing.exchange/web/statuses/102339851501562648
110
111I was feeling pretty high on my horse after writing the tiny SSG,
112so I thought,
113*[maybe I could try for a tootable Markdown converter next][4]* --
114boy, was I wrong about that.
115Markdown is *way* too complicated to fit in 500 bytes.
116So I just wrote the Really Important Parts: `<p>` and some inlines.
117
118[4]: https://writing.exchange/@acdw/102339290120562386
119
120# LEGAL
121
122Copyright &copy; 2019 Case Duckworth <acdw@acdw.net>
123This work is free.
124You can redistribute it and/or modify it under the terms of
125the Do What The Fuck You Want To Public License, Version 2,
126as published by Sam Hocevar.
127See the LICENSE file for more details.
128
129## Why this license?
130
131I was going to go with a stricter license like the GPL,
132but realized that
133
1341. this software isn't so important or time-consuming that I need
135 others to credit me or redistribute the project under the same terms, and
1362. the GPL is *way* too long for a project like this.
137 It's over 35 times *bigger* than the entirety of this project,
138 not counting the content or this README.
139 It would weigh down the entire undertaking.
140 The WTFPL, by contrast, is a trim 443 characters,
141 which is right in keeping with the smallness of this project.