about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2024-01-02 22:05:13 -0600
committerCase Duckworth2024-01-02 22:05:13 -0600
commita2625d7e78646e4d2ef8d1e5b6baec9081c92756 (patch)
treeb76217d14ab72a64558c3a492b9ce1b4caff79e0
downloadnduja-main.tar.gz
nduja-main.zip
Initial commit main
-rw-r--r--README39
-rwxr-xr-xnduja5
2 files changed, 44 insertions, 0 deletions
diff --git a/README b/README new file mode 100644 index 0000000..cd76895 --- /dev/null +++ b/README
@@ -0,0 +1,39 @@
1NDUJA -- an sms-sized ssg
2
3nduja is a static site generator that can fit in a text message or an old-school
4tweet, just barely. It's 140 bytes long on the nose. In fact, I'll put the
5whole thing here for you:
6
7```
8#!/bin/sh
9X()(eval "dd<<.
10`awk -vRS= '!/^</{$0="<p>"$0"</p>"}//'`
11.");N()(X<T>${n%.n});<T||echo '`X<$n`'>T
12<L&&. ./L;for n in *.n;do N;done
13```
14
15Even though this is so short, it does a lot! It loops through every file ending
16in `.n` in the current directory, and then
17
181. automatically adds `<p>` tags to paragraphs not starting with a `<`
192. expands the template file (T) as a shell here-document with its contents.
20
21if `T` doesn't exist, it's created for you! isn't that neat :)
22
23I've even added in EXTENSIBILITY:
24
25If a library file (L) exists, it'll be sourced, meaning you can define whatever
26shell functions you need to make writing your site easier. Crucially, you can
27redefine these two functions:
28
29- `X`, the eXpando function, which defines how to plop your content into T.
30- `N`, the NDUJA function, which defines what to do to turn a .n file into a
31 .. whatever.
32
33Go nuts! You could argue that by redefining those two functions, nduja is not
34really text-sized, but i don't care! the actual script contains the
35functionality you technically need ;)
36
37LICENSE: there isn't one, silly! This program is released to the PUBLIC DOMAIN
38
39see also: unk, nef, ...
diff --git a/nduja b/nduja new file mode 100755 index 0000000..b1f4f29 --- /dev/null +++ b/nduja
@@ -0,0 +1,5 @@
1#!/bin/sh
2X()(eval "dd<<.
3`awk -vRS= '!/^</{$0="<p>"$0"</p>"}//'`
4.");N()(X<T>${n%.n});<T||echo '`X<$n`'>T
5<L&&. ./L;for n in *.n;do N;done