From 529ede146afd125c76d86eb55969983af8ee21db Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sat, 4 Apr 2015 23:58:22 -0700 Subject: Some revision & TOC inclusion --- trunk/toc.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 trunk/toc.sh (limited to 'trunk/toc.sh') diff --git a/trunk/toc.sh b/trunk/toc.sh new file mode 100644 index 0000000..fe440cb --- /dev/null +++ b/trunk/toc.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +outFile="$1"; +shift 1; +glob="$@"; + +echo -n "Compiling $outFile" + +for file in $glob; do + title=$(grep '^title: ' $file | cut -d' ' -f2-); + subtitle=$(grep '^subtitle: ' $file | cut -d' ' -f2-); + htmlFile="${file%.txt}.html" + # if [[ "$title" == "Autocento of the breakfast table" ]]; then + # echo "#. [$subtitle]($htmlFile)" >> "$outFile"; + # else + # echo "#. [$title]($htmlFile)" >> "$outFile"; + # fi + if [[ -n "$subtitle" ]]; then + echo "#. [$title: $subtitle]($htmlFile)" >> "$outFile" + else + echo "#. [$title]($htmlFile)" >> "$outFile"; + fi + echo -n "." +done + +echo "Done." -- cgit 1.4.1-21-gabe81