tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: Ingo Schwarze <schwarze@usta.de>
To: Stephen Gregoratto <dev@sgregoratto.me>
Cc: tech@mandoc.bsd.lv
Subject: Re: [PATCH docbook2mdoc] Add NODE_CONTRIB, NODE_PRODUCTNAME
Date: Thu, 28 Mar 2019 18:19:56 +0100	[thread overview]
Message-ID: <20190328171956.GB48147@athene.usta.de> (raw)
In-Reply-To: <20190327035224.7eyuctlnbt67pu5r@BlackBox>

Hi Stephen,

Stephen Gregoratto wrote on Wed, Mar 27, 2019 at 02:52:24PM +1100:

> Here are some nodes I found in the wild.

Thank you for the information about the two nodes.  I wasn't aware
of them yet and have added the information to my TODO list.

Regarding the patch, you are no longer up to date.  ;-)

Unless you want to make at least one explicit formatting decision
based on the presence of an element, adding it to "node.h" is no
longer required.  Elements can now be explicitly ignored, in the
sense that they generate no node and that their content appears in
their stead as children of their parent, with a line like

  { "productname", NODE_IGNORE },

in parse.c, elements[].

Yes, i know that "nohe.h" still contains enum constants for various
nodes that are correctly not doing any formatting.  I tend to remove
those that are unlikely to ever require formatting, but i tend to
keep those that are likely to require some handling when the program
becomes better in the future.  But for new nodes, i only add them
when i start actually using them for formatting purposes.

Regarding the additions to parse.c, even those are no longer needed.
Elements with unknown names are now automatically ignored (in the
above sense), except that they emit a warning with -W.  So, a
NODE_IGNORE line in parse.c as shown above is only needed to suppress
the warning, which may be useful in two cases: (1) if it is unlikely
that the element will ever need formatting (examples: <acronym>,
<phrase>, <trademark>) or (2) if the element occurs so frequently
that the warnings would be too noisy, making it hard to find warnings
that actually matter (no examples currently).  It seems to me neither
applies here.

> Technically <productname> is used to markup text as 
> copyright/trademark/registered,

In that capacity, NODE_IGNORE is probably right, like for <acronym>.

> but the Systemd and GTK manuals use it to set the "source" argument
> of TH in man(7).  We have no need for it.

So in that capacity, it would be NODE_DELETE.

However, each element name can only have one enum constant attached
to it.  If requirements conflict depending on context, like in this
case, one could make it NODE_PRODUCTNAME and then explicitly treat
it as transparent in normal text (which needs no explicit code at
all, nodes are transparent by default) and skip it in other contexts
(which does need explicit code).  But i'd prefer adding the
NODE_PRODUCTNAME enum constant when the skipping code is implemented,
not earlier: we are not really sure yet such skipping code will
ever be needed, or are we?

> <contrib> is a bit odd case. It classifies an <author>'s contributions 
> to the program/manual/code etc. Here's an example from GTK:
> 
>   <authorgroup>
>     <author>
>       <contrib>Developer</contrib>
>       <firstname>Matthias</firstname>
>       <surname>Clasen</surname>
>     </author>
>   </authorgroup>

Right, handling <author> properly is a challenge that is on my TODO
list.  There are three things to do that i'm aware of: (1) in normal
text, stop skipping children like <affiliation>; (2) below
<refentryinfo>, <articleinfo>, <bookinfo> and the like, move the
information down to the AUTHORS section (a slightly tricky task);
(3) handle <contrib>.

Currently (and dto. with your patch), the above example is formatted as:

  .An Developer Matthias Clasen

Instead, it should be:

  Developer:
  .An Matthias Clasen

That's somewhat tricky (but still straightforward enough to implement
with the recent improvements in the codebase) because NODE_AUTHOR
has to print a NODE_CONTRIB child *before* calling macro_open("An").
It is sufficient to add the NODE_CONTRIB enum constant when that
is implemented.

> I'm setting it to be skipped for now, but if we ever start recording
> <author>s we could probably include this.

Err, right now, <author> elements *are* handled, and <contrib> -
with or without your patch - is *ignored* (in the sense explained
above), not *skipped*; see <anchor> and <indexterm> as examples of
elements that are skipped (more formally, "deleted").

Yours,
  Ingo
--
 To unsubscribe send an email to tech+unsubscribe@mandoc.bsd.lv

  reply	other threads:[~2019-03-28 17:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-27  3:52 Stephen Gregoratto
2019-03-28 17:19 ` Ingo Schwarze [this message]
2019-03-28 20:53   ` Ingo Schwarze

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=20190328171956.GB48147@athene.usta.de \
    --to=schwarze@usta.de \
    --cc=dev@sgregoratto.me \
    --cc=tech@mandoc.bsd.lv \
    /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;
as well as URLs for NNTP newsgroup(s).