groff
[Top][All Lists]
Advanced

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

Re: Man page customization after 1.23?


From: G. Branden Robinson
Subject: Re: Man page customization after 1.23?
Date: Thu, 3 Aug 2023 22:42:22 -0500

Hi Nate & Lennart,

At 2023-08-03T18:56:54-0500, Nate Bargmann wrote:
> * On 2023 08 Jul 18:22 -0500, G. Branden Robinson wrote:
> > Shouldn't this be MANROFFOPT="-P -c"?
> 
> Probably if one is being pedantic but plain '-c' works as groff(1)
> shows it as a transparent option that disables color output,
> presumably no matter which output driver will be called.

I had forgotten about that when I wrote it.  groff(1)'s own '-c' has
always seemed like much too big a hammer to me, so I never use it.  Now
that nroff supports '-P', I prefer to avoid the...

...layering violation.  <take a drink>

> > Just keep in mind that other output drivers don't recognize '-c' (or
> > '-i' for that matter), so if you ever use man(1)'s '-T' option to
> > format for a non-terminal device, you will get complaints.
> > 
> > And if you say you never do that, I will cry, but will understand.
> 
> Rarely, but prepending the command as:
> 
> MANROFFOPT='' man -Tpdf man > man_1.pdf
> 
> seems to work as expected, at least on my Arch.  However, I don't see
> that OSC 8 links work in evince.  Hmmm.

Right, Lennart covered this.  Hyperlinks in man pages for PDF aren't
implemented yet.  I'm building some grumbles about why this is the case
(the pdfmark-based macros in pdf.tmac don't expect an.tmac to use
hyperlinks the way I'm trying to use them, which is pretty much the same
way Werner and Gaius put them in for grohtml 20 years ago), but won't
publish them until I've solved the problem, because some of my grumbles
might be wrong.

> Now, for the *real* reason of my reply.

I'll just comment on Lennart's responses to these questions/points.

At 2023-08-04T00:58:02+0000, Lennart Jablonka wrote:
> Quoth Nate Bargmann:
> > seems to work as expected, at least on my Arch.  However, I don't
> > see that OSC 8 links work in evince.  Hmmm.
> 
> OSC is a kind of control sequence, OSC 8 is the way with which we get
> links to a terminal.

Yup.

https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda

> Links in PDFs are interesting, but the correct term is not “OSC 8.”

Yup.

> > Are there plans to give users access to coloring the various text
> > styles when grotty is set to generate SGR output?  Right now only
> > the -i option is available.  The reason I ask is that even though
> > italics catch my eye in a PDF or on the printed page, they seem to
> > slip by when mixed with normal text in a terminal.  Perhaps that is
> > mostly because I've gotten used to man pages on the display having
> > such emphasized text in color or my preferred Gnome Terminal doesn't
> > stylize the characters enough.  More than likely it's a matter of
> > training.
> 
> First:  What you’re trying to do is a hack.   However you accomplish
> it, it’ll be a hack.

Yup.

> Now, ways to get the colors:  You could modify an.tmac and doc.tmac,
> as well as the font description files.   I’m not sure what features
> for colors groff has; maybe it allows you to define a font “I” with a
> certain color, maybe not.¹   You can change the definitions of .I,
> .IR, .RI & Co., though.

The ANSI color names are predefined in tmac/tty.tmac.

https://git.savannah.gnu.org/cgit/groff.git/tree/tmac/tty.tmac?h=1.23.0#n73

An example of "raw *roff" input (not a man page) exercising colors and
other features is in the grotty(1) man page in groff 1.23.0.

There are groff requests and escape sequences for manipulating color, so
redefining the macros in man.local is likely the best approach for this.
But, as you said, it will still be a hack.

https://www.gnu.org/software/groff/manual/groff.html.node/Colors.html

> You could modify grotty to give you colors.   Right now, it just spits
> out SGI

SGR.

> control sequences.   You could change that.

You mean change the ones it uses?  Yes--you could.  But forking
grotty(1) seems a high price to charge people for such a frivolous
feature.  (I realize that, to some, that coupling is entirely
appropriate.)

> I’m playing with grotty and terminfo.   My first conclusion is that
> terminfo isn’t great.

The extant alternatives I know of are worse.  :(

termap is insanely limited, under-designed, and under-powered.

> I might finish in a few weeks.   If grotty uses terminfo sometime, you
> could change the terminal description.   Something like
> 
>       xterm-man|xterm with nice italics replaced by green,
>               sitm=\E[32m,
>               ritm=\E[39m,
>               use=xterm,
> 
> would allow you to have MANROFFOPT=-P-Txterm-man give you green
> non-italic italics.   What a giant hack.   “This text is italic.”
> “Sure, how do I make text italic?”   “To make the text italic, do what
> makes it green.” “Here you have your italic text!”

This is the approach I expect the Arch community to take, once grotty is
terminfo-ified.

> The least hacky way might be to let your terminal emulator do the job:
> You configure it so that it renders italic text as colorful.   Still a
> hack.

Yes.  I'm glad I don't have to support a terminal emulator.

> > As noted above, italicized text on the console is colored green on
> > black which I presume is a choice of grotty, but perhaps it is a
> > function of the console hardware driver.
> 
> That’s a function of the Linux terminal.

Of the Linux console device, yes.  There is a distinction between the
termios(3) layer and the console device proper.  Mainly, termios tries
to be terminal-generic whereas an actual terminal is a specific
implementation--traditionally hardware, but nowadays more often just
another piece of software.  I don't know if/where those colors are
configurable.  The Linux console device is too buggy to suit me.[1]

Regards,
Branden

[1] "I did that for the ones most recast"

    
https://lore.kernel.org/linux-man/20220320160217.gws42lklp6ishzub@localhost.localdomain/

Attachment: signature.asc
Description: PGP signature


reply via email to

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