From c9f22bdc3d740ae6f66b5d1db8fa9807a662779b Mon Sep 17 00:00:00 2001 From: Atlas Cove <5618106+Atlas48@users.noreply.github.com> Date: Tue, 7 Feb 2023 04:00:03 +0000 Subject: [PATCH] work for the night. --- Makefile | 2 +- push.sh | 7 ------- render.sh | 33 +++++++++++++++++---------------- titlelookup.rs | 9 --------- titles.sh | 4 ++++ titles.tsv | 2 ++ 6 files changed, 24 insertions(+), 33 deletions(-) delete mode 100755 push.sh delete mode 100644 titlelookup.rs create mode 100644 titles.sh create mode 100644 titles.tsv diff --git a/Makefile b/Makefile index ff2ddec..a38b41b 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ list-dir: @echo "=====DIRECTORIES======" find . -wholename './.hg' -prune , -type d -not -name .hg clean: - rm -r out + rm -rf out build: ./render.sh push: build diff --git a/push.sh b/push.sh deleted file mode 100755 index feb2818..0000000 --- a/push.sh +++ /dev/null @@ -1,7 +0,0 @@ -declare -a excl -#while read i; do -# excl+=($i) -#done < tapeignore.txt -#unset i -cd ../.. -rclone sync neo:/ ./ diff --git a/render.sh b/render.sh index b658ed4..c7e4651 100755 --- a/render.sh +++ b/render.sh @@ -1,20 +1,21 @@ #!/bin/bash # render.sh: part of the tape-and-string framework. -# v2.1 -declare -A prog -prog[m4]=`readlink -f main.html.m4` -prog[lib]=`readlink -f lib.m4` -prog[title]=`readlink -f titlelookup` -function inf { echo -e "\x1B[1;32mINF\x1B[0m: $@"; } -function wrn { echo -e "\x1B[1;93mWRN\x1B[0m: $@"; } -function err { echo -e "\x1B[1;31mERR\x1B[0m: $@"; } +# v3.0 +. titles.sh +function inf { echo -e "\x1B[1;32mINF\x1B[0m: $*"; } +function wrn { echo -e "\x1B[1;93mWRN\x1B[0m: $*"; } +function err { echo -e "\x1B[1;31mERR\x1B[0m: $*"; } function tape { + if test -d "$1"; then + err "tape: Passed directory, $1" + return 1 + fi case $1 in - *.txti) redcloth $1 ;; - *.org) org-ruby --translate html $1 ;; - *.md) comrak --gfm $1 ;; + *.txti) redcloth "$1" ;; + *.org) org-ruby --translate html "$1" ;; + *.md) comrak --gfm "$1" ;; *.html) cat $1 ;; - *) pandoc --columns 168 -t html $i || echo "Skipping $i, unknown format" ;; + *) pandoc --columns 168 -t html "$1" || echo "Skipping $i, unknown format" ;; esac } function yn { @@ -29,10 +30,10 @@ function yn { esac done } -doc=(`find . -wholename './.hg' -prune , -type f -name '*.txti' , -name '*.org' , -name '*.md'`) +doc=(`find . -wholename './.hg' -prune , -type f -name '*.txti' -o -name '*.org' -o -name '*.md'`) sass=(`find . -wholename './.hg' -prune , -type f -name '*.sass'`) scss=(`find . -wholename './.hg' -prune , -type f -name '*.scss'`) -rest=(`find . -wholename './.hg' -prune , -type f ! \( -name '*.org' , -name '*.txti' , -name '*.md' , -name .hg \)`) +rest=(`find . -wholename './.hg' -prune , -type f ! \( -name '*.org' -o -name '*.txti' -o -name '*.md' -o -name .hg \)`) dir=(`find . -wholename './.hg' -prune , -type d -not -name .hg`) inf "Creating directory structure..." @@ -41,9 +42,9 @@ for i in ${dir[@]}; do mkdir -p out/$i done inf "Rendering document files..." -for i in ${dir[@]}; do +for i in ${doc[@]}; do echo $i - tape $i | m4 -DTITLE=${title[$i]} main.html.m4 + tape $i | m4 -DTITLE="${title[$i]}" main.html.m4 > out/${i%.*}.html done inf "Rendering sass files..." if test -z "${sass[@]}"; then diff --git a/titlelookup.rs b/titlelookup.rs deleted file mode 100644 index 8e65195..0000000 --- a/titlelookup.rs +++ /dev/null @@ -1,9 +0,0 @@ -use std::env::args; -fn main() { - let l:String = args().next().unwrap(); - match l.as_str() { - "not_found.txti" => println!("404 - Page Not Found"), - "index.txti" => println!("Atlas48's Archives"), - _ => println!("Atlas48's Archives"), - } -} \ No newline at end of file diff --git a/titles.sh b/titles.sh new file mode 100644 index 0000000..99c9460 --- /dev/null +++ b/titles.sh @@ -0,0 +1,4 @@ +declare -A titles +titles["not_found.txti"]="404 - Page Not Found" +titles["index.txti"]="Atlas48's Archives" + diff --git a/titles.tsv b/titles.tsv new file mode 100644 index 0000000..095a29c --- /dev/null +++ b/titles.tsv @@ -0,0 +1,2 @@ +index.txti Atlas48's Archives +not_found.html 404 - Page Not Found