less_retarded_wiki/check.sh

33 lines
1.1 KiB
Bash
Raw Normal View History

2024-08-27 22:53:54 +02:00
#!/bin/sh
# Checks for potential errors in articles.
2024-08-31 14:44:45 +02:00
echo "===== trailing spaces:"
grep -rno " \+$" *.md
2024-08-27 22:53:54 +02:00
echo "===== links not ending in .md:"
grep -rno "\[[^]]*\]([^)]*\([^.)][^)][^)]\|[^)][^m)][^)]\|[^)][^)][^d)]\))" *.md
typos="("
typos="${typos}pubic|noticabl|occassion|ocassion|occure|occurres|adress"
typos="${typos}agressi|aggresi|aparrent|apparrent|concensu|definat|dissapoint|"
typos="${typos}dissappoint|disasterous|lmoa|cathegor|comming|commited|comitted"
typos="${typos}embarass|embarrasi|excede|harrass|harrase|fullfil|immitat|"
typos="${typos}taht|lightening|milleni|milenni|miniscule|mispell|neccessar|"
typos="${typos}necces|occasionaly|occurrance|occurence|passtime|posess|"
typos="${typos}possese|preceed|priviledge|reccom|refered|succesful|sucessful|"
typos="${typos}errorne|erorrne|superced|tommor|vaccu|wierd|wellfare|acknoleg"
typos="${typos}aparrent|collegue|deppres"
typos="${typos})"
echo "===== common typos:"
grep -rnoEi $typos *.md
echo "===== bad first headings:"
for f in *.md; do
secondChar=`grep -m 1 "^#.*" $f | head -c 2 | tail -c 1`
if [ "$secondChar" = "#" ]; then
echo $f
fi
done