discuss@mandoc.bsd.lv
 help / color / mirror / Atom feed
* roff ugliness.
@ 2010-08-16 15:07 Kristaps Dzonsons
  0 siblings, 0 replies; only message in thread
From: Kristaps Dzonsons @ 2010-08-16 15:07 UTC (permalink / raw)
  To: discuss

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-08-16 15:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-16 15:07 roff ugliness Kristaps Dzonsons

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).