about summary refs log tree commit diff stats
path: root/trunk
diff options
context:
space:
mode:
Diffstat (limited to 'trunk')
-rw-r--r--trunk/backlink.sh17
-rw-r--r--trunk/common-titles.sh7
-rw-r--r--trunk/first-lines.sh5
-rw-r--r--trunk/island.head9
4 files changed, 30 insertions, 8 deletions
diff --git a/trunk/backlink.sh b/trunk/backlink.sh index 7d143a8..15bb11e 100644 --- a/trunk/backlink.sh +++ b/trunk/backlink.sh
@@ -4,13 +4,21 @@
4searchQuery="$1"; # .html file to backlink 4searchQuery="$1"; # .html file to backlink
5outFile="$2"; # .back file to create 5outFile="$2"; # .back file to create
6headerFile="$3"; # header information file 6headerFile="$3"; # header information file
7shift 3; 7islandHead="$4";
8shift 4;
8glob="$@"; # where to search for backlinks 9glob="$@"; # where to search for backlinks
9 10
11islandLink="island"
12[[ ! -f ${islandLink}.txt ]] && cat "$islandHead" > ${islandLink}.txt;
13
10# Find backlinkers 14# Find backlinkers
11echo -n "Back-linking \"$searchQuery\"" 15echo -n "Back-linking \"$searchQuery\""
12cat "$headerFile" > "$outFile"; 16cat "$headerFile" > "$outFile";
13grep -ql "$searchQuery" $glob >> "$outFile"; 17if ! grep -ql "$searchQuery" $glob >> "$outFile"; then
18 echo "[_island_](${islandLink}.htm)." >> "$outFile";
19 title=`grep '^title:' "${searchQuery%.html}.txt" | cut -d' ' -f2-`;
20 echo "- [$title]($searchQuery)" >> "${islandLink}.txt"
21fi
14 22
15# Change title of $outFile 23# Change title of $outFile
16inText="`basename $searchQuery .html`.txt"; 24inText="`basename $searchQuery .html`.txt";
@@ -18,8 +26,11 @@ title=`grep '^title:' "$inText" | cut -d' ' -f2-`;
18sed -i "s/_TITLE_/$title/" "$outFile"; 26sed -i "s/_TITLE_/$title/" "$outFile";
19echo -n "." 27echo -n "."
20 28
29# Change *.txt to *.html
30sed -i 's/^\(.*\)\.txt/\1.html/g' "$outFile";
31
21# Link to backlinks 32# Link to backlinks
22for file in `grep '.html' "$outFile"`; do 33for file in `grep '.html$' "$outFile"`; do
23 fText="`basename $file .html`.txt"; 34 fText="`basename $file .html`.txt";
24 title=`grep '^title:' $fText | cut -d' ' -f2-`; 35 title=`grep '^title:' $fText | cut -d' ' -f2-`;
25 sed -i "s/^$file$/- [$title](&)/" "$outFile"; 36 sed -i "s/^$file$/- [$title](&)/" "$outFile";
diff --git a/trunk/common-titles.sh b/trunk/common-titles.sh index 9bc0de8..df6158d 100644 --- a/trunk/common-titles.sh +++ b/trunk/common-titles.sh
@@ -5,17 +5,18 @@ header="$2";
5shift 2; 5shift 2;
6glob="$@"; 6glob="$@";
7 7
8echo -n "Compiling ${outFile}..."; 8echo -n "Compiling ${outFile}";
9cat "$header" > $outFile; 9cat "$header" > $outFile;
10 10
11for file in $glob; do 11for file in $glob; do
12 # Copy title to $outFile & link 12 # Copy title to $outFile & link
13 title="$(grep '^title:' "$file" | cut -d' ' -f2- | sed 's/"//g')"; 13 title="$(grep '^title:' "$file" | cut -d' ' -f2- | sed 's/"//g')";
14 if (( $RANDOM % 13 == 0 )); then 14 if (( $RANDOM % 13 == 0 )); then
15 echo -n "| "; 15 echo -n "| " >> "$outFile";
16 else 16 else
17 echo -n " "; 17 echo -n " " >> "$outFile";
18 fi 18 fi
19 echo "[$title](${file%.*}.html)" >> "$outFile"; 19 echo "[$title](${file%.*}.html)" >> "$outFile";
20 echo -n ".";
20done 21done
21echo "Done."; 22echo "Done.";
diff --git a/trunk/first-lines.sh b/trunk/first-lines.sh index 37b7291..fb06026 100644 --- a/trunk/first-lines.sh +++ b/trunk/first-lines.sh
@@ -17,11 +17,12 @@ firstLineOf() { # $1 = file
17 echo "$try" 17 echo "$try"
18} 18}
19 19
20echo -n "Compiling ${outFile}..." 20echo -n "Compiling ${outFile}"
21cat "$header" > $outFile 21cat "$header" > $outFile
22 22
23for file in $glob; do 23for file in $glob; do
24 # Copy first line to $outFile & link 24 # Copy first line to $outFile & link
25 echo "[$(firstLineOf "$file")](${file%.*}.html)" >> $outFile 25 echo "[$(firstLineOf "$file")](${file%.*}.html)" >> $outFile;
26 echo -n ".";
26done 27done
27echo "Done." 28echo "Done."
diff --git a/trunk/island.head b/trunk/island.head new file mode 100644 index 0000000..1a9b454 --- /dev/null +++ b/trunk/island.head
@@ -0,0 +1,9 @@
1---
2title: Islands
3genre: list
4
5project:
6 title: About autocento
7 class: meta
8...
9