groff
[Top][All Lists]
Advanced

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

Re: Running the grohtml pipeline as a pipeline


From: Alejandro Colomar
Subject: Re: Running the grohtml pipeline as a pipeline
Date: Fri, 22 Mar 2024 20:10:51 +0100

Hi Branden,

On Fri, Mar 22, 2024 at 01:53:51PM -0500, G. Branden Robinson wrote:
> Hi Alex,
> 
> At 2024-03-18T12:38:30+0100, Alejandro Colomar wrote:
> > I'm considering using grohtml(1) in the Linux man-pages, to replace
> > man2html(1), which crashes on tzfile(5) --which has correct man(7)--.
> 
> Well, all right.  Demand may drive improvement to grohtml more reliably
> than abandonment and neglect have.
> 
> > Currently, I'm running groff(1) as its separate constituents:
> > 
> >     $ make build-ps -Wman2/membarrier.2
> >     PRECONV         .tmp/man/man2/membarrier.2.tbl
> >     TBL             .tmp/man/man2/membarrier.2.eqn
> >     EQN             .tmp/man/man2/membarrier.2.ps.troff
> >     TROFF           .tmp/man/man2/membarrier.2.ps.set
> >     GROPS           .tmp/man/man2/membarrier.2.ps
> > 
> > which runs
> > 
> >     $ make build-ps -Wman2/membarrier.2 --debug=print \
> >             | grep -Pv '^[[:upper:]]+\t';
> >     preconv   man2/membarrier.2 >.tmp/man/man2/membarrier.2.tbl
> >     tbl <.tmp/man/man2/membarrier.2.tbl >.tmp/man/man2/membarrier.2.eqn
> >     ! (eqn -Tps   <.tmp/man/man2/membarrier.2.eqn 2>&1 
> > >.tmp/man/man2/membarrier.2.ps.troff) \
> >     | grep ^ >&2
> >     ! (troff -man -Tps -wbreak  <.tmp/man/man2/membarrier.2.ps.troff 2>&1 
> > >.tmp/man/man2/membarrier.2.ps.set) \
> >     | grep ^ >&2
> >     grops   <.tmp/man/man2/membarrier.2.ps.set 
> > >.tmp/man/man2/membarrier.2.ps
> > 
> > What pipeline do you recommend for HTML, using a similar pattern?
> > So far, the only thing that seems to work is
> > 
> >     $ preconv man2/membarrier.2 \
> >             | tbl \
> >             | troff -man -Thtml -wbreak man3/_Generic.3 \

Whoops!  I passed two different file names at different stages.  I
obviously wanted to say this:

        $ preconv man3/_Generic.3 \
                | tbl \
                | troff -man -Thtml -wbreak \
                | post-grohtml >g.html;


> >             | post-grohtml >g.html;
> > 
> > Although from pre-grohtml(1), maybe I shouldn't be running tbl(1)
> > myself?
> 
> grohtml uniquely runs its own output-driver-specific preprocessor, but
> more significantly, that preprocessor _runs troff_.  The main reason
> "groff -Thtml" is relatively slow is because it runs troff as part of
> running troff, scraping out chunks of PostScript and converting them to
> images.
> 
> I'm not _certain_ that what you're trying to do can't be expected to
> work.  I had suspected that tbl(1) had hooks in it for pre-grohtml(1)
> support (by testing the `ps4html` register, the usual way this is done),
> but it doesn't.
> 
> In fact, spending a few minutes looking at it, I'm not seeing anything
> that seems like it should foreclose what you're trying to do.
> 
> Can you share an exhibit of a pipeline that fails and describe _how_ it
> fails?

Sure.  Let's add eqn(1) to that pipeline.

        $ preconv man3/_Generic.3 \
                | tbl \
                | eqn -Thtml \
                | troff -man -Thtml -wbreak \
                | post-grohtml >g_eqn.html;
        <standard input>: warning: eqn should have been given a '-Tps' 
option(consider invoking 'groff -Thtml -e')

Hmmm, let's do what that warning says: use -Tps.

        $ preconv man3/_Generic.3 \
                | tbl \
                | eqn -Tps \
                | troff -man -Thtml -wbreak \
                | post-grohtml >g_eqnps.html;

This "works", but it results in a worse HTML file.

        $ diff -u1 g.html g_eqnps.html 
        --- g.html      2024-03-22 20:04:24.693780375 +0100
        +++ g_eqnps.html        2024-03-22 20:05:26.418201458 +0100
        @@ -1,3 +1,3 @@
         <!-- Creator     : groff version 1.23.0.902-1fce7-dirty -->
        -<!-- CreationDate: Fri Mar 22 20:04:24 2024 -->
        +<!-- CreationDate: Fri Mar 22 20:05:26 2024 -->
         <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        @@ -37,3 +37,3 @@
         
        -<p style="margin-left:6%; margin-top: 1em">_Generic &minus;
        +<p style="margin-left:1%; margin-top: 1em">_Generic &minus;
         type-generic selection</p>
        @@ -46,3 +46,3 @@
         
        -<p style="margin-left:6%; margin-top: 
1em"><b>_Generic(</b><i>expression</i><b>,
        +<p style="margin-left:1%; margin-top: 
1em"><b>_Generic(</b><i>expression</i><b>,
         type1:</b> e1<b>,</b> ... /*<b>, default:</b> e
        @@ -56,3 +56,3 @@
         
        -<p style="margin-left:6%; margin-top: 1em"><b>_Generic</b>()
        +<p style="margin-left:1%; margin-top: 1em"><b>_Generic</b>()
         evaluates the path of code under the type selector that is
        @@ -63,6 +63,6 @@
         
        -<p style="margin-left:6%; margin-top: 1em"><i>expression</i>
        +<p style="margin-left:1%; margin-top: 1em"><i>expression</i>
         is not evaluated.</p>
         
        -<p style="margin-left:6%; margin-top: 1em">This is
        +<p style="margin-left:1%; margin-top: 1em">This is
         especially useful for writing type-generic macros, that will
        @@ -76,3 +76,3 @@
         
        -<p style="margin-left:6%; margin-top: 1em">C11.</p>
        +<p style="margin-left:1%; margin-top: 1em">C11.</p>
         
        @@ -83,3 +83,3 @@
         
        -<p style="margin-left:6%; margin-top: 1em">C11.</p>
        +<p style="margin-left:1%; margin-top: 1em">C11.</p>
         
        @@ -90,3 +90,3 @@
         
        -<p style="margin-left:6%; margin-top: 1em">The following
        +<p style="margin-left:1%; margin-top: 1em">The following
         program demonstrates how to write a replacement for the
        @@ -96,3 +96,3 @@
         
        -<p style="margin-left:15%; margin-top: 1em">#include
        +<p style="margin-left:1%; margin-top: 1em">#include
         &lt;stdint.h&gt; <br>

It reduces the base paragraph inset (did I use the right term? :) to
almost nothing.

I have a few more cases, but let's keep it short for now.

Cheers,
Alex

> 
> Regards,
> Branden



-- 
<https://www.alejandro-colomar.es/>
Looking for a remote C programming job at the moment.

Attachment: signature.asc
Description: PGP signature


reply via email to

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