diff mbox series

[kmod,01/20] man: add script to generate/compare the xslt vs upcoming scdoc

Message ID 20240611-man-v1-1-bd6864d49639@gmail.com (mailing list archive)
State Handled Elsewhere
Headers show
Series man: convert to scdoc and minor improvements | expand

Commit Message

Emil Velikov via B4 Relay June 11, 2024, 3:05 p.m. UTC
From: Emil Velikov <emil.l.velikov@gmail.com>

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
---
 man/compare.sh | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)
diff mbox series

Patch

diff --git a/man/compare.sh b/man/compare.sh
new file mode 100755
index 0000000..7579ab5
--- /dev/null
+++ b/man/compare.sh
@@ -0,0 +1,63 @@ 
+#!/bin/bash
+
+the_sed()
+{
+	sed -e 's|@DISTCONFDIR@|/TEST|g;s|@MODULE_DIRECTORY@|/TEST|g' $1
+}
+
+gen_xslt()
+{
+			#--output ${xml//.xml}.xslt \
+			#--noout \
+	for xml in *xml; do
+		the_sed $xml | xsltproc \
+			--stringparam man.output.quietly 1 \
+			--param funcsynopsis.style "'ansi'" \
+			http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl -
+		# The output and noout args seems cosmetic, sigh
+		mv ${xml//.xml}{,.xslt}
+	done
+}
+
+gen_scdoc()
+{
+	for scd in *scd; do
+		the_sed $scd | scdoc > ${scd//.scd}.scdoc
+	done
+}
+
+comp_output()
+{
+	export LESS='-F -i -M -R -S -w -X -z-4'
+	unset MANPAGER
+
+	for xslt in $(ls --sort=version *xslt); do
+		_name=${xslt//.xslt}
+
+		echo "Checking $_name"
+
+		diff --unified --color=always \
+			<(man ./$_name.xslt) \
+			<(man ./$_name.scdoc) | less
+
+		read
+	done
+}
+
+comp_raw()
+{
+	for xslt in *xslt; do
+		_name=${xslt//.xslt}
+
+		diff --unified --color=always ./$_name.{xslt,scdoc}
+	done
+}
+
+time gen_xslt
+time gen_scdoc
+
+comp_output
+#comp_raw
+
+rm -f *xslt
+rm -f *scdoc