Compare commits
No commits in common. "2a8437d7a70127134e159fb9527b2b2ddd5dcc40" and "6b49f03e022fac4ee4cb784c2b556e7883404d83" have entirely different histories.
2a8437d7a7
...
6b49f03e02
47
rivet.sh
Executable file → Normal file
47
rivet.sh
Executable file → Normal file
@ -201,37 +201,13 @@ if ! [ "$SKIP_META" ]; then
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# For every file named "index.html", prepare index file list
|
# Prepare index file list
|
||||||
if ! [ "$SKIP_LIST" ]; then
|
if ! [ "$SKIP_LIST" ]; then
|
||||||
lobjlist=$(mktemp)
|
|
||||||
lobjdate=$(mktemp)
|
|
||||||
llinklist=$(mktemp)
|
|
||||||
for indexf in $(find "$destdir" -type f -iname "index.html"); do
|
|
||||||
outdir=$(echo $(dirname "$indexf") | sed "s/$destdir//g")
|
|
||||||
|
|
||||||
# Generate an ordered (by open time) list of files in the subdirectory by filtering the global list
|
|
||||||
grep "$outdir" "$objlist" > "$lobjlist"
|
|
||||||
sed -e "s,^\/*[^\/]*\/,$destdir/," "$lobjlist" > "$tmpsed"
|
|
||||||
rm -f "$lobjdate"
|
|
||||||
while IFS="" read -r file; do
|
|
||||||
stat -c '%y' "$file" >> "$lobjdate"
|
|
||||||
done < "$lobjlist"
|
|
||||||
mv "$tmpsed" "$lobjlist"
|
|
||||||
|
|
||||||
grep "$outdir" "$linklist" > "$llinklist"
|
|
||||||
|
|
||||||
# Modify "Pages" header to show the current section
|
|
||||||
if [ "$indexf" = "$destdir/index.html" ]; then
|
|
||||||
llinksec=$linksec
|
|
||||||
else
|
|
||||||
llinksec="$linksec in $title"
|
|
||||||
fi
|
|
||||||
|
|
||||||
tmpfile="$(mktemp)"
|
tmpfile="$(mktemp)"
|
||||||
rm -f "$tmpfile"
|
rm -f "$tmpfile"
|
||||||
cat << EOF >> "$tmpfile"
|
cat << EOF >> "$tmpfile"
|
||||||
<div id="map">
|
<div id="map">
|
||||||
<h2 id="Pages">$llinksec</h2>
|
<h2 id="Pages">$linksec</h2>
|
||||||
EOF
|
EOF
|
||||||
count='0'
|
count='0'
|
||||||
while IFS="" read -r line; do
|
while IFS="" read -r line; do
|
||||||
@ -239,23 +215,22 @@ EOF
|
|||||||
if echo "$line" | grep -q 'index\.html'; then
|
if echo "$line" | grep -q 'index\.html'; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
tfile="$(awk "NR==$count" "$lobjlist")"
|
tfile="$(awk "NR==$count" "$objlist")"
|
||||||
title="$(sed -E -n 's/.*<title>\s*(.+)\s*<\/title>.*/\1/p' "$tfile")"
|
title="$(sed -E -n 's/.*<title>\s*(.+)\s*<\/title>.*/\1/p' "$tfile")"
|
||||||
if [ -z "$title" ]; then
|
if [ -z "$title" ]; then
|
||||||
title="${tfile##*/}"
|
title="${tfile##*/}"
|
||||||
fi
|
fi
|
||||||
ldate="$(awk "NR==$count" "$lobjdate" | sed 's/\s.*$//')"
|
ldate="$(awk "NR==$count" "$objdate" | sed 's/\s.*$//')"
|
||||||
printf "<p><a href=\"%s\">%s - %s</a></p>\n" "$line" "$ldate" "$title" >> "$tmpfile"
|
printf "<p><a href=\"%s\">%s - %s</a></p>\n" "$line" "$ldate" "$title" >> "$tmpfile"
|
||||||
done < "$llinklist"
|
done < "$linklist"
|
||||||
echo '</div>' >> "$tmpfile"
|
echo '</div>' >> "$tmpfile"
|
||||||
sed '/<\/body>/i REPLACE' $indexf > "$tmpsed"
|
sed '/<\/body>/i REPLACE' "$destdir"/index.html > "$tmpsed"
|
||||||
mv "$tmpsed" $indexf
|
mv "$tmpsed" "$destdir"/index.html
|
||||||
sed "/^REPLACE/r $tmpfile" $indexf > "$tmpsed"
|
sed "/^REPLACE/r $tmpfile" "$destdir"/index.html > "$tmpsed"
|
||||||
mv "$tmpsed" $indexf
|
mv "$tmpsed" "$destdir"/index.html
|
||||||
sed 's/^REPLACE//' $indexf > "$tmpsed"
|
sed 's/^REPLACE//' "$destdir"/index.html > "$tmpsed"
|
||||||
mv "$tmpsed" $indexf
|
mv "$tmpsed" "$destdir"/index.html
|
||||||
rm -f "$tmpfile"
|
rm -f "$tmpfile"
|
||||||
done;
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# enclose article inside <article></article>
|
# enclose article inside <article></article>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user