site
my personal website
git clone https://jhhm.no/repos/site.git
site/bin/make
get raw file: make
1#!/bin/sh -eu 2 3. ./config 4 5title() { 6 [ -z "$1" ] && echo "$TITLE" && return 7 echo "${1##*/} - $TITLE" 8} 9 10mkdir -p "$DIR_BUILD" 11 12echo ">> Building content" 13 14find "$DIR_CONTENT" -type f -name "*.$EXT_WRITINGS" | while read -r file; do 15 base=${file#"$DIR_CONTENT"/} 16 name=${base%."$EXT_WRITINGS"} 17 18 case "$name" in 19 index) name="" ;; 20 */index) name=${name%/index} ;; 21 esac 22 23 outdir="$DIR_BUILD${name:+/$name}" 24 output="$outdir/index.html" 25 mkdir -p "$outdir" 26 27 preprocess=cat 28 case "$name" in 29 *"${DIR_WRITINGS##*/}"*) name="$(sed -n '1s/^; //p' "$file")" 30 preprocess=prewriting ;; 31 esac 32 echo " $output" 33 "$preprocess" < "$file" | echo "<article class=\"writing\">$(markup)</article>" | makepage "$(title "$name")" > "$output" 34done 35 36echo ">> Generating writings indexes" 37 38mkdir -p "$DIR_WRITINGS_DST" 39echo " $DIR_WRITINGS_DST/index.html" 40makewritindex | makepage "$(title writings)" > "$DIR_WRITINGS_DST/index.html" 41 42for c in $(categories "$DIR_WRITINGS"/*/index."$EXT_WRITINGS"); do 43 mkdir -p "$DIR_WRITINGS_DST/$c" 44 echo " $DIR_WRITINGS_DST/$c/index.html" 45 makewritindex "$c" | makepage "$(title "#$c")" > "$DIR_WRITINGS_DST/$c/index.html" 46done 47 48echo ">> Generating atom feed" 49echo " $WRITINGS_FEED_DST" 50makeatom > "$WRITINGS_FEED_DST" 51 52echo ">> Copying static content" 53cp -rv "$DIR_STATIC"/* "$DIR_BUILD" | sed -E "s/.*-> '(.*)'/ \1/" 54 55echo ">> Copying content images" 56dups=$(find "$DIR_CONTENT" -type f ! -name "*.$EXT_WRITINGS" | sed 's|.*/||' | sort | uniq -d) 57if [ -n "$dups" ]; then 58 echo "error: duplicate image names in $DIR_CONTENT:" $dups >&2 59 exit 1 60fi 61mkdir -p "$DIR_IMG_DST" 62find "$DIR_CONTENT" -type f ! -name "*.$EXT_WRITINGS" -exec cp -v {} "$DIR_IMG_DST" \; | sed -E "s/.*-> '(.*)'/ \1/" 63 64gitrepo() { 65 dest="$DIR_BUILD/repos/$2" 66 makegitrepo "$1" "$dest" "$3" 67 echo " $dest" 68} 69 70echo ">> Generating git repos" 71gitrepo ../dedit dedit "a tool for Teeworlds demo file shenanigens" 72gitrepo ../site site "my personal website" 73gitrepo ../lol-cal lol-cal "terminal lolesports schedule viewer" 74gitrepo ../tweed tweed "a Twitch RSS feed generator" 75 76echo ">> Copying licenses" 77cp "LICENSES/AGPL-3.0.txt" "$DIR_BUILD/" 78cp "LICENSES/CC-BY-SA-4.0.txt" "$DIR_BUILD/"