summaryrefslogtreecommitdiffstats
path: root/scripts/markup_check.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 19:40:15 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 19:40:15 +0000
commit399644e47874bff147afb19c89228901ac39340e (patch)
tree1c4c0b733f4c16b5783b41bebb19194a9ef62ad1 /scripts/markup_check.sh
parentInitial commit. (diff)
downloadmanpages-upstream/6.05.01.tar.xz
manpages-upstream/6.05.01.zip
Adding upstream version 6.05.01.upstream/6.05.01
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'scripts/markup_check.sh')
-rwxr-xr-xscripts/markup_check.sh48
1 files changed, 48 insertions, 0 deletions
diff --git a/scripts/markup_check.sh b/scripts/markup_check.sh
new file mode 100755
index 0000000..4dddd3a
--- /dev/null
+++ b/scripts/markup_check.sh
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+LOG=/tmp/markup_check.$$
+rm -f $LOG $LOG.full
+
+if test $# -eq 0; then
+ echo 1>&2 "Usage: $0 filename-or-dirname ... $#"
+ exit 1
+fi
+
+file_list=$(find $* -type f | grep '\.[1-9][a-zA-Z]*$')
+
+pagename_pattern='[a-z_A-Z][^ ]*'
+
+(
+ echo ""
+ echo "Checking for page xref without space before left parenthesis:"
+ pattern='^\.BR *'"$pagename_pattern"'([1-8][^1-9]'
+ echo " Pattern: '$pattern'"
+ grep "$pattern" $file_list | sed 's/^/ /' | tee -a $LOG
+
+ echo ""
+ echo "Checking for .IR xrefs that should be .BR"
+ pattern='^\.IR *'"$pagename_pattern"' *([1-8][^1-9]'
+ echo " Pattern: '$pattern'"
+ grep "$pattern" $file_list | sed 's/^/ /' | tee -a $LOG
+
+ echo ""
+ echo "Checking for misformatted punctuation in .BR xrefs"
+ pattern='^\.BR *'"$pagename_pattern"' *([1-8a-zA-Z]*) [^ ]'
+ echo " Pattern: '$pattern'"
+ grep "$pattern" $file_list | sed 's/^/ /' | tee -a $LOG
+
+ echo ""
+ echo "Checking for .B xrefs that should be .BR"
+ pattern='^\.B '"$pagename_pattern"' *([1-8a-zA-Z]*)'
+ echo " Pattern: '$pattern'"
+ grep "$pattern" $file_list | sed 's/^/ /' | tee -a $LOG
+) > $LOG.full
+
+if test $(cat $LOG | wc -l) -gt 0; then
+ echo ""
+ echo "MARKUP ERRORS!!!!!"
+ cat $LOG.full
+ exit 1
+fi
+
+exit 0