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 13:06:08 +0900
User-agent: Mutt/1.5.14r5351+poontang (2008-01-29 21:06:38+09:00)

Hi Ralph,

> @2008-02-23 11:24 +0000:
> 
> Hi Michael,
> 
> > 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.
> 
> Use Werner's macro idea but maybe add in
> 
>     .tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
>     .tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
> 
> so you only have to enter one word and have troff turn it into all
> upper-case.

Thanks -- I see now that m.tmac has something like that in a
address@hidden macro it uses internally.

But it seems like there's a big limitation with that as far as
internationalization.

What I'm currently using to generate the uppercase strings in the
groff source I generate is a mechanism in the DocBook XSL
stylesheets that at this point supports some 50 different locales.

The locale files are here:

  https://docbook.svn.sourceforge.net/svnroot/docbook/trunk/gentext/locale/

Each file defines a set of "lowercase.alpha" characters and set of
"uppercase.alpha" one. So just as examples, the ones for the
Russian and Slovak locale files are

  <gentext key="lowercase.alpha" text="абвгдеёжзийклмнопрстуфхцчшщъыьэюя"/>
  <gentext key="uppercase.alpha" text="АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ"/>

  <gentext key="lowercase.alpha" 
text="aáäbcčdďeéfghiíjklĺľmnňoóôpqrŕsštťuúvwxyýzž"/> 
  <gentext key="uppercase.alpha" 
text="AÁÄBCČDĎEÉFGHIÍJKLĹĽMNŇOÓÔPQRŔSŠTŤUÚVWXYÝZŽ"/> 

So I have the DocBook manpages stylesheet using those sets to
generate localized uppercase strings for use in .SH section titles
(because of the man-page convention for that) -- and to also use
those uppercase strings in the generated text of cross-references
to those titles (because of user feedback that it was undesirable
to have the text of the cross-references in lowercase if the
titles they referenced were actually in uppercase in the output).

But I guess I could reproduce the DocBook uppercasing mechanism in
my generated groff source -- that is, for each man page my app
outputs, have it embed in the page a "toupper" macro for that
locale, with a .tr request that has only the lower->upper mappings
for the locale the DocBook source is in (which is specified using
a lang attribute on the root element of the document).

Unfortunately, even if I were to do that, I still have the problem
that, for the case of handling the text of cross-references, it
seems like I really need a way to handle toggling of the alternate
upper/lower versions of strings inline, using escapes instead of
requests (because, as I mentioned in my reply to Werner, using a
request can cause undesirable white space to be injected between
the string and surrounding punctuation).

  --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]