From: "G. Branden Robinson" <g.branden.robinson@gmail.com>
To: "Alejandro Colomar (man-pages)" <alx.manpages@gmail.com>
Cc: Ingo Schwarze <schwarze@usta.de>,
mtk.manpages@gmail.com, linux-man@vger.kernel.org
Subject: automated example verification in the groff Texinfo manual
Date: Fri, 25 Mar 2022 15:14:12 +1100 [thread overview]
Message-ID: <20220325041411.7532dbtfecextgfo@localhost.localdomain> (raw)
In-Reply-To: <7559214e-bef1-f52d-a716-19ea31ee149b@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2819 bytes --]
[subject changed; steve@sk2.org dropped from CC list since he's not
quoted]
At 2022-03-20T22:55:48+0100, Alejandro Colomar (man-pages) wrote:
> On 3/20/22 22:26, Ingo Schwarze wrote:
> > Alejandro Colomar (man-pages) wrote on Sun, Mar 20, 2022 at 09:34:47PM +0100:
> >
> >> I have ready some code to extract source code from EXAMPLES in
> >> man-pages.
> >
> > Frankly, i don't see the point at all.
> >
> > Manual Pages are not HOWTO documents that mindless users are
> > supposed to copy from verbatim without understanding what they see.
> > Instead, the are supposed to be read with your brain switched on and
> > the reader is supposed to *apply* what they learnt, not copy it.
>
> This feature is not supposed to be used by manual page readers
> (users), but by manual page editors.
Indeed. For quite a while I've had medium-term plans to do something
similar for the many examples in the groff Texinfo manual. I want to be
sure they remain accurate.
Here's my sketch for whenever I get back around to this idea.
1. Extract examples with, e.g., 'sed -n '/^@Example/,/^@endExample/'.[1]
2. Use Texinfo comment lines within this example to:
2a. identify the example (an invisible figure caption, if you will);
and
2b. specify additional transformations that should take place on the
input and/or output--these are not necessarily just more 's' sed
commands but possibly 'i' and 'd' commands as well.
As an example of an 'i' use case, the line length _has_ to be shortened
for many examples to fit within DVI/PDF page margins. We note this in
the front matter of the current version of the manual[1], but I'm
uncertain of the utility of having it literally present in every case
(particularly in examples related to issues conceptually distant from
line length and/or breaking).
In some cases, either input or output is wholly elided when it sheds no
further light.
I don't envision changing the manual generation process to _populate_
the examples--that should be done carefully and by hand by someone with
a pedagogue's hat on. The idea is to _validate_ the examples, reading
them in, performing a few invariant sed substitutions (the ones that
distinguish input, output, and error streams in the example text),
perform any further specified sed operations encoded as Texinfo
comments, and then run groff and verify that they match.
Since it would run this way, I reckon it can become just another test in
our suite. (For those who don't follow groff development, groff 1.22.4
shipped with 3 tests. groff 1.23 can be expected to have at least 111.)
Regards,
Branden
[1] These are custom Texinfo macros defined by the groff manual.
[2] https://git.savannah.gnu.org/cgit/groff.git/tree/doc/groff.texi#n901
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2022-03-25 4:14 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-20 20:34 Exctracting source code from EXAMPLES Alejandro Colomar (man-pages)
2022-03-20 21:26 ` Ingo Schwarze
2022-03-20 21:55 ` Alejandro Colomar (man-pages)
2022-03-25 4:14 ` G. Branden Robinson [this message]
2022-03-20 22:27 ` Stephen Kitt
2022-03-21 0:02 ` Alejandro Colomar (man-pages)
2022-03-21 1:07 ` Alejandro Colomar (man-pages)
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=20220325041411.7532dbtfecextgfo@localhost.localdomain \
--to=g.branden.robinson@gmail.com \
--cc=alx.manpages@gmail.com \
--cc=linux-man@vger.kernel.org \
--cc=mtk.manpages@gmail.com \
--cc=schwarze@usta.de \
/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: link
Be 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