From 267ce378e2cdfb1e72dcfcd05c8d4b69da9c79cb Mon Sep 17 00:00:00 2001 From: Adam Stück Date: Sun, 17 Dec 2023 19:54:39 +0100 Subject: overhaul: switch from ssg to barf --- .build.yml | 6 +- .gitignore | 1 - Makefile | 13 +++ README.md | 2 +- barf | 105 +++++++++++++++++++++++ build/atom.xml | 10 +++ build/favicon.ico | Bin 46927 -> 0 bytes build/index.html | 92 +++++++++++---------- build/main.css | 90 -------------------- build/pages.tsv | 0 build/posts.tsv | 0 build/rss.xml | 39 --------- build/sitemap.xml | 8 -- footer.html | 16 ++++ header.html | 16 ++++ index.md | 33 ++++++++ src/_footer.html | 11 --- src/_header.html | 17 ---- src/favicon.ico | Bin 46927 -> 0 bytes src/index.md | 29 ------- src/main.css | 90 -------------------- src/rss.xml | 39 --------- ssg | 243 ------------------------------------------------------ 23 files changed, 244 insertions(+), 616 deletions(-) delete mode 100644 .gitignore create mode 100644 Makefile create mode 100755 barf create mode 100644 build/atom.xml delete mode 100644 build/favicon.ico delete mode 100644 build/main.css create mode 100644 build/pages.tsv create mode 100644 build/posts.tsv delete mode 100644 build/rss.xml delete mode 100644 build/sitemap.xml create mode 100644 footer.html create mode 100644 header.html create mode 100644 index.md delete mode 100644 src/_footer.html delete mode 100644 src/_header.html delete mode 100644 src/favicon.ico delete mode 100644 src/index.md delete mode 100644 src/main.css delete mode 100644 src/rss.xml delete mode 100755 ssg diff --git a/.build.yml b/.build.yml index 68c0e76..15983b6 100644 --- a/.build.yml +++ b/.build.yml @@ -2,13 +2,11 @@ image: alpine/edge oauth: pages.sr.ht/PAGES:RW packages: - hut -- lowdown environment: site: arena.adast.dk tasks: - package: | - cd arena-web - ./ssg src/ build/ arena https://$site - tar -C build -cvz . > ../site.tar.gz + cd arena-web/build + tar -cvz . > ../../site.tar.gz - upload: | hut pages publish -d $site site.tar.gz diff --git a/.gitignore b/.gitignore deleted file mode 100644 index fc83353..0000000 --- a/.gitignore +++ /dev/null @@ -1 +0,0 @@ -build/.files diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b16a580 --- /dev/null +++ b/Makefile @@ -0,0 +1,13 @@ +build: + sh ./barf + rsync -r public/ build/public + +clean: + rm -rf build/* + +watch: + while true; do \ + ls -d .git/* * posts/* pages/* header.html | entr -cd make ;\ + done + +.PHONY: build clean watch diff --git a/README.md b/README.md index 00ff290..f15e4d8 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # arena-web -Sources for [arena.adast.dk](https://arena.adast.dk), built with [ssg](https://rgz.ee/ssg.html). +Sources for [arena.adast.dk](https://arena.adast.dk), built with [barf](https://barf.bt.ht). [[project home]](https://sr.ht/~adamski/arena/) diff --git a/barf b/barf new file mode 100755 index 0000000..81bbcd2 --- /dev/null +++ b/barf @@ -0,0 +1,105 @@ +#!/bin/sh +set -eu +MARKDOWN=smu +IFS=' ' + +# Create tab separated file with filename, title, creation date, last update +index_tsv() { + for f in "$1"/*.md + do + title=$(sed -n '/^# /{s/# //p; q}' "$f") + printf '%s\t%s\t%s\t%s\n' "$f" "${title:="No Title"}" + done +} + +index_html() { + # Print header + title=$(sed -n '/^# /{s/# //p; q}' index.md) + sed "s/{{TITLE}}/$title/" header.html + + # Intro text + $MARKDOWN index.md + + echo "" + + # Print footer after post list + cat footer.html +} + +atom_xml() { + uri=$(sed -rn '/atom.xml/ s/.*href="([^"]*)".*/\1/ p' header.html) + domain=$(echo "$uri" | sed 's/atom.xml//g' | sed 's|/[^/]*$||') + first_commit_date=$(git log --pretty='format:%ai' . | cut -d ' ' -f1 | tail -1) + + cat < + + $(sed -n '/^# /{s/# //p; q}' index.md) + + $(date +%FT%TZ) + + $(git config user.name) + + $domain,$first_commit_date:default-atom-feed/ +EOF + + while read -r f title created; do + + content=$($MARKDOWN "$f" | sed 's/&/\&/g; s//\>/g; s/"/\"/g; s/'"'"'/\'/g') + post_link=$(echo "$f" | sed -E 's|posts/(.*).md|\1|') + basic_date=$(echo $(head -3 "$f" | tail -1)) + published_date=$(date -d $basic_date -u +%Y-%m-%dT10:%M:%SZ) + + cat < + $title + $content + + $domain/$post_link + $published_date + $published_date + +EOF + done < "$1" + + echo '' +} + +write_page() { + filename=$1 + directory=$(echo $(basename "$filename" .md)) + $(mkdir -p build/$directory) + target=$(echo "$filename" | sed -r 's|\w+/(.*).md|build/\1/index.html|') + created=$(echo $(head -3 "$filename" | tail -1)) + title=$2 + + $MARKDOWN "$filename" | \ + cat header.html - |\ + sed "s|{{TITLE}}|$title|" \ + > "$target" && cat footer.html >> "$target" +} + +rm -rf build && mkdir build + +# Blog posts +index_tsv posts | sort -rt " " -k 3 > build/posts.tsv +index_html build/posts.tsv > build/index.html +atom_xml build/posts.tsv > build/atom.xml +while read -r f title created; do + write_page "$f" "$title" "$created" +done < build/posts.tsv + +# Pages +index_tsv pages > build/pages.tsv +while read -r f title created; do + write_page "$f" "$title" "$created" +done < build/pages.tsv diff --git a/build/atom.xml b/build/atom.xml new file mode 100644 index 0000000..3bcd04a --- /dev/null +++ b/build/atom.xml @@ -0,0 +1,10 @@ + + + arena: Quake-like multiplayer shooter + + 2023-12-17T20:55:56Z + + Adam Stück + + https://arena.adast.dk,2022-04-23:default-atom-feed/ + diff --git a/build/favicon.ico b/build/favicon.ico deleted file mode 100644 index d537e87..0000000 Binary files a/build/favicon.ico and /dev/null differ diff --git a/build/index.html b/build/index.html index 70b828c..2528cd3 100644 --- a/build/index.html +++ b/build/index.html @@ -1,34 +1,34 @@ - - - - - - arena: Quake-like multiplayer shooter - - - - - -
- -
-

arena: Quake-like multiplayer shooter

+ + + + + + + arena: Quake-like multiplayer shooter + + + -

2021-05-07

+ -
-

TODO: Update post!

+
+

arena: Quake-like multiplayer shooter

+

arena is currently on hiatus. I am hoping to do a +complete open-source rewrite using the Godot game +engine.
+~ 2023-12-17

- -

Aftershock (working title) is a multiplayer old-school arena shooter being made in Unity. It’s a hobby project that I have been working on since 2016. It started as a warmup project before jumping into developing an MMO, but I have since learned how much work goes into making just a multiplayer fps. Especially as a solo project.

- -

At it’s core, Aftershock is supposed to be my attempt at recreating a mix of Quake 3 / Quake Live along with whatever else I decide to add.

- +

arena (working title) is a multiplayer old-school arena shooter being made +by me, Adam Stück, with the Unity game engine. It's a hobby +project that I have been working on since 2016. It started as a warmup +project before jumping into developing an MMO, but I have since learned how +much work goes into making just a multiplayer fps. Especially as a solo +project.

+

At it's core, arena is supposed to be my attempt at recreating a mix of +Quake 3 / Quake Live along with whatever else I decide to add.

Main features (so far):

-
  • p2p multiplayer
  • support for custom maps
  • @@ -37,25 +37,29 @@
  • health pickups
  • 3 gamemodes (FFA, TDM, Race)
- -

I’m in the process of rewriting a lot of systems in the game at the moment because I’m switching from janky p2p multiplayer to an authoritative server setup with client-side prediction (more).

- -

➤ Gameplay clips
-➤ Follow my progress

- -
- -

Have a comment on one of my posts? Start a discussion in my public inbox by -sending an email to ~adamski/public-inbox@lists.sr.ht [mailing list -etiquette]

+

I'm in the process of rewriting a lot of systems in the game at the moment +because I'm switching from janky p2p multiplayer to an authoritative server +setup with client-side prediction +(more).

+ +
    +
-
- - diff --git a/build/main.css b/build/main.css deleted file mode 100644 index 4d89bb6..0000000 --- a/build/main.css +++ /dev/null @@ -1,90 +0,0 @@ -* { - box-sizing: border-box; -} -body { - font-family: sans-serif; - line-height: 1.45; - margin: 0 auto; - max-width: 45rem; - padding: 0 15px; -} -hr { - background-color: grey; - border: 0; - height: 1px; - margin: 2rem 0; -} -nav { - margin: 2rem 0 0; -} -main p { - margin: 1rem; -} -h1,h2,h3,h4 { - margin: 2rem 0 0; -} -h1 { - margin-bottom: 0.5rem; -} -h1 + p { - margin: 0 0 1rem; -} -span.created { - display: block; - margin: 4px 15px; -} -img { - border: 1px solid lightgrey; - height: auto; - max-width: 100%; - width: auto; -} -blockquote { - background-color: linen; - border-left: 4px solid lightcoral; - margin: 2rem 0; - padding: 10px; -} -blockquote p { - margin: 0; -} -figure { - margin: 2rem 0; -} -figcaption { - color: slategrey; -} -code { - background: #eee; - padding: 0.3rem; - tab-size: 4; -} -pre { - background: #eee; -} -pre code { - background: none; - display: block; - overflow-x: auto; - padding: 0.3rem 0.6rem; -} -table { - border-collapse: collapse; - margin: 2rem 0; - text-align: left; - width: 100%; -} -tr { - border-bottom: 1px solid lightgrey; -} -tr:nth-of-type(odd) td { - background-color: #f8f8f8; -} -th,td { - padding: 6px; -} -footer { - border-top: 1px dashed grey; - margin: 2rem 0; - padding: 1rem 15px; -} diff --git a/build/pages.tsv b/build/pages.tsv new file mode 100644 index 0000000..e69de29 diff --git a/build/posts.tsv b/build/posts.tsv new file mode 100644 index 0000000..e69de29 diff --git a/build/rss.xml b/build/rss.xml deleted file mode 100644 index 76dbb16..0000000 --- a/build/rss.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - adamski's arena - https://arena.adast.dk/rss.xml - Updates to the arena project - en-us - - - -arena: Quake-like multiplayer shooter -https://arena.adast.dk -https://arena.adast.dk -Tue, 27 Sep 2022 21:15:11 +0200 -Aftershock (working title) is a multiplayer old-school arena shooter being made in Unity. It’s a hobby project that I have been working on since 2016. It started as a warmup project before jumping into developing an MMO, but I have since learned how much work goes into making just a multiplayer fps. Especially as a solo project.

- -

At it’s core, Aftershock is supposed to be my attempt at recreating a mix of Quake 3 / Quake Live along with whatever else I decide to add.

- -

Main features (so far):

- -
    -
  • p2p multiplayer
  • -
  • support for custom maps
  • -
  • vq3-like movement
  • -
  • rocket launcher + rocket jumping
  • -
  • health pickups
  • -
  • 3 gamemodes (FFA, TDM, Race)
  • -
- -

I’m in the process of rewriting a lot of systems in the game at the moment because I’m switching from janky p2p multiplayer to an authoritative server setup with client-side prediction (more).

- -

➤ Gameplay clips
-➤ Follow my progress

-]]>
-
- - -
-
diff --git a/build/sitemap.xml b/build/sitemap.xml deleted file mode 100644 index c536f0a..0000000 --- a/build/sitemap.xml +++ /dev/null @@ -1,8 +0,0 @@ - - -https://arena.adast.dk/index.html2023-05-221.0 - diff --git a/footer.html b/footer.html new file mode 100644 index 0000000..fcc9ba3 --- /dev/null +++ b/footer.html @@ -0,0 +1,16 @@ + diff --git a/header.html b/header.html new file mode 100644 index 0000000..06e37e1 --- /dev/null +++ b/header.html @@ -0,0 +1,16 @@ + + + + + + + {{TITLE}} + + + + + + +
diff --git a/index.md b/index.md new file mode 100644 index 0000000..97ad06a --- /dev/null +++ b/index.md @@ -0,0 +1,33 @@ +# arena: Quake-like multiplayer shooter + +> **arena** is currently on hiatus. I am hoping to do a +> complete open-source rewrite using the [Godot game +> engine](https://godotengine.org).
+> ~ *2023-12-17* + +**arena** (working title) is a multiplayer old-school arena shooter being made +by me, [Adam Stück](https://adast.dk), with the Unity game engine. It's a hobby +project that I have been working on since 2016. It started as a *warmup* +project before jumping into developing an MMO, but I have since learned how +much work goes into making just a multiplayer fps. Especially as a solo +project. + +At it's core, **arena** is supposed to be my attempt at recreating a mix of +Quake 3 / Quake Live along with whatever else I decide to add. + +Main features (so far): + +- p2p multiplayer +- support for custom maps +- vq3-like movement +- rocket launcher + rocket jumping +- health pickups +- 3 gamemodes (FFA, TDM, Race) + +I'm in the process of rewriting a lot of systems in the game at the moment +because I'm switching from janky p2p multiplayer to an authoritative server +setup with client-side prediction +[(more)](https://www.gabrielgambetta.com/client-server-game-architecture.html). + +* [Gameplay clips](https://tv.adast.dk/c/arena/videos) +* [Follow my progress](https://trello.com/b/ycQyrouQ) diff --git a/src/_footer.html b/src/_footer.html deleted file mode 100644 index 7408831..0000000 --- a/src/_footer.html +++ /dev/null @@ -1,11 +0,0 @@ - -
- - diff --git a/src/_header.html b/src/_header.html deleted file mode 100644 index f45e37a..0000000 --- a/src/_header.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - -
- -
diff --git a/src/favicon.ico b/src/favicon.ico deleted file mode 100644 index d537e87..0000000 Binary files a/src/favicon.ico and /dev/null differ diff --git a/src/index.md b/src/index.md deleted file mode 100644 index a60a462..0000000 --- a/src/index.md +++ /dev/null @@ -1,29 +0,0 @@ -# arena: Quake-like multiplayer shooter - -2021-05-07 - -> TODO: Update post! - -Aftershock (working title) is a multiplayer old-school arena shooter being made in Unity. It's a hobby project that I have been working on since 2016. It started as a *warmup* project before jumping into developing an MMO, but I have since learned how much work goes into making just a multiplayer fps. Especially as a solo project. - -At it's core, Aftershock is supposed to be my attempt at recreating a mix of Quake 3 / Quake Live along with whatever else I decide to add. - -Main features (so far): - -- p2p multiplayer -- support for custom maps -- vq3-like movement -- rocket launcher + rocket jumping -- health pickups -- 3 gamemodes (FFA, TDM, Race) - -I'm in the process of rewriting a lot of systems in the game at the moment because I'm switching from janky p2p multiplayer to an authoritative server setup with client-side prediction [(more)](https://www.gabrielgambetta.com/client-server-game-architecture.html). - -➤ [Gameplay clips](https://tv.adast.dk/c/arena/videos) -➤ [Follow my progress](https://trello.com/b/ycQyrouQ) - -
- -Have a comment on one of my posts? Start a discussion in [my public inbox](https://lists.sr.ht/~adamski/public-inbox) by -sending an email to [~adamski/public-inbox@lists.sr.ht](mailto:~adamski/public-inbox@lists.sr.ht) [[mailing list -etiquette](https://man.sr.ht/lists.sr.ht/etiquette.md)] diff --git a/src/main.css b/src/main.css deleted file mode 100644 index 4d89bb6..0000000 --- a/src/main.css +++ /dev/null @@ -1,90 +0,0 @@ -* { - box-sizing: border-box; -} -body { - font-family: sans-serif; - line-height: 1.45; - margin: 0 auto; - max-width: 45rem; - padding: 0 15px; -} -hr { - background-color: grey; - border: 0; - height: 1px; - margin: 2rem 0; -} -nav { - margin: 2rem 0 0; -} -main p { - margin: 1rem; -} -h1,h2,h3,h4 { - margin: 2rem 0 0; -} -h1 { - margin-bottom: 0.5rem; -} -h1 + p { - margin: 0 0 1rem; -} -span.created { - display: block; - margin: 4px 15px; -} -img { - border: 1px solid lightgrey; - height: auto; - max-width: 100%; - width: auto; -} -blockquote { - background-color: linen; - border-left: 4px solid lightcoral; - margin: 2rem 0; - padding: 10px; -} -blockquote p { - margin: 0; -} -figure { - margin: 2rem 0; -} -figcaption { - color: slategrey; -} -code { - background: #eee; - padding: 0.3rem; - tab-size: 4; -} -pre { - background: #eee; -} -pre code { - background: none; - display: block; - overflow-x: auto; - padding: 0.3rem 0.6rem; -} -table { - border-collapse: collapse; - margin: 2rem 0; - text-align: left; - width: 100%; -} -tr { - border-bottom: 1px solid lightgrey; -} -tr:nth-of-type(odd) td { - background-color: #f8f8f8; -} -th,td { - padding: 6px; -} -footer { - border-top: 1px dashed grey; - margin: 2rem 0; - padding: 1rem 15px; -} diff --git a/src/rss.xml b/src/rss.xml deleted file mode 100644 index 76dbb16..0000000 --- a/src/rss.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - adamski's arena - https://arena.adast.dk/rss.xml - Updates to the arena project - en-us - - - -arena: Quake-like multiplayer shooter -https://arena.adast.dk -https://arena.adast.dk -Tue, 27 Sep 2022 21:15:11 +0200 -Aftershock (working title) is a multiplayer old-school arena shooter being made in Unity. It’s a hobby project that I have been working on since 2016. It started as a warmup project before jumping into developing an MMO, but I have since learned how much work goes into making just a multiplayer fps. Especially as a solo project.

- -

At it’s core, Aftershock is supposed to be my attempt at recreating a mix of Quake 3 / Quake Live along with whatever else I decide to add.

- -

Main features (so far):

- -
    -
  • p2p multiplayer
  • -
  • support for custom maps
  • -
  • vq3-like movement
  • -
  • rocket launcher + rocket jumping
  • -
  • health pickups
  • -
  • 3 gamemodes (FFA, TDM, Race)
  • -
- -

I’m in the process of rewriting a lot of systems in the game at the moment because I’m switching from janky p2p multiplayer to an authoritative server setup with client-side prediction (more).

- -

➤ Gameplay clips
-➤ Follow my progress

-]]>
-
- - -
-
diff --git a/ssg b/ssg deleted file mode 100755 index d6c833c..0000000 --- a/ssg +++ /dev/null @@ -1,243 +0,0 @@ -#!/bin/sh -e -# -# https://rgz.ee/bin/ssg6 -# Copyright 2018-2019 Roman Zolotarev -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -# - -main() { - test -n "$1" || usage - test -n "$2" || usage - test -n "$3" || usage - test -n "$4" || usage - test -d "$1" || no_dir "$1" - test -d "$2" || no_dir "$2" - - src=$(readlink_f "$1") - dst=$(readlink_f "$2") - - IGNORE=$( - if ! test -f "$src/.ssgignore"; then - printf ' ! -path "*/.*"' - return - fi - while read -r x; do - test -n "$x" || continue - printf ' ! -path "*/%s*"' "$x" - done <"$src/.ssgignore" - ) - - # files - - title="$3" - - h_file="$src/_header.html" - f_file="$src/_footer.html" - test -f "$f_file" && FOOTER=$(cat "$f_file") && export FOOTER - test -f "$h_file" && HEADER=$(cat "$h_file") && export HEADER - - list_dirs "$src" | - (cd "$src" && cpio -pdu "$dst") - - fs=$( - if test -f "$dst/.files"; then - list_affected_files "$src" "$dst/.files" - else - list_files "$1" - fi - ) - - if test -n "$fs"; then - echo "$fs" | tee "$dst/.files" - - if echo "$fs" | grep -q '\.md$'; then - if test -x "$(which lowdown 2>/dev/null)"; then - echo "$fs" | grep '\.md$' | - render_md_files_lowdown "$src" "$dst" "$title" - else - if test -x "$(which Markdown.pl 2>/dev/null)"; then - echo "$fs" | grep '\.md$' | - render_md_files_Markdown_pl "$src" "$dst" "$title" - else - echo "couldn't find lowdown nor Markdown.pl" - exit 3 - fi - fi - fi - - echo "$fs" | grep '\.html$' | - render_html_files "$src" "$dst" "$title" - - echo "$fs" | grep -Ev '\.md$|\.html$' | - (cd "$src" && cpio -pu "$dst") - fi - - printf '[ssg] ' >&2 - print_status 'file, ' 'files, ' "$fs" >&2 - - # sitemap - - base_url="$4" - date=$(date +%Y-%m-%d) - urls=$(list_pages "$src") - - test -n "$urls" && - render_sitemap "$urls" "$base_url" "$date" >"$dst/sitemap.xml" - - print_status 'url' 'urls' "$urls" >&2 - echo >&2 -} - -readlink_f() { - file="$1" - cd "$(dirname "$file")" - file=$(basename "$file") - while test -L "$file"; do - file=$(readlink "$file") - cd "$(dirname "$file")" - file=$(basename "$file") - done - dir=$(pwd -P) - echo "$dir/$file" -} - -print_status() { - test -z "$3" && printf 'no %s' "$2" && return - - echo "$3" | awk -v singular="$1" -v plural="$2" ' - END { - if (NR==1) printf NR " " singular - if (NR>1) printf NR " " plural - }' -} - -usage() { - echo "usage: ${0##*/} src dst title base_url" >&2 - exit 1 -} - -no_dir() { - echo "${0##*/}: $1: No such directory" >&2 - exit 2 -} - -list_dirs() { - cd "$1" && eval "find . -type d ! -name '.' ! -path '*/_*' $IGNORE" -} - -list_files() { - cd "$1" && eval "find . -type f ! -name '.' ! -path '*/_*' $IGNORE" -} - -list_dependant_files() { - e="\\( -name '*.html' -o -name '*.md' -o -name '*.css' -o -name '*.js' \\)" - cd "$1" && eval "find . -type f ! -name '.' ! -path '*/_*' $IGNORE $e" -} - -list_newer_files() { - cd "$1" && eval "find . -type f ! -name '.' $IGNORE -newer $2" -} - -has_partials() { - grep -qE '^./_.*\.html$|^./_.*\.js$|^./_.*\.css$' -} - -list_affected_files() { - fs=$(list_newer_files "$1" "$2") - - if echo "$fs" | has_partials; then - list_dependant_files "$1" - else - echo "$fs" - fi -} - -render_html_files() { - while read -r f; do - render_html_file "$3" <"$1/$f" >"$2/$f" - done -} - -render_md_files_lowdown() { - while read -r f; do - lowdown \ - --html-no-escapehtml \ - --html-no-skiphtml \ - --parse-no-metadata \ - --parse-no-autolink <"$1/$f" | - render_html_file "$3" \ - >"$2/${f%\.md}.html" - done -} - -render_md_files_Markdown_pl() { - while read -r f; do - Markdown.pl <"$1/$f" | - render_html_file "$3" \ - >"$2/${f%\.md}.html" - done -} - -render_html_file() { - # h/t Devin Teske - awk -v title="$1" ' - { body = body "\n" $0 } - END { - body = substr(body, 2) - if (body ~ /<\/?[Hh][Tt][Mm][Ll]/) { - print body - exit - } - if (match(body, /<[[:space:]]*[Hh]1(>|[[:space:]][^>]*>)/)) { - t = substr(body, RSTART + RLENGTH) - sub("<[[:space:]]*/[[:space:]]*[Hh]1.*", "", t) - gsub(/^[[:space:]]*|[[:space:]]$/, "", t) - if (t) title = t - } - n = split(ENVIRON["HEADER"], header, /\n/) - for (i = 1; i <= n; i++) { - if (match(tolower(header[i]), "")) { - head = substr(header[i], 1, RSTART - 1) - tail = substr(header[i], RSTART + RLENGTH) - print head "" title "" tail - } else print header[i] - } - print body - print ENVIRON["FOOTER"] - }' -} - -list_pages() { - e="\\( -name '*.html' -o -name '*.md' \\)" - cd "$1" && eval "find . -type f ! -path '*/.*' ! -path '*/_*' $IGNORE $e" | - sed 's#^./##;s#.md$#.html#;s#/index.html$#/#' -} - -render_sitemap() { - urls="$1" - base_url="$2" - date="$3" - - echo '' - echo '' - echo "$urls" | - sed -E 's#^(.*)$#'"$base_url"'/\1'"$date"'1.0#' - echo '' -} - -main "$@" -- cgit v1.2.3-70-g09d2