diff options
| author | yctct <yctct@yctct.com> | 2026-04-22 16:44:37 +0200 |
|---|---|---|
| committer | yctct <yctct@yctct.com> | 2026-04-22 16:44:37 +0200 |
| commit | badd07e40c80bcf8252e20b2df87af0f197f3ce1 (patch) | |
| tree | 84e34e4787820e3e690bb722645fdb3a3828ddb0 /bin | |
First commit, add files
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/lmt | bin | 0 -> 953744 bytes | |||
| -rwxr-xr-x | bin/mkws | 78 | ||||
| -rwxr-xr-x | bin/pp | bin | 0 -> 805432 bytes |
3 files changed, 78 insertions, 0 deletions
| Binary files differ diff --git a/bin/mkws b/bin/mkws new file mode 100755 index 0000000..99494c7 --- /dev/null +++ b/bin/mkws @@ -0,0 +1,78 @@ +#!/bin/sh +PATH=./bin:$PATH + +usage() { + >&2 printf "usage: %s url [path]\\n" "$(basename "$0")" + exit 1 +} + +test $# -lt 1 && usage + +export SRC="${2:-.}" +export SHARE="${MKWSTHEMEDIR:-${SRC}/share}" +export LANG=en_GB.UTF-8 + + +if ! test -f "${SRC}"/index.upphtml +then + >&2 printf "no index.upphtml file found\\n" + exit 1 +fi + +for t in "${SRC}"/*.upphtml +do + printf "Making $(basename "${t%.upphtml}".html)\n" + pp "${SHARE}"/l.upphtml "${t}" "$1" > \ + "$(basename "${t%.upphtml}".html)" +done + +printf "Clearing blog index\n" +cp "${SRC}"/blog/preamble.txt "${SRC}"/blog/index.prehtml +printf "<ul>\n" >> "${SRC}"/blog/index.prehtml +for t in $(ls "${SRC}"/blog/*.upphtml | sort -r) +do + printf "Making blog post: $(basename "${t%.upphtml}".html)\n" + pp "${SHARE}"/l.upphtml "${t}" "$1" > \ + blog/"$(basename "${t%.upphtml}".html)" + linkname=`sed -n 's/.*<h1>\(.*\)<\/h1>.*/\1/ip;T;q' "${SRC}"/blog/"$(basename "${t%.upphtml}".html)"` + #desc=`sed -n 's/.*<h2>\(.*\)<\/h2>.*/\1/ip;T;q' "${SRC}"/blog/"$(basename "${t%.upphtml}".html)"` + #printf "<li><a href=/blog/$(basename "${t%.upphtml}".html)>${linkname} - ${desc}</a></li>\n" >> "${SRC}"/blog/index.prehtml + printf "<li><a href=/blog/$(basename "${t%.upphtml}".html)>${linkname}</a></li>\n<br>\n" >> "${SRC}"/blog/index.prehtml +done +printf "Remaking blog index\n" +printf "</ul>\n" >> "${SRC}"/blog/index.prehtml +printf "</main>\n" >> "${SRC}"/blog/index.prehtml +pp "${SHARE}"/l.upphtml "${SRC}"/blog/index.prehtml "$1" > \ + "${SRC}"/blog/index.html +# cleanup +rm "${SRC}"/blog/index.prehtml + +printf "Making sitemap.xml\n" +pp "${SHARE}"/sitemap.uppxml "$1" > sitemap.xml + +printf "Updating RSS feed\n" +pp "${SHARE}"/feed.uppxml "$1" > feed.xml + +if [ ! -d "${SRC}"/output ]; +then + mkdir "${SRC}"/output + mkdir "${SRC}"/output/blog + mkdir "${SRC}"/output/assets +fi + +printf "Lazy-fying images\n" +find . -name "*.html" | xargs sed -i -e 's/<img/<img loading="lazy"/g' + +printf "Overwriting old site folder\n" +mv "${SRC}"/blog/*.html "${SRC}"/output/blog +mv "${SRC}"/*.html "${SRC}"/output +mv "${SRC}"/sitemap.xml "${SRC}"/output +mv "${SRC}"/feed.xml "${SRC}"/output +if [ -d "${SRC}"/assets ]; +then + cp -r "${SRC}"/assets/* "${SRC}"/output/assets +fi +if [ -e "${SRC}"/robots.txt ]; +then + cp "${SRC}"/robots.txt "${SRC}"/output +fi Binary files differ |
