On Mon, Aug 09, 2021 at 10:58:19AM +0200, Ingo Schwarze wrote:
> Nab wrote on Sun, Aug 08, 2021 at 03:24:53PM +0200:
> > tbl's -Thtml ignores font requests;
> Not in CVS HEAD; see https://cvsweb.bsd.lv/mandoc/tbl_html.c revision 1.34,
> committed on May 16 earlier this year.
Oh, indeed. I tested and based my patch on 1.14.5 from Debian,
didn't realise that's almost two years old by now.
Will use the CVS next time.

> I started from your patch and changed a few aspects:
>  * You couldn't possibly know that i'm trying to work towards a
>    unified system for identifying fonts using the mandoc.h
>    enum mandoc_esc ESCAPE_FONT* identifiers.  Having different
>    font identifiers for each output module is not good.
>    So i added ESCAPE_FONTCB and ESCAPE_FONTCI and used those.
>    A nice side effect is that CB and CI now work in HTML
>    for all of \f, .ft, and tbl(7) f and that tbl(7) fBI
>    now also works for terminal output.

> >     <td><span class="Li">text</span></td>
> >     <td><b>text</b></td>
> >     <td><i>text</i></td>
> These become:
>       <td><span class="Li"><b>text</b></span></td>
>       <td><span class="Li"><i>text</i></span></td>
This is great news! A bunch of my pages use C[BI] and the HTML renders
look much better, thanks!

>  * GNU tbl(1) appears to ignore space characters between the f
>    modifier and the font name, so "lf   B" is the same as "lfB".
Huh, so it does! That's not explicitly mentioned by the manual and so
I didn't think to test it. Now, tbl(1) says
  Key characters can be separated by spaces or tabs.
so consider the following document:
-- >8 --
.TS
lfBI    lf BI   lf      BI      .
a       b       c
.TE
-- >8 --
(In order, none, space, tab follow 'f';
 base64: LlRTCmxmQkkJbGYgQkkJbGYJQkkJLgphCWIJYwouVEUK)

groff renders it with a, b, and c as BI,
but mandoc with your patch with a+b as BI and c as R, with -Tlint:
  mandoc: ./q.1:2:14: WARNING: unknown font, skipping request: TS f     BI      
.

If you change tbl_layout.c L171 to match L75:
-- >8 --
-       while (p[*pos] == ' ')
+       while (p[*pos] == ' ' || p[*pos] == '\t')
-- >8 --
and L187:
-- >8 --
-       if (strchr(" .", p[*pos + isz]) == NULL)
+       if (strchr(" \t.", p[*pos + isz]) == NULL)
-- >8 --
The document renders correctly.

> > Renders to a teletype with the expected fonts:
> >   b, ul, bul;  b, ul, bul;  normal, b, ul
> Not quite.  The expected output for lbi is ul, not bul.
> The i overrides the b rather than add to it.
> So lbi is the same as lfI, not as lfBI.
Indeed, it looks like I got confused by the groff parsing
and thought it'd accumulate instead.

> Could you please check out from CVS (instead of the last release),
> apply the following patch, and tell me whether it looks reasonable
> and works for you?
Yeah, save for the tab thing above, I haven't managed to fault it,
in tests or real pages.

> When this gets committed, i will credit you for reporting the
> missing feature.  Do i understand correctly that "Nabija" is your
> first name and "Czleweli" your last name?
They aren't, but either "наб" or "nabijaczleweli" is fine.

Best,
наб

Attachment: signature.asc
Description: PGP signature

Reply via email to