Merge pull request 'master' (#4) from EmaMaker/rivet:master into master
Reviewed-on: #4
This commit is contained in:
commit
3deaa11a76
23
rivet.sh
23
rivet.sh
@ -169,11 +169,8 @@ cp -r "$srcdir"/* "$destdir"
|
||||
rm -f "$destdir"/_header.html "$destdir"/_footer.html "$destdir"/_metadata.html
|
||||
|
||||
# Generate an ordered (by open time) file list
|
||||
find "$srcdir" -type f -exec ls -1t {} + | awk '/^.*\/[^_].+\.(md|html)$/' > "$objlist"
|
||||
rm -f "$objdate"
|
||||
while IFS="" read -r file; do
|
||||
stat -c '%y' "$file" >> "$objdate"
|
||||
done < "$objlist"
|
||||
find "$srcdir" -type f -not -iname "__*" -exec ls -1t {} + | awk '/^.*\/[^_].+\.(md|html)$/' > "$objlist"
|
||||
|
||||
sed -e "s,^\/*[^\/]*\/,$destdir/," "$objlist" > "$tmpsed"
|
||||
mv "$tmpsed" "$objlist"
|
||||
|
||||
@ -206,17 +203,27 @@ if ! [ "$SKIP_LIST" ]; then
|
||||
lobjlist=$(mktemp)
|
||||
lobjdate=$(mktemp)
|
||||
llinklist=$(mktemp)
|
||||
for indexf in $(find "$destdir" -type f -iname "index.html"); do
|
||||
lmdlist=$(mktemp)
|
||||
|
||||
for indexf in $(find "$destdir" -mindepth 1 -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
|
||||
# Filter global list
|
||||
grep "$outdir" "$objlist" > "$lobjlist"
|
||||
sed -e "s,^\/*[^\/]*\/,$destdir/," "$lobjlist" > "$tmpsed"
|
||||
mv "$tmpsed" "$lobjlist"
|
||||
|
||||
# Get the corresponding .md source file for every .html file, so that the file date is referring to
|
||||
# the source and not to the output
|
||||
sed -e 's/\.html$/\.md/' "$lobjlist" > "$tmpsed"
|
||||
sed -e "s/$destdir/$srcdir/" "$tmpsed" > "$lmdlist"
|
||||
|
||||
# Generate the list of dates for each file (open time)
|
||||
rm -f "$lobjdate"
|
||||
while IFS="" read -r file; do
|
||||
stat -c '%y' "$file" >> "$lobjdate"
|
||||
done < "$lobjlist"
|
||||
mv "$tmpsed" "$lobjlist"
|
||||
done < "$lmdlist"
|
||||
|
||||
grep "$outdir" "$linklist" > "$llinklist"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user