groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Groff] nroff vs. troff conditional using escapes?


From: Michael(tm) Smith
Subject: Re: [Groff] nroff vs. troff conditional using escapes?
Date: Tue, 26 Feb 2008 12:07:03 +0900
User-agent: Mutt/1.5.14r5351+poontang (2008-01-29 21:06:38+09:00)

Werner LEMBERG <address@hidden>, 2008-02-23 09:31 +0100:

> > What I mean is that I'd like to be able to do something like this:
> > 
> >   For more information, see the \n[troff]Description\n[troff]
> >   \n[nroff]DESCRIPTION\n[nroff] section.
> 
> There are no inline conditionals in groff.  You would rather define a
> macro like this:
> 
>   .de t-or-n
>   .  ie t \
>   .    nop \\$1
>   .  el \
>   .    nop \\$2
>   ..
> 
> Then you can say
> 
>   For more information, see the
>   .t-or-n Description DESCRIPTION
>   section.

I've run into a problem with using a request like that for certain
cases (see below). So I'm wondering if there is really now way I
can do this using escapes instead.

Could a redefine some existing escapes? Or redefine a certain
font? (What I mean is, redefine it so that if I wrap something in
a particular pair of escapes, it doesn't get displayed in TTY
output, and another pair that doesn't get displayed for non-TTY).


The particular problem I run into with using a request for this is
that when the term I wanted to have alternative strings for is
immediately preceded and/or followed by a punctuation mark. For
example, a user might have DocBook source (which my app needs to
convert to groff source) like this:

  <para>For more information, see the preceding section (<xref
  linkend="desc"/>) or the <xref linkend="intro"/> section for
  this document.</para>

So when I generate groff source from that -- which includes
dereferencing the <xref> instances to get the title of the
sections they points to (e.g. "Description") -- I get:

  .PP
  For more information, see the preceding section (
  .t-or-n "Description" "DESCRIPTION"
  ) or the
  .t-or-n "Introduction" "INTRODUCTION"
  section for this document.

And if I then view the rendered output of that, I get:

  For more information, see the preceding section ( Description )
  or the Introduction section for this document.

That is, an undesirable wordspace gets inserted after the between
the parens before and after the word "Description".

Hence my question about whether there really is no way I could use
a set of escapes instead of a request...

  --Mike

-- 
Michael(tm) Smith
http://people.w3.org/mike/
http://sideshowbarker.net/

Attachment: smime.p7s
Description: S/MIME cryptographic signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]