My personal blog's source repository.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
ArtemisNeko fe1e66e926 Update 'files/wishlist.gmi' 2 days ago
files Update 'files/wishlist.gmi' 2 days ago
.drone.yml wtf 3 months ago
.gitignore changed build target 8 months ago
LICENSE Changed work license, wrote something on firefox 89 6 months ago
README.md Changed work license, wrote something on firefox 89 6 months ago
TODO.gmi Finished v1 9 months ago
blog.janet added ast preview option in parser, multi-line blockquote support 3 months ago
blog.sh Changed nickname 2 months ago
template.html.sh Added favicon, pointed build script to beta too 9 months ago

README.md

Aphrodite

The builder is licensed under the CNPLv6 license or later, but not the written content (which is non-free, reserved rights).

Static website generator for my aphrodite.dev NSFW/tech personal blog.

How it works

The blog.sh bash4+ script makes a copy of www into the destination folder (out), then runs find(1) on the destination folder to find every file in it. On each file, it re-runs blog.sh, providing the file's relative path as first argument.

if [[ -d "out" ]]; then
	rm -rf "out"
fi

cp -r www out
find out -type f -exec "$blog_sh" {} \;

For each file, a match is done, the first matching condition being run and all the other dropped.

  • If the extension is .gmi, the handle_html function is run
  • If the file is executable, the handle_rc function is run

The handle_html function assumes the Gemini file to be compliant with the few semantic requirements defined in this project.

input="$1/$2.gmi"
output="$1/$2.html"
eval $(janet blog.janet --meta $input)
janet blog.janet --html $input | ./template.html.sh > $output

Using the janet script and the template building script, the final HTML version is built.

The handle_rc function assumes the output file name to be the input one, minus its extension. That means that feed.xml.janet will be generated as feed.xml. There is no code to handle extension-less files.

set +e
input="$1/$2.$3"
output="$1/$2"
$input > $output
if (( $? != 0 )); then
	# failed: cleanup
	rm -f $output
fi
rm $input
set -e

The standard output of the input executable file is piped to the output file, allowing for any kind of generated content, including binary files (such as images).

Additional logic will come at some point, allowing for templatization of existing files, as to allow running custom scripts on otherwise untransformable binary files (such as images).