diff options
author | Case Duckworth | 2024-01-02 22:05:13 -0600 |
---|---|---|
committer | Case Duckworth | 2024-01-02 22:05:13 -0600 |
commit | a2625d7e78646e4d2ef8d1e5b6baec9081c92756 (patch) | |
tree | b76217d14ab72a64558c3a492b9ce1b4caff79e0 | |
download | nduja-main.tar.gz nduja-main.zip |
Initial commit main
-rw-r--r-- | README | 39 | ||||
-rwxr-xr-x | nduja | 5 |
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 @@ | |||
1 | NDUJA -- an sms-sized ssg | ||
2 | |||
3 | nduja is a static site generator that can fit in a text message or an old-school | ||
4 | tweet, just barely. It's 140 bytes long on the nose. In fact, I'll put the | ||
5 | whole thing here for you: | ||
6 | |||
7 | ``` | ||
8 | #!/bin/sh | ||
9 | X()(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 | |||
15 | Even though this is so short, it does a lot! It loops through every file ending | ||
16 | in `.n` in the current directory, and then | ||
17 | |||
18 | 1. automatically adds `<p>` tags to paragraphs not starting with a `<` | ||
19 | 2. expands the template file (T) as a shell here-document with its contents. | ||
20 | |||
21 | if `T` doesn't exist, it's created for you! isn't that neat :) | ||
22 | |||
23 | I've even added in EXTENSIBILITY: | ||
24 | |||
25 | If a library file (L) exists, it'll be sourced, meaning you can define whatever | ||
26 | shell functions you need to make writing your site easier. Crucially, you can | ||
27 | redefine 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 | |||
33 | Go nuts! You could argue that by redefining those two functions, nduja is not | ||
34 | really text-sized, but i don't care! the actual script contains the | ||
35 | functionality you technically need ;) | ||
36 | |||
37 | LICENSE: there isn't one, silly! This program is released to the PUBLIC DOMAIN | ||
38 | |||
39 | see 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 | ||
2 | X()(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 | ||