The fastest, period.

Signed-off-by: Izuru Yakumo <yakumo.izuru@chaotic.ninja>

git-svn-id: file:///srv/svn/repo/aya/trunk@56 cec141ff-132a-4243-88a5-ce187bd62f94
This commit is contained in:
yakumo.izuru
2023-04-09 02:39:19 +00:00
parent 13a7fd73d0
commit f32cb3ba42
31 changed files with 93 additions and 450 deletions

View File

@@ -1,10 +1,8 @@
# zs
# aya
zs is an extremely minimal static site generator written in Go.
aya is an extremely minimal static site generator written in Go.
It's inspired by `zas` generator, but is even more minimal.
The name stands for 'zen static' as well as it's my initials.
This crow tengu stands for 'the fastest one in Gensokyo' and yes this is also a Touhou Project reference.
## Features
@@ -17,9 +15,9 @@ The name stands for 'zen static' as well as it's my initials.
## Installation
Download the binaries from Github or build it manually:
Build it manually assuming you have Go installed:
$ go get git.mills.io/prologic/zs
$ go install marisa.chaotic.ninja/aya@latest
## Ideology
@@ -27,7 +25,7 @@ Keep your texts in markdown, or HTML format right in the main directory
of your blog/site.
Keep all service files (extensions, layout pages, deployment scripts etc)
in the `.zs` subdirectory.
in the `.aya` subdirectory.
Define variables in the header of the content files using [YAML]:
@@ -40,18 +38,18 @@ Define variables in the header of the content files using [YAML]:
Use placeholders for variables and plugins in your markdown or html
files, e.g. `{{ title }}` or `{{ command arg1 arg2 }}.
Write extensions in any language you like and put them into the `.zs`
Write extensions in any language you like and put them into the `.aya`
subdiretory.
Everything the extensions prints to stdout becomes the value of the
placeholder.
Every variable from the content header will be passed via environment variables like `title` becomes `$ZS_TITLE` and so on. There are some special variables:
Every variable from the content header will be passed via environment variables like `title` becomes `$AYA_TITLE` and so on. There are some special variables:
* `$ZS` - a path to the `zs` executable
* `$ZS_OUTDIR` - a path to the directory with generated files
* `$ZS_FILE` - a path to the currently processed markdown file
* `$ZS_URL` - a URL for the currently generated page
* `$AYA` - a path to the `aya` executable
* `$AYA_OUTDIR` - a path to the directory with generated files
* `$AYA_FILE` - a path to the currently processed markdown file
* `$AYA_URL` - a URL for the currently generated page
## Example of RSS generation
@@ -59,19 +57,19 @@ Extensions can be written in any language you know (Bash, Python, Lua, JavaScrip
``` bash
for f in ./blog/*.md ; do
d=$($ZS var $f date)
d=$($AYA var $f date)
if [ ! -z $d ] ; then
timestamp=`date --date "$d" +%s`
url=`$ZS var $f url`
title=`$ZS var $f title | tr A-Z a-z`
descr=`$ZS var $f description`
url=`$AYA var $f url`
title=`$AYA var $f title | tr A-Z a-z`
descr=`$AYA var $f description`
echo $timestamp \
"<item>" \
"<title>$title</title>" \
"<link>http://zserge.com/$url</link>" \
"<link>http://ayaerge.com/$url</link>" \
"<description>$descr</description>" \
"<pubDate>$(date --date @$timestamp -R)</pubDate>" \
"<guid>http://zserge.com/$url</guid>" \
"<guid>http://ayaerge.com/$url</guid>" \
"</item>"
fi
done | sort -r -n | cut -d' ' -f2-
@@ -83,21 +81,21 @@ There are two special plugin names that are executed every time the build
happens - `prehook` and `posthook`. You can define some global actions here like
content generation, or additional commands, like LESS to CSS conversion:
# .zs/post
# .aya/post
#!/bin/sh
lessc < $ZS_OUTDIR/styles.less > $ZS_OUTDIR/styles.css
rm -f $ZS_OUTDIR/styles.css
lessc < $AYA_OUTDIR/styles.less > $AYA_OUTDIR/styles.css
rm -f $AYA_OUTDIR/styles.css
## Command line usage
`zs build` re-builds your site.
`aya build` re-builds your site.
`zs build <file>` re-builds one file and prints resulting content to stdout.
`aya build <file>` re-builds one file and prints resulting content to stdout.
`zs watch` rebuilds your site every time you modify any file.
`aya watch` rebuilds your site every time you modify any file.
`zs var <filename> [var1 var2...]` prints a list of variables defined in the
`aya var <filename> [var1 var2...]` prints a list of variables defined in the
header of a given markdown file, or the values of certain variables (even if
it's an empty string).