doc/tests/dead_links.sh
Vincent Rubiolo 96af536f0c Updated french text in english doc
This fixes a potential leftover from the original translation.

Other changes:
- Some Travis-reported errors are also fixed as a result, this helps lowering
  the associated failure count.
- The dead_links.sh script error message is improved to better pinpoint
  the kind of reported error (Markdown vs HTML link).
2020-05-26 21:40:33 +02:00

19 lines
784 B
Bash

returncode=0
# Find all markdown links and generate a list of filename.md:N:linktarget (with N the line number)
for LINK in $(grep -nr -o -E "\]\(\/?(\w|-)+\)" ./*.md | tr -d ']()/')
do
PAGE=$(echo $LINK | awk -F: '{print $3}')
[ -e "$PAGE.md" ] || echo "This Markdown link looks dead (page doesn't exist in english?) $LINK"
[ -e "$PAGE.md" ] || returncode=1
done
# Find all HTML/href links and generate a list of filename.md:N:linktarget (with N the line number)
for LINK in $(grep -nr -o -E 'href="\/?(\w|-)+\"' ./*.md | sed -E 's@href="/?@@g' | tr -d '"')
do
PAGE=$(echo $LINK | awk -F: '{print $3}')
[ -e "$PAGE.md" ] || echo "This HTML link looks dead (page doesn't exist in english?) $LINK"
[ -e "$PAGE.md" ] || returncode=1
done
exit $returncode