mirror of
https://github.com/YunoHost/doc.git
synced 2024-09-03 20:06:26 +02:00
20 lines
770 B
Bash
20 lines
770 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 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 link looks dead (page doesn't exist in english?) $LINK"
|
||
|
[ -e "$PAGE.md" ] || returncode=1
|
||
|
done
|
||
|
|
||
|
exit $returncode
|