[gen.sh] signal if a page is an orphan during generation

This commit is contained in:
opfez 2022-03-21 20:18:18 +01:00
parent 566e8115c8
commit 384a715fc2
1 changed files with 13 additions and 8 deletions

21
gen.sh
View File

@ -16,7 +16,19 @@ $MAKROS resources/style-formatted.css | tr -d " \t\n\r" > resources/style.css
echo "Generating pages"
for file in site-src/*; do
bn=$(basename $file .wtn)
echo " $file -> site/$bn.html"
incoming=$(grep -i "{$bn}\|{$bn " site-src/* \
| sed "s/\..*$//g" \
| sed "s/^.*\///g" \
| sed "s/^/{/g" \
| sed "s/$/}/g" \
| tr '\n' ' ' \
| sed "s/$/\n\n/g")
if [ -z "$incoming" ]; then
printf "(o)"
fi
echo "\t$file -> site/$bn.html"
tmp=$(mktemp)
# if the file has macros, expand them
@ -35,13 +47,6 @@ for file in site-src/*; do
fi
# backlinks
incoming=$(grep -i "{$bn}\|{$bn " site-src/* \
| sed "s/\..*$//g" \
| sed "s/^.*\///g" \
| sed "s/^/{/g" \
| sed "s/$/}/g" \
| tr '\n' ' ' \
| sed "s/$/\n\n/g")
if [ ! -z "$incoming" ]; then
printf "\n_Incoming:_ $incoming\n" >> $tmp
fi