about summary refs log tree commit diff stats
path: root/trunk/backlink.sh
diff options
context:
space:
mode:
authorCase Duckworth2015-04-14 16:36:17 -0700
committerCase Duckworth2015-04-14 16:36:17 -0700
commit9fce418b46c9f0894f429384ef9e3dabaeffbeb4 (patch)
treeb2339220ee50cf48b8887f0cc1fed4813a95901b /trunk/backlink.sh
parentAdd toc metadata (diff)
downloadautocento-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.sh38
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
4searchQuery="$1"; # .html file to backlink
5outFile="$2"; # .back file to create
6headerFile="$3"; # header information file
7shift 3;
8glob="$@"; # where to search for backlinks
9
10# Find backlinkers
11echo -n "Back-linking \"$searchQuery\""
12cat "$headerFile" > "$outFile";
13if ! 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"
17fi
18
19# Change title & id of $outFile
20inText="`basename $searchQuery .html`.txt";
21title=`grep '^title:' "$inText" | cut -d' ' -f2-`;
22id=`grep '^id:' "${searchQuery%.html}.txt" | cut -d' ' -f2`;
23sed -i "s/_TITLE_/$title/" "$outFile";
24sed -i "s/_ID_/$id/" "$outFile";
25echo -n "."
26
27# Change *.txt to *.html
28sed -i 's/^\(.*\)\.txt/\1.html/g' "$outFile";
29
30# Link to backlinks
31for 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 "."
36done
37
38echo "Done."