diff options
author | Case Duckworth | 2015-04-14 18:09:55 -0700 |
---|---|---|
committer | Case Duckworth | 2015-04-14 18:09:55 -0700 |
commit | 08fd8e95dccb91d0495a50d1009f85cb80cfad65 (patch) | |
tree | 9accf8a6e9b1f836e3c7c7b5437d11351545a07e /scripts/compile.sh | |
parent | Change file hierarchy and rewrite makefile (diff) | |
download | autocento-08fd8e95dccb91d0495a50d1009f85cb80cfad65.tar.gz autocento-08fd8e95dccb91d0495a50d1009f85cb80cfad65.zip |
First compile in v1.0.0 v1.0.0
Diffstat (limited to 'scripts/compile.sh')
-rw-r--r-- | scripts/compile.sh | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/scripts/compile.sh b/scripts/compile.sh index 5478410..ba89f5a 100644 --- a/scripts/compile.sh +++ b/scripts/compile.sh | |||
@@ -31,7 +31,7 @@ case "$FILE" in | |||
31 | *.back) # backlinks: compile.sh a.back a.txt #{{{ | 31 | *.back) # backlinks: compile.sh a.back a.txt #{{{ |
32 | found=( $(backLinksOf "$(basename ${FILE%.*}).html" ${1%/*}/*.${1##*.}) ); | 32 | found=( $(backLinksOf "$(basename ${FILE%.*}).html" ${1%/*}/*.${1##*.}) ); |
33 | if [[ $? -ne 0 ]]; then | 33 | if [[ $? -ne 0 ]]; then |
34 | echo "__ISLAND__"; exit; | 34 | echo "[_island._](../islands.html) <!--__ISLAND__-->"; exit; |
35 | fi | 35 | fi |
36 | for f in "${found[@]}"; do | 36 | for f in "${found[@]}"; do |
37 | echo -n "- [$(getMeta title "$f")](../$(basename ${f%.*}).html)"; | 37 | echo -n "- [$(getMeta title "$f")](../$(basename ${f%.*}).html)"; |
@@ -45,40 +45,40 @@ case "$FILE" in | |||
45 | echo "- [$(getMeta title "$f")]($(basename ${f%.*}).html)"; | 45 | echo "- [$(getMeta title "$f")]($(basename ${f%.*}).html)"; |
46 | done | 46 | done |
47 | ;; #}}} | 47 | ;; #}}} |
48 | *hapax*) # hapax: compile.sh hapax.txt *.hapax #{{{ | 48 | *hapax*) # hapax: compile.sh hapax.txt *.hapax #{{{ |
49 | for word in $(sort $FILE); do | 49 | for word in $(sort $FILE); do |
50 | f=$(grep -liwq "^$word$" "$@"); | 50 | f=$(grep -liwq "^$word$" "$@"); |
51 | grep -qv "^[^0-9A-Za-z]" <<< $word && \ | 51 | grep -qv "^[^0-9A-Za-z]" <<< $word && \ |
52 | echo "[$word]($(basename ${f%.*}).html)"; | 52 | echo "[$word]($(basename ${f%.*}).html)"; |
53 | done | 53 | done |
54 | ;; #}}} | 54 | ;; #}}} |
55 | *first-*) # first-lines: compile.sh first-lines.txt *.txt #{{{ | 55 | *first-*) # first-lines: compile.sh first-lines.txt *.txt #{{{ |
56 | for f in "$@"; do | 56 | for f in "$@"; do |
57 | echo "[$(firstLineOf "$f")]($(basename ${f%.*}).html)"; | 57 | echo "[$(firstLineOf "$f")]($(basename ${f%.*}).html)"; |
58 | done | 58 | done |
59 | ;; #}}} | 59 | ;; #}}} |
60 | *common-*) # common-titles: compile.sh common-titles.txt *.txt #{{{ | 60 | *common-*) # common-titles: compile.sh common-titles.txt *.txt #{{{ |
61 | for f in "$@"; do | 61 | for f in "$@"; do |
62 | echo "[$(getMeta title "$f")]($(basename ${f%.*}).html)"; | 62 | echo "[$(getMeta title "$f")]($(basename ${f%.*}).html)"; |
63 | done | 63 | done |
64 | ;; #}}} | 64 | ;; #}}} |
65 | *toc*) # table of contents: compile.sh toc.txt *.txt #{{{ | 65 | *toc*) # table of contents: compile.sh toc.txt *.txt #{{{ |
66 | for f in "$@"; do | 66 | for f in "$@"; do |
67 | echo "#. [$(getMeta toc "$f")]($(basename ${f%.*}).html)" >> $FILE; | 67 | echo "#. [$(getMeta toc "$f")]($(basename ${f%.*}).html)" >> $FILE; |
68 | done | 68 | done |
69 | ;; #}}} | 69 | ;; #}}} |
70 | *random*) # randomize.js: compile.sh randomize.js *.html #{{{ | 70 | *random*) # randomize.js: compile.sh randomize.js *.html #{{{ |
71 | rlist=$(echo "$@" | sed -e 's/\(\S\+.html\) \?/"\1",/g' \ | 71 | rlist=$(echo "$@" | sed -e 's/\(\S\+.html\) \?/"\1",/g' \ |
72 | -e 's/^\(.*\),$/var files=[\1]/') | 72 | -e 's/^\(.*\),$/var files=[\1]/') |
73 | sed -i "s/var files=.*/$rlist/" $FILE; | 73 | sed -i "s/var files=.*/$rlist/" $FILE; |
74 | ;; #}}} | 74 | ;; #}}} |
75 | --fix-head) # fix backlink head: compile.sh --fix-head a.back a.txt #{{{ | 75 | --fix-head) # fix backlink head: compile.sh --fix-head a.back a.txt #{{{ |
76 | title="$(getMeta title "$2")"; | 76 | title="$(getMeta toc "$2")"; |
77 | id="$(getMeta id "$2")"; | 77 | id="$(getMeta id "$2")"; |
78 | sed -i "s/__TITLE__/$title/" "$1"; | 78 | sed -i "s/__TITLE__/$title/" "$1"; |
79 | sed -i "s/__ID__/$id/" "$1"; | 79 | sed -i "s/__ID__/$id/" "$1"; |
80 | ;; #}}} | 80 | ;; #}}} |
81 | *) # bad argument {{{ | 81 | *) # bad argument {{{ |
82 | echo "Bad argument"; | 82 | echo "Bad argument"; |
83 | exit 1; | 83 | exit 1; |
84 | ;; #}}} | 84 | ;; #}}} |