]> git.ipfire.org Git - thirdparty/man-pages.git/blame - scripts/markup_check.sh
des_crypt.3: Minor wording fix in VERSIONS
[thirdparty/man-pages.git] / scripts / markup_check.sh
CommitLineData
cf98af14
MK
1#!/bin/sh
2
3LOG=/tmp/markup_check.$$
4rm -f $LOG $LOG.full
5
6if test $# -eq 0; then
7 echo 1>&2 "Usage: $0 filename-or-dirname ... $#"
8 exit 1
9fi
10
11file_list=$(find $* -type f | grep '\.[1-9][a-zA-Z]*$')
12
13pagename_pattern='[a-z_A-Z][^ ]*'
14
15(
16 echo ""
17 echo "Checking for page xref without space before left parenthesis:"
18 pattern='^\.BR *'"$pagename_pattern"'([1-8][^1-9]'
19 echo " Pattern: '$pattern'"
20 grep "$pattern" $file_list | sed 's/^/ /' | tee -a $LOG
21
22 echo ""
23 echo "Checking for .IR xrefs that should be .BR"
24 pattern='^\.IR *'"$pagename_pattern"' *([1-8][^1-9]'
25 echo " Pattern: '$pattern'"
26 grep "$pattern" $file_list | sed 's/^/ /' | tee -a $LOG
27
28 echo ""
fae23c62 29 echo "Checking for misformatted punctuation in .BR xrefs"
cf98af14
MK
30 pattern='^\.BR *'"$pagename_pattern"' *([1-8a-zA-Z]*) [^ ]'
31 echo " Pattern: '$pattern'"
32 grep "$pattern" $file_list | sed 's/^/ /' | tee -a $LOG
33
34 echo ""
35 echo "Checking for .B xrefs that should be .BR"
36 pattern='^\.B '"$pagename_pattern"' *([1-8a-zA-Z]*)'
37 echo " Pattern: '$pattern'"
38 grep "$pattern" $file_list | sed 's/^/ /' | tee -a $LOG
39) > $LOG.full
40
41if test $(cat $LOG | wc -l) -gt 0; then
42 echo ""
43 echo "MARKUP ERRORS!!!!!"
44 cat $LOG.full
45 exit 1
46fi
47
48exit 0