2020-03-29 21:18:30 +02:00
|
|
|
|
|
|
|
|
|
|
|
MARKDOWN_TARGETS=$(grep -nr -o -E "\]\(\/?(\w|-)+\)" ./*.md | tr -d ']()/' | awk -F: '{print $3}' | sort | uniq)
|
|
|
|
HTML_TARGETS=$(grep -nr -o -E 'href="\/?(\w|-)+\"' ./*.md | sed -E 's@href="/?@@g' | tr -d '"' | awk -F: '{print $3}' | sort | uniq)
|
|
|
|
|
|
|
|
ALL_TARGETS=$(echo $MARKDOWN_TARGETS $HTML_TARGETS)
|
|
|
|
|
2020-09-05 19:52:07 +02:00
|
|
|
PAGES=$(ls *.md | sed -E 's/(_(fr|it|de|ar|oc|es|ru|ca))?\.md//g' | sort | uniq)
|
2020-03-29 21:18:30 +02:00
|
|
|
|
|
|
|
returncode=0
|
|
|
|
|
|
|
|
for PAGE in $PAGES
|
|
|
|
do
|
|
|
|
if [[ $PAGE == "index" ]] || [[ $PAGE == "README" ]] || [[ $PAGE == "default" ]]
|
|
|
|
then
|
|
|
|
continue
|
|
|
|
fi
|
2020-03-30 02:14:41 +02:00
|
|
|
if ! echo $ALL_TARGETS | grep -q -w $PAGE
|
2020-03-29 21:18:30 +02:00
|
|
|
then
|
|
|
|
returncode=1
|
|
|
|
echo "The following page is not referenced by any other page :( -> $PAGE"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
exit $returncode
|