discuss@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: Kristaps Dzonsons <kristaps@bsd.lv>
To: "discuss@mdocml.bsd.lv" <discuss@mdocml.bsd.lv>
Subject: roff ugliness.
Date: Mon, 16 Aug 2010 17:07:04 +0200	[thread overview]
Message-ID: <4C695418.30206@bsd.lv> (raw)

The extent of hideous roff-isms expands.  Consider this, in the standard
pod2man preamble:

  .ds Ae A\h'-(\w'A'u*4/10)'E

Notice that something's amiss.  The first apostrophe in the escape "\h'"
appears to be closed at "\w'", which renders this inscrutable to mandoc.

But no: in fact, escapes are RECURSIVE.  Thus, this resolves to

  \h'-(            # negative value of...
       \('A'u      #   unit length * length of "A"
       *           #   multiplied by
       4/10        #   4/10
      )'

Or in other words, a mathematical expression embedded in the macro,
which in turn consists of an embedded expression.

This is only a problem since `ds' was implemented.  Before, I'd
hard-coded the values for the pod2man preamble predefined strings.  But
now `ds' is correctly reading them, so the default predefines are just
dead weight (see last commits for my removal of "\*(C+") (this use a
non-recursive string, so it's ok).

In short, looks like some more intelligence is going to be required in
the roff library.

Fortunately, these escapes aren't used too often.  But when they are,
they're going to spit out some garbage like

 \*(Ae -> AA'u*4/10)'E

This makes sense from mandoc's perspective cause "\h" is being closed
after "\w", with the rest being verbatim.

A short-term solution is to mark the "standard" pod2man escapes as being
non-overridable.  This will at least contain the ugliness while a better
evaluator is added to libroff.

Kristaps
--
 To unsubscribe send an email to discuss+unsubscribe@mdocml.bsd.lv

                 reply	other threads:[~2010-08-16 15:09 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=4C695418.30206@bsd.lv \
    --to=kristaps@bsd.lv \
    --cc=discuss@mdocml.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).