|
|
|
@ -201,8 +201,25 @@ if ! [ "$SKIP_META" ]; then |
|
|
|
|
done |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
# Prepare index file list |
|
|
|
|
# For every file named "index.html", prepare index file list |
|
|
|
|
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" |
|
|
|
|
|
|
|
|
|
tmpfile="$(mktemp)" |
|
|
|
|
rm -f "$tmpfile" |
|
|
|
|
cat << EOF >> "$tmpfile" |
|
|
|
@ -215,22 +232,23 @@ EOF |
|
|
|
|
if echo "$line" | grep -q 'index\.html'; then |
|
|
|
|
continue |
|
|
|
|
fi |
|
|
|
|
tfile="$(awk "NR==$count" "$objlist")" |
|
|
|
|
tfile="$(awk "NR==$count" "$lobjlist")" |
|
|
|
|
title="$(sed -E -n 's/.*<title>\s*(.+)\s*<\/title>.*/\1/p' "$tfile")" |
|
|
|
|
if [ -z "$title" ]; then |
|
|
|
|
title="${tfile##*/}" |
|
|
|
|
fi |
|
|
|
|
ldate="$(awk "NR==$count" "$objdate" | sed 's/\s.*$//')" |
|
|
|
|
ldate="$(awk "NR==$count" "$lobjdate" | sed 's/\s.*$//')" |
|
|
|
|
printf "<p><a href=\"%s\">%s - %s</a></p>\n" "$line" "$ldate" "$title" >> "$tmpfile" |
|
|
|
|
done < "$linklist" |
|
|
|
|
done < "$llinklist" |
|
|
|
|
echo '</div>' >> "$tmpfile" |
|
|
|
|
sed '/<\/body>/i REPLACE' "$destdir"/index.html > "$tmpsed" |
|
|
|
|
mv "$tmpsed" "$destdir"/index.html |
|
|
|
|
sed "/^REPLACE/r $tmpfile" "$destdir"/index.html > "$tmpsed" |
|
|
|
|
mv "$tmpsed" "$destdir"/index.html |
|
|
|
|
sed 's/^REPLACE//' "$destdir"/index.html > "$tmpsed" |
|
|
|
|
mv "$tmpsed" "$destdir"/index.html |
|
|
|
|
sed '/<\/body>/i REPLACE' $indexf > "$tmpsed" |
|
|
|
|
mv "$tmpsed" $indexf |
|
|
|
|
sed "/^REPLACE/r $tmpfile" $indexf > "$tmpsed" |
|
|
|
|
mv "$tmpsed" $indexf |
|
|
|
|
sed 's/^REPLACE//' $indexf > "$tmpsed" |
|
|
|
|
mv "$tmpsed" $indexf |
|
|
|
|
rm -f "$tmpfile" |
|
|
|
|
done; |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
# enclose article inside <article></article> |
|
|
|
|