diff options
Diffstat (limited to 'trunk/toc.sh')
-rw-r--r-- | trunk/toc.sh | 26 |
1 files changed, 26 insertions, 0 deletions
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 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | outFile="$1"; | ||
4 | shift 1; | ||
5 | glob="$@"; | ||
6 | |||
7 | echo -n "Compiling $outFile" | ||
8 | |||
9 | for file in $glob; do | ||
10 | title=$(grep '^title: ' $file | cut -d' ' -f2-); | ||
11 | subtitle=$(grep '^subtitle: ' $file | cut -d' ' -f2-); | ||
12 | htmlFile="${file%.txt}.html" | ||
13 | # if [[ "$title" == "Autocento of the breakfast table" ]]; then | ||
14 | # echo "#. [$subtitle]($htmlFile)" >> "$outFile"; | ||
15 | # else | ||
16 | # echo "#. [$title]($htmlFile)" >> "$outFile"; | ||
17 | # fi | ||
18 | if [[ -n "$subtitle" ]]; then | ||
19 | echo "#. [$title: $subtitle]($htmlFile)" >> "$outFile" | ||
20 | else | ||
21 | echo "#. [$title]($htmlFile)" >> "$outFile"; | ||
22 | fi | ||
23 | echo -n "." | ||
24 | done | ||
25 | |||
26 | echo "Done." | ||