public inbox for newlib-cvs@sourceware.org help / color / mirror / Atom feed
From: Jon TURNEY <jturney@sourceware.org> To: newlib-cvs@sourceware.org Subject: [newlib-cygwin] makedocbook: Fix false report of unhandled texinfo command Date: Sat, 12 Nov 2022 14:12:32 +0000 (GMT) [thread overview] Message-ID: <20221112141232.78E3D3883029@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=c03f0c306244bf73239cb1a318a175682f504dc2 commit c03f0c306244bf73239cb1a318a175682f504dc2 Author: Jon Turney <jon.turney@dronecode.org.uk> Date: Sat Oct 29 16:43:50 2022 +0100 makedocbook: Fix false report of unhandled texinfo command During 'make man', makedocbook falsely reports "texinfo command '@modifier' remains in output" while processing the setlocal(3) manpage, which contains that literal string. Move the check for unrecognized texinfo commands to before processing '@@' (an escaped '@') in the texinfo source, and teach it to ignore them. Improve that check slightly, so it catches non-alphabetic texinfo commands, of which there are few. Now we don't have false positives, we can make unrecognized texinfo commands fatal to manpage generation, rather than leaving them verbatim in the generated manpage. Diff: --- newlib/doc/makedocbook.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/newlib/doc/makedocbook.py b/newlib/doc/makedocbook.py index 4de20ef92..9c5615f22 100755 --- a/newlib/doc/makedocbook.py +++ b/newlib/doc/makedocbook.py @@ -450,9 +450,6 @@ command_dispatch_dict = { def line_markup_convert(p): s = p - # process the texinfo escape for an @ - s = s.replace('@@', '@') - # escape characters not allowed in XML s = s.replace('&', '&') s = s.replace('<', '<') @@ -482,6 +479,14 @@ def line_markup_convert(p): # very hacky way of dealing with @* to force a newline s = s.replace('@*', '</para><para>') + # fail if there are unhandled texinfo commands + match = re.search(r'(?<!@)@[^@\s]+', s) + if match: + sys.exit("texinfo command '%s' remains in output" % match.group(0)) + + # process the texinfo escape for an @ + s = s.replace('@@', '@') + if (verbose > 3) and (s != p): print('%s-> line_markup_convert ->\n%s' % (p, s), file=sys.stderr) @@ -823,10 +828,6 @@ def main(file): print(s) - # warn about texinfo commands which didn't get processed - match = re.search(r'@[a-z*]+', s) - if match: - print('texinfo command %s remains in output' % match.group(), file=sys.stderr) # #
reply other threads:[~2022-11-12 14:12 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20221112141232.78E3D3883029@sourceware.org \ --to=jturney@sourceware.org \ --cc=newlib-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).