NEF
an even smaller static site generator
from the mind that brought you UNK, comes the new and improved SON OF
UNK, NEF. Where UNK was a bloated one thousand bytes, the
entirety of NEF is four hundred forty-four, over a fifty per cent
reduction in size.
installation
clone this repo.
NEF requires a POSIX environment.
use
create the following files and directories in the same directory as NEF:
- L, the Layout file, which gets expanded by NEF.
if L isn't provided, a default L will be generated.
- H, the Html generator, which converts the input files to
HTML. if H isn't provided, a default function H is called, which
is pretty stupid: it wraps blank-line-separated paragraphs in
<p>
blocks. otherwise, it's pure HTML (mostly; see
layouts, below).
- I/, where the Input files, like pages, go.
each page should have a name of the form
NAME.OUT-FMT.IN-FMT
, where
NAME
is the basename of the file,
OUT-FMT
is the output format (usually HTML),
and IN-FMT
is the input format (whatever -- in this repo
it's called .h
).
- S/, where the Static files, like CSS and images, go.
layouts
the L file is basically a big here-doc, meaning that you can write
arbitrary shell in it however you'd like. the following variables and functions
are made available to L's environment (in addition, of course, to
whatever NEF's environment is):
- X, the eXpander. it turns L into a here-doc.
make sure to escape your files properly!
- H, the Htmlizer. it's a dumb awk function. even if you
have a file H in NEF's directory, this function will
still be here, taunting you with its stupidity.
- P, aliased to
echo
.
- T, aliased to
sed q
, which pulls the first line from
a file. aka, the Title.
- \$H, which keeps track of whether you're using the H file
or function. you probably don't need this. but it's here.
- \$F, the Filename of the current input file.
- \$N, the baseName (without
I/
) of the current
input file.
the default L also runs each input file through the
X function (UNK devotees will be aware of the X function;
it's basically shab but stupider and
smaller), meaning that input files can basically function as templates
themselves, and create their own fun.
uh, yeah, that's it
look, the script is a super short POSIX shell script. it's barely usable by
itself. you're probably going to throw it out and write something else --
that's what I do.
legal
UNK used the WTFPL, which is the
shortest license I've been able to find. however, for NEF, 443 bytes is
far too long: it basically doubles the size of the repo! so I
wrote my own license, which I'm calling the good choices license, or
GCL for short. you can read the LICENSE file, or just read it here:
(c) 2020 Case Duckworth <acdw@acdw.net>
Everyone is permitted to do whatever with this software, without limitation.
This software comes without any warranty whatsoever.
Don't hurt yourself.
Make good choices.
a trim 169 bytes, exclusive of the copyright information!
contributing
uh... send me an email? yeah. do that.