Browse Source

link list is now in date order (hopefully)

master
Alessandro Mauri 8 months ago
parent
commit
81fd16023d
1 changed files with 11 additions and 8 deletions
  1. +11
    -8
      rivet.sh

+ 11
- 8
rivet.sh View File

@ -46,10 +46,10 @@ convert() {
tmpfile="tmpconvfile.tmp"
infile="$1"
outfile="${infile%???}.html"
cp "$1" "$tmpfile"
cp "$infile" "$tmpfile"
# TODO: convert links to .md to .html
lowdown -s -Thtml -o "$outfile" "$tmpfile"
rm -f "$tmpfile" "$1"
rm -f "$tmpfile" "$infile"
}
# Check dependencies
@ -87,6 +87,7 @@ srcdir=${src%%\/}
unset src
headerfile=$srcdir/_header.html
footerfile=$srcdir/_footer.html
filelist=filelist.tmp
# Check if index.md is present
if ! [ -e "$srcdir"/index.md ]; then
@ -132,11 +133,15 @@ mkdir -p "$destdir"
cp -r "$srcdir"/* "$destdir"
rm -f "$destdir"/_header.html "$destdir"/_footer.html
# Generate an ordered (by open time) file list
find "$srcdir" -type f -name "*.md" -exec ls -1t {} + > "$filelist"
sed -i "s,^\/*[^\/]*\/,$destdir/," "$filelist"
# Convert markdown files
find "$destdir" -name "*.md" |
while IFS="" read -r file; do
convert "$file"
done
done < "$filelist"
sed -i 's/\.md$/\.html/' "$filelist"
# Prepare the header
if ! [ "$SKIP_HEADER" ]; then
@ -161,12 +166,10 @@ fi
# Prepare the sitemap & file list
if ! [ "$SKIP_SITEMAP" ] || ! [ "$SKIP_LIST" ]; then
linklist="linklist.tmp"
# echo "" > "$linklist"
rm -f "$linklist" "$destdir"/sitemap.xml
find "$destdir" -name "*.html" |
while IFS="" read -r file; do
echo "${file#$destdir/}" >> "$linklist"
done
done < "$filelist"
if ! [ "$SKIP_LIST" ]; then
tmpfile="linkindex.tmp"
@ -206,7 +209,7 @@ EOF
done < "$linklist"
sed -i 's/^<url>/\t<url>/' "$destdir"/sitemap.xml
fi
rm -f "$linklist"
rm -f "$linklist" "$filelist"
fi
exit

Loading…
Cancel
Save