tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: Kristaps Dzonsons <kristaps@bsd.lv>
To: tech@mandoc.bsd.lv
Subject: ".TS H" macro
Date: Sun, 28 Mar 2021 13:23:51 +0200	[thread overview]
Message-ID: <c5e2effe-3a77-be62-f355-67bb22a6cf2e@bsd.lv> (raw)

[-- Attachment #1: Type: text/plain, Size: 946 bytes --]

Hi!

A recent issue for lowdown[1] noted the existence of ".TS H", which 
allows for multi-page PDF TS/TE tables.  These don't affect mandoc, 
where the PDF tables aren't great anyway (that's my fault from way long 
ago), so using ".TS H" instead of ".TS" is ignored and fine.

The problem is that this introduces a new macro to signal the end of the 
table header, which groff will re-issue at the start of a new page.  And 
of course, the macro is ".TH".

.TH "Untitled article" "7" ""
.TS H
tab(|) expand allbox;
lb lb
l l.
T{
app
T}|T{
quality
T}
.TH
T{
foo
T}|T{
bar
T}
.TE

In mandoc, the subsequent ".TH" overrides the main document's ".TH", so 
the title and stuff shows up as empty.

I've included a patch that has the TH parser bail if it already 
encounters a title.  This passes "make regress", but it may be more 
appropriate to check if it's in a TS/TE context.

Best,

Kristaps

[1]
https://github.com/kristapsdz/lowdown/issues/65

[-- Attachment #2: mandoc.TS.patch --]
[-- Type: text/x-patch, Size: 496 bytes --]

Index: man_validate.c
===================================================================
RCS file: /home/cvs/mdocml/mandoc/man_validate.c,v
retrieving revision 1.155
diff -u -p -u -r1.155 man_validate.c
--- man_validate.c	30 Oct 2020 13:24:33 -0000	1.155
+++ man_validate.c	28 Mar 2021 11:21:33 -0000
@@ -475,6 +475,9 @@ post_TH(CHKARGS)
 	struct roff_node *nb;
 	const char	*p;
 
+	if (man->meta.title != NULL)
+		return;
+
 	free(man->meta.title);
 	free(man->meta.vol);
 	free(man->meta.os);

             reply	other threads:[~2021-03-28 11:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-28 11:23 Kristaps Dzonsons [this message]
2021-03-28 11:30 ` Kristaps Dzonsons
2021-03-28 18:46   ` Ingo Schwarze

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c5e2effe-3a77-be62-f355-67bb22a6cf2e@bsd.lv \
    --to=kristaps@bsd.lv \
    --cc=tech@mandoc.bsd.lv \
    --subject='Re: ".TS H" macro' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).