From 60d39e586279076a4f0dbf58a3f9b75112ff8a59 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 26 Apr 2016 06:42:31 -0700 Subject: Adding manual page checker. * Makefile (txr-manpage.pdf): Invoke checkman.txr on the man page source. * checkman.txr: New file. --- Makefile | 3 ++- checkman.txr | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 checkman.txr diff --git a/Makefile b/Makefile index d9dea2f3..eaf50be1 100644 --- a/Makefile +++ b/Makefile @@ -432,7 +432,8 @@ install-tests: txr-manpage.html: txr.1 genman.txr man2html $< | $(TXR) genman.txr - > $@ -txr-manpage.pdf: txr.1 +txr-manpage.pdf: txr.1 checkman.txr + $(TXR) checkman.txr $< tbl $< | pdfroff -ww -man --no-toc - > $@ # diff --git a/checkman.txr b/checkman.txr new file mode 100644 index 00000000..98070c8a --- /dev/null +++ b/checkman.txr @@ -0,0 +1,78 @@ +@(name file) +@;; +@;; Check syntax block after function +@;; +@(define check-synb ()) +.synb +@ (assert bad ln `bad .synb block`) +@ (repeat :gap 0 :min 1) +.mets @(skip) +@ (maybe) +@ (repeat :gap 0 :mintimes 1) +.mets \ \ @(skip) +@ (last :mandatory) + +@ (trailer) +.mets @(skip) +@ (end) +@ (end) +@ (last :mandatory) +.syne +@ (end) +@ (assert bad ln `missing .desc`) +.desc +@(end) +@;; +@;; Check variable description headings +@;; +@(define check-var ()) +@ (cases) +@; exception +.coNP Variables @@, s-ifmt @(skip) +@ (or) +@; exception +.coNP Variables @@, *0 @(skip) +@ (or) +.coNP Variables@(assert bad ln `bad Variables heading`)@(rep :gap 0) @@, @{x /\S+/}@(last :mandatory) @@ @y and @@ @{z /\S+/}@(end) +@ (assert bad ln `no .desc after variables heading`) +.desc +@ (or) +.coNP Variable@(assert bad ln `bad Variable heading`) @{x /\S+/} +@ (assert bad ln `no .desc after variable heading`) +.desc +@ (end) +@(end) +@;; +@;; Check function/macro/operator headings +@;; +@(define check-func ()) +@ (cases) +.coNP Operator/function @(skip) +@ (or) +.coNP @{type /Function|Operator|Macro/}s@(assert bad ln `bad @{type}s heading`)@(rep :gap 0) @@, @{x /\S+/}@(last :mandatory) @@ @y and @@ @{z /\S+/}@(end) +@ (assert bad ln `no .synb after @{type}s heading`) +@ (check-synb) +@ (or) +.coNP @{type /Function|Operator|Macro/}@(assert bad ln `bad @type heading`) @{x /\S+/} +@ (assert bad ln `no .synb after @type heading`) +@ (check-synb) +@ (end) +@(end) +@;; +@;; Main +@;; +@(bind errors 0) +@(repeat) +@ (line ln) +@ (try) +@ (cases) +@ (check-var) +@ (or) +@ (check-func) +@ (end) +@ (catch bad (line msg)) +@ (do (inc errors) + (put-line `@file:@line:@msg`)) +@ (end) +@(end) +@(do (exit (zerop errors))) -- cgit v1.2.3