diff options
author | Case Duckworth | 2015-04-14 16:36:17 -0700 |
---|---|---|
committer | Case Duckworth | 2015-04-14 16:36:17 -0700 |
commit | 9fce418b46c9f0894f429384ef9e3dabaeffbeb4 (patch) | |
tree | b2339220ee50cf48b8887f0cc1fed4813a95901b /trunk/backlink.sh | |
parent | Add toc metadata (diff) | |
download | autocento-9fce418b46c9f0894f429384ef9e3dabaeffbeb4.tar.gz autocento-9fce418b46c9f0894f429384ef9e3dabaeffbeb4.zip |
Change file hierarchy and rewrite makefile
- File hierarchy is now as follows: - / - appendix/ < appendix source files - backlinks/ < backlink sources & builds - hapax/ < *.hapax source files - scripts/ < scripts, like *.js, *.hs, etc. - templates/ < templates for outputs - text/ < source files - trunk/ < assets, like css, images, heads, etc. - index.html - *.html - Makefile
Diffstat (limited to 'trunk/backlink.sh')
-rw-r--r-- | trunk/backlink.sh | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/trunk/backlink.sh b/trunk/backlink.sh deleted file mode 100644 index f6feb7d..0000000 --- a/trunk/backlink.sh +++ /dev/null | |||
@@ -1,38 +0,0 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | # Command-line variables | ||
4 | searchQuery="$1"; # .html file to backlink | ||
5 | outFile="$2"; # .back file to create | ||
6 | headerFile="$3"; # header information file | ||
7 | shift 3; | ||
8 | glob="$@"; # where to search for backlinks | ||
9 | |||
10 | # Find backlinkers | ||
11 | echo -n "Back-linking \"$searchQuery\"" | ||
12 | cat "$headerFile" > "$outFile"; | ||
13 | if ! grep -ql "$searchQuery" $glob >> "$outFile"; then | ||
14 | echo "[_island_](${islandLink}.htm)." >> "$outFile"; | ||
15 | title=`grep '^title:' "${searchQuery%.html}.txt" | cut -d' ' -f2-`; | ||
16 | echo "- [$title]($searchQuery)" >> "${islandLink}.txt" | ||
17 | fi | ||
18 | |||
19 | # Change title & id of $outFile | ||
20 | inText="`basename $searchQuery .html`.txt"; | ||
21 | title=`grep '^title:' "$inText" | cut -d' ' -f2-`; | ||
22 | id=`grep '^id:' "${searchQuery%.html}.txt" | cut -d' ' -f2`; | ||
23 | sed -i "s/_TITLE_/$title/" "$outFile"; | ||
24 | sed -i "s/_ID_/$id/" "$outFile"; | ||
25 | echo -n "." | ||
26 | |||
27 | # Change *.txt to *.html | ||
28 | sed -i 's/^\(.*\)\.txt/\1.html/g' "$outFile"; | ||
29 | |||
30 | # Link to backlinks | ||
31 | for file in `grep '.html$' "$outFile"`; do | ||
32 | fText="`basename $file .html`.txt"; | ||
33 | title=`grep '^title:' $fText | cut -d' ' -f2-`; | ||
34 | sed -i "s/^$file$/- [$title](&)/" "$outFile"; | ||
35 | echo -n "." | ||
36 | done | ||
37 | |||
38 | echo "Done." | ||