aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2020-04-06 10:16:17 +0000
committerIngo Schwarze <schwarze@openbsd.org>2020-04-06 10:16:17 +0000
commit70b71d1de24478a8fcc7413f1cb42c83db416bc3 (patch)
tree03e1d4654d318e7f9e007d588173fcc2dbd59683
parente03f6c4421e6265e6c69f785a01edfe489ff4f9c (diff)
downloadmandoc-70b71d1de24478a8fcc7413f1cb42c83db416bc3.tar.gz
mandoc-70b71d1de24478a8fcc7413f1cb42c83db416bc3.tar.zst
mandoc-70b71d1de24478a8fcc7413f1cb42c83db416bc3.zip
Support manual tagging of .Pp, .Bd, .D1, .Dl, .Bl, and .It.
In HTML output, improve the logic for writing inside permalinks: skip them when there is no child content or when there is a risk that the children might contain flow content.
-rw-r--r--html.c23
-rw-r--r--mdoc.c13
-rw-r--r--mdoc_html.c35
-rw-r--r--mdoc_term.c23
-rw-r--r--mdoc_validate.c48
-rw-r--r--regress/mdoc/Bd/Makefile3
-rw-r--r--regress/mdoc/Bd/nested.in8
-rw-r--r--regress/mdoc/Bd/nested.out_ascii2
-rw-r--r--regress/mdoc/Bd/nested.out_lint4
-rw-r--r--regress/mdoc/Bd/nested.out_markdown2
-rw-r--r--regress/mdoc/Bd/nested.out_tag6
-rw-r--r--regress/mdoc/Bd/paragraph.in9
-rw-r--r--regress/mdoc/Bd/paragraph.out_ascii2
-rw-r--r--regress/mdoc/Bd/paragraph.out_html10
-rw-r--r--regress/mdoc/Bd/paragraph.out_markdown2
-rw-r--r--regress/mdoc/Bd/paragraph.out_tag7
-rw-r--r--regress/mdoc/D1/Makefile3
-rw-r--r--regress/mdoc/D1/spacing.in5
-rw-r--r--regress/mdoc/D1/spacing.out_ascii2
-rw-r--r--regress/mdoc/D1/spacing.out_html4
-rw-r--r--regress/mdoc/D1/spacing.out_lint2
-rw-r--r--regress/mdoc/D1/spacing.out_markdown2
-rw-r--r--regress/mdoc/D1/spacing.out_tag3
-rw-r--r--regress/mdoc/Dl/Makefile3
-rw-r--r--regress/mdoc/Dl/spacing.in5
-rw-r--r--regress/mdoc/Dl/spacing.out_ascii2
-rw-r--r--regress/mdoc/Dl/spacing.out_lint2
-rw-r--r--regress/mdoc/Dl/spacing.out_markdown2
-rw-r--r--regress/mdoc/Dl/spacing.out_tag3
-rw-r--r--regress/mdoc/Pp/Makefile3
-rw-r--r--regress/mdoc/Pp/arg.in8
-rw-r--r--regress/mdoc/Pp/arg.out_ascii4
-rw-r--r--regress/mdoc/Pp/arg.out_lint6
-rw-r--r--regress/mdoc/Pp/arg.out_markdown4
-rw-r--r--regress/mdoc/Pp/arg.out_tag4
-rw-r--r--regress/mdoc/Tg/Makefile10
-rw-r--r--regress/mdoc/Tg/column.in17
-rw-r--r--regress/mdoc/Tg/column.out_ascii13
-rw-r--r--regress/mdoc/Tg/column.out_html10
-rw-r--r--regress/mdoc/Tg/column.out_markdown16
-rw-r--r--regress/mdoc/Tg/column.out_tag5
-rw-r--r--regress/mdoc/Tg/list.in22
-rw-r--r--regress/mdoc/Tg/list.out_ascii14
-rw-r--r--regress/mdoc/Tg/list.out_html7
-rw-r--r--regress/mdoc/Tg/list.out_markdown19
-rw-r--r--regress/mdoc/Tg/list.out_tag6
-rw-r--r--roff.c10
-rw-r--r--roff.h5
48 files changed, 333 insertions, 85 deletions
diff --git a/html.c b/html.c
index 769acce8..81068509 100644
--- a/html.c
+++ b/html.c
@@ -1,4 +1,4 @@
-/* $Id: html.c,v 1.264 2020/03/13 15:32:28 schwarze Exp $ */
+/* $Id: html.c,v 1.265 2020/04/06 10:16:17 schwarze Exp $ */
/*
* Copyright (c) 2011-2015, 2017-2020 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -362,7 +362,7 @@ html_make_id(const struct roff_node *n, int unique)
return NULL;
break;
default:
- if (n->child->type != ROFFT_TEXT)
+ if (n->child == NULL || n->child->type != ROFFT_TEXT)
return NULL;
buf = mandoc_strdup(n->child->string);
break;
@@ -769,13 +769,15 @@ print_otag(struct html *h, enum htmltag tag, const char *fmt, ...)
/*
* Print an element with an optional "id=" attribute.
- * If there is an "id=" attribute, also add a permalink:
- * outside if it's a phrasing element, or inside otherwise.
+ * If the element has phrasing content and an "id=" attribute,
+ * also add a permalink: outside if it can be in phrasing context,
+ * inside otherwise.
*/
struct tag *
print_otag_id(struct html *h, enum htmltag elemtype, const char *cattr,
struct roff_node *n)
{
+ struct roff_node *nch;
struct tag *ret, *t;
const char *id;
@@ -788,8 +790,17 @@ print_otag_id(struct html *h, enum htmltag elemtype, const char *cattr,
t = print_otag(h, elemtype, "ci", cattr, id);
if (ret == NULL) {
ret = t;
- if (id != NULL)
- print_otag(h, TAG_A, "chR", "permalink", id);
+ if (id != NULL && (nch = n->child) != NULL) {
+ /* man(7) is safe, it tags phrasing content only. */
+ if (n->tok > MDOC_MAX ||
+ htmltags[elemtype].flags & HTML_TOPHRASE)
+ nch = NULL;
+ else /* For mdoc(7), beware of nested blocks. */
+ while (nch != NULL && nch->type == ROFFT_TEXT)
+ nch = nch->next;
+ if (nch == NULL)
+ print_otag(h, TAG_A, "chR", "permalink", id);
+ }
}
return ret;
}
diff --git a/mdoc.c b/mdoc.c
index bb3ec58b..475a6aa0 100644
--- a/mdoc.c
+++ b/mdoc.c
@@ -1,7 +1,7 @@
-/* $Id: mdoc.c,v 1.274 2018/12/31 07:46:07 schwarze Exp $ */
+/* $Id: mdoc.c,v 1.275 2020/04/06 10:16:17 schwarze Exp $ */
/*
+ * Copyright (c) 2010, 2012-2018, 2020 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2010, 2012-2018 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -14,6 +14,8 @@
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Top level and utility functions of the mdoc(7) parser for mandoc(1).
*/
#include "config.h"
@@ -352,12 +354,13 @@ mdoc_pmacro(struct roff_man *mdoc, int ln, char *buf, int offs)
mandoc_msg(MANDOCERR_SPACE_EOL, ln, offs - 1, NULL);
/*
- * If an initial macro or a list invocation, divert directly
- * into macro processing.
+ * If an initial or transparent macro or a list invocation,
+ * divert directly into macro processing.
*/
n = mdoc->last;
- if (n == NULL || tok == MDOC_It || tok == MDOC_El) {
+ if (n == NULL || tok == MDOC_It || tok == MDOC_El ||
+ roff_tok_transparent(tok)) {
(*mdoc_macro(tok)->fp)(mdoc, tok, ln, sv, &offs, buf);
return 1;
}
diff --git a/mdoc_html.c b/mdoc_html.c
index fbfa19a0..dd0f1235 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_html.c,v 1.337 2020/04/01 20:21:08 schwarze Exp $ */
+/* $Id: mdoc_html.c,v 1.338 2020/04/06 10:16:17 schwarze Exp $ */
/*
* Copyright (c) 2014-2020 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -741,7 +741,7 @@ mdoc_it_pre(MDOC_ARGS)
case ROFFT_HEAD:
return 0;
case ROFFT_BODY:
- print_otag(h, TAG_LI, "");
+ print_otag_id(h, TAG_LI, NULL, n);
break;
default:
break;
@@ -753,7 +753,7 @@ mdoc_it_pre(MDOC_ARGS)
case LIST_ohang:
switch (n->type) {
case ROFFT_HEAD:
- print_otag(h, TAG_DT, "");
+ print_otag_id(h, TAG_DT, NULL, n);
break;
case ROFFT_BODY:
print_otag(h, TAG_DD, "");
@@ -765,7 +765,7 @@ mdoc_it_pre(MDOC_ARGS)
case LIST_tag:
switch (n->type) {
case ROFFT_HEAD:
- print_otag(h, TAG_DT, "");
+ print_otag_id(h, TAG_DT, NULL, n);
break;
case ROFFT_BODY:
if (n->child == NULL) {
@@ -786,7 +786,7 @@ mdoc_it_pre(MDOC_ARGS)
print_otag(h, TAG_TD, "");
break;
default:
- print_otag(h, TAG_TR, "");
+ print_otag_id(h, TAG_TR, NULL, n);
}
default:
break;
@@ -852,8 +852,8 @@ mdoc_bl_pre(MDOC_ARGS)
case LIST_tag:
if (bl->offs)
print_otag(h, TAG_DIV, "c", "Bd-indent");
- print_otag(h, TAG_DL, "c", bl->comp ?
- "Bl-tag Bl-compact" : "Bl-tag");
+ print_otag_id(h, TAG_DL,
+ bl->comp ? "Bl-tag Bl-compact" : "Bl-tag", n->body);
return 1;
case LIST_column:
elemtype = TAG_TABLE;
@@ -866,7 +866,7 @@ mdoc_bl_pre(MDOC_ARGS)
(void)strlcat(cattr, " Bd-indent", sizeof(cattr));
if (bl->comp)
(void)strlcat(cattr, " Bl-compact", sizeof(cattr));
- print_otag(h, elemtype, "c", cattr);
+ print_otag_id(h, elemtype, cattr, n->body);
return 1;
}
@@ -898,15 +898,15 @@ mdoc_d1_pre(MDOC_ARGS)
switch (n->type) {
case ROFFT_BLOCK:
html_close_paragraph(h);
- break;
+ return 1;
case ROFFT_HEAD:
return 0;
case ROFFT_BODY:
- return 1;
+ break;
default:
abort();
}
- print_otag(h, TAG_DIV, "c", "Bd Bd-indent");
+ print_otag_id(h, TAG_DIV, "Bd Bd-indent", n);
if (n->tok == MDOC_Dl)
print_otag(h, TAG_CODE, "c", "Li");
return 1;
@@ -963,7 +963,7 @@ mdoc_bd_pre(MDOC_ARGS)
strcmp(n->norm->Bd.offs, "left") != 0)
(void)strlcat(buf, " Bd-indent", sizeof(buf));
- print_otag(h, TAG_DIV, "c", buf);
+ print_otag_id(h, TAG_DIV, buf, n);
return 1;
}
@@ -1210,11 +1210,16 @@ mdoc_pp_pre(MDOC_ARGS)
{
if (n->flags & NODE_NOFILL) {
print_endline(h);
- h->col = 1;
- print_endline(h);
+ if (n->flags & NODE_ID)
+ mdoc_tg_pre(meta, n, h);
+ else {
+ h->col = 1;
+ print_endline(h);
+ }
} else {
html_close_paragraph(h);
- print_otag(h, TAG_P, "c", "Pp");
+ print_otag(h, TAG_P, "ci", "Pp",
+ n->flags & NODE_ID ? html_make_id(n, 1) : NULL);
}
return 0;
}
diff --git a/mdoc_term.c b/mdoc_term.c
index ba21097e..42392c7c 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_term.c,v 1.379 2020/03/13 15:32:28 schwarze Exp $ */
+/* $Id: mdoc_term.c,v 1.380 2020/04/06 10:16:17 schwarze Exp $ */
/*
* Copyright (c) 2010, 2012-2020 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -335,7 +335,8 @@ print_mdoc_node(DECL_ARGS)
memset(&npair, 0, sizeof(struct termpair));
npair.ppair = pair;
- if (n->flags & NODE_ID)
+ if (n->flags & NODE_ID && n->tok != MDOC_Pp &&
+ (n->tok != MDOC_It || n->type != ROFFT_BLOCK))
term_tag_write(n, p->line);
/*
@@ -630,6 +631,8 @@ termp_it_pre(DECL_ARGS)
if (n->type == ROFFT_BLOCK) {
print_bvspace(p, n->parent->parent, n);
+ if (n->flags & NODE_ID)
+ term_tag_write(n, p->line);
return 1;
}
@@ -1110,7 +1113,6 @@ termp_ex_pre(DECL_ARGS)
static int
termp_nd_pre(DECL_ARGS)
{
-
if (n->type == ROFFT_BODY)
term_word(p, "\\(en");
return 1;
@@ -1119,14 +1121,20 @@ termp_nd_pre(DECL_ARGS)
static int
termp_bl_pre(DECL_ARGS)
{
-
- return n->type != ROFFT_HEAD;
+ switch (n->type) {
+ case ROFFT_BLOCK:
+ term_newln(p);
+ return 1;
+ case ROFFT_HEAD:
+ return 0;
+ default:
+ return 1;
+ }
}
static void
termp_bl_post(DECL_ARGS)
{
-
if (n->type != ROFFT_BLOCK)
return;
term_newln(p);
@@ -1140,7 +1148,6 @@ termp_bl_post(DECL_ARGS)
static int
termp_xr_pre(DECL_ARGS)
{
-
if (NULL == (n = n->child))
return 0;
@@ -1555,6 +1562,8 @@ static int
termp_pp_pre(DECL_ARGS)
{
term_vspace(p);
+ if (n->flags & NODE_ID)
+ term_tag_write(n, p->line);
return 0;
}
diff --git a/mdoc_validate.c b/mdoc_validate.c
index 551dec25..8a8176b9 100644
--- a/mdoc_validate.c
+++ b/mdoc_validate.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_validate.c,v 1.382 2020/04/02 15:04:36 schwarze Exp $ */
+/* $Id: mdoc_validate.c,v 1.383 2020/04/06 10:16:17 schwarze Exp $ */
/*
* Copyright (c) 2010-2020 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -1105,6 +1105,7 @@ post_tg(POST_ARGS)
struct roff_node *n; /* The .Tg node. */
struct roff_node *nch; /* The first child of the .Tg node. */
struct roff_node *nn; /* The next node after the .Tg node. */
+ struct roff_node *np; /* The parent of the next node. */
struct roff_node *nt; /* The TEXT node containing the tag. */
size_t len; /* The number of bytes in the tag. */
@@ -1150,7 +1151,7 @@ post_tg(POST_ARGS)
}
/* By default, tag the .Tg node itself. */
- if (nn == NULL)
+ if (nn == NULL || nn->flags & NODE_ID)
nn = n;
/* Explicit tagging of specific macros. */
@@ -1158,8 +1159,41 @@ post_tg(POST_ARGS)
case MDOC_Sh:
case MDOC_Ss:
case MDOC_Fo:
- nn = nn->head;
- /* FALLTHROUGH */
+ nn = nn->head->child == NULL ? n : nn->head;
+ break;
+ case MDOC_It:
+ np = nn->parent;
+ while (np->tok != MDOC_Bl)
+ np = np->parent;
+ switch (np->norm->Bl.type) {
+ case LIST_column:
+ break;
+ case LIST_diag:
+ case LIST_hang:
+ case LIST_inset:
+ case LIST_ohang:
+ case LIST_tag:
+ nn = nn->head;
+ break;
+ case LIST_bullet:
+ case LIST_dash:
+ case LIST_enum:
+ case LIST_hyphen:
+ case LIST_item:
+ nn = nn->body->child == NULL ? n : nn->body;
+ break;
+ default:
+ abort();
+ }
+ break;
+ case MDOC_Bd:
+ case MDOC_Bl:
+ case MDOC_D1:
+ case MDOC_Dl:
+ nn = nn->body->child == NULL ? n : nn->body;
+ break;
+ case MDOC_Pp:
+ break;
case MDOC_Cm:
case MDOC_Dv:
case MDOC_Em:
@@ -1172,9 +1206,9 @@ post_tg(POST_ARGS)
case MDOC_Ms:
case MDOC_No:
case MDOC_Sy:
- if (nn->child != NULL && (nn->flags & NODE_ID) == 0)
- break;
- /* FALLTHROUGH */
+ if (nn->child == NULL)
+ nn = n;
+ break;
default:
nn = n;
break;
diff --git a/regress/mdoc/Bd/Makefile b/regress/mdoc/Bd/Makefile
index f05f54b0..a7319e70 100644
--- a/regress/mdoc/Bd/Makefile
+++ b/regress/mdoc/Bd/Makefile
@@ -1,9 +1,10 @@
-# $OpenBSD: Makefile,v 1.22 2019/01/07 06:51:37 schwarze Exp $
+# $OpenBSD: Makefile,v 1.23 2020/04/06 09:55:49 schwarze Exp $
REGRESS_TARGETS = beforeNAME blank centered nested nf paragraph spacing
REGRESS_TARGETS += badargs empty offset-empty offset-neg
REGRESS_TARGETS += break broken unclosed
+TAG_TARGETS = nested paragraph
LINT_TARGETS = beforeNAME blank nested badargs break broken unclosed
HTML_TARGETS = nf paragraph
diff --git a/regress/mdoc/Bd/nested.in b/regress/mdoc/Bd/nested.in
index 4d12b2a3..450c1fb4 100644
--- a/regress/mdoc/Bd/nested.in
+++ b/regress/mdoc/Bd/nested.in
@@ -1,5 +1,5 @@
-.\" $OpenBSD: nested.in,v 1.2 2017/07/04 14:53:24 schwarze Exp $
-.Dd $Mdocdate: July 4 2017 $
+.\" $OpenBSD: nested.in,v 1.3 2020/04/06 09:55:49 schwarze Exp $
+.Dd $Mdocdate: April 6 2020 $
.Dt BD-NESTED 1
.Os
.Sh NAME
@@ -8,9 +8,11 @@
.Sh DESCRIPTION
regular
text
+.Tg outer
.Bd -ragged -offset indent
outer
text (default indent)
+.Tg inner
.Bd -ragged -offset indent
inner
text (default indent)
@@ -20,8 +22,10 @@ text
.Ed
regular
text
+.Tg outer
.Bd -ragged -offset 4n
outer text (4n)
+.Tg inner
.Bd -ragged -offset 2n
inner text (2n)
.Ed
diff --git a/regress/mdoc/Bd/nested.out_ascii b/regress/mdoc/Bd/nested.out_ascii
index 58ee55dd..1d27c178 100644
--- a/regress/mdoc/Bd/nested.out_ascii
+++ b/regress/mdoc/Bd/nested.out_ascii
@@ -26,4 +26,4 @@ DDEESSCCRRIIPPTTIIOONN
inner text (2n)
outer text
-OpenBSD July 4, 2017 OpenBSD
+OpenBSD April 6, 2020 OpenBSD
diff --git a/regress/mdoc/Bd/nested.out_lint b/regress/mdoc/Bd/nested.out_lint
index d6f7eda2..5a6a6966 100644
--- a/regress/mdoc/Bd/nested.out_lint
+++ b/regress/mdoc/Bd/nested.out_lint
@@ -1,2 +1,2 @@
-mandoc: nested.in:14:2: WARNING: nested displays are not portable: Bd in Bd
-mandoc: nested.in:25:2: WARNING: nested displays are not portable: Bd in Bd
+mandoc: nested.in:16:2: WARNING: nested displays are not portable: Bd in Bd
+mandoc: nested.in:29:2: WARNING: nested displays are not portable: Bd in Bd
diff --git a/regress/mdoc/Bd/nested.out_markdown b/regress/mdoc/Bd/nested.out_markdown
index d936b9c0..e647a0df 100644
--- a/regress/mdoc/Bd/nested.out_markdown
+++ b/regress/mdoc/Bd/nested.out_markdown
@@ -43,4 +43,4 @@ tag
> outer text
-OpenBSD - July 4, 2017
+OpenBSD - April 6, 2020
diff --git a/regress/mdoc/Bd/nested.out_tag b/regress/mdoc/Bd/nested.out_tag
new file mode 100644
index 00000000..7b9c2012
--- /dev/null
+++ b/regress/mdoc/Bd/nested.out_tag
@@ -0,0 +1,6 @@
+NAME 3
+DESCRIPTION 6
+outer 9
+inner 11
+outer 15
+inner 17
diff --git a/regress/mdoc/Bd/paragraph.in b/regress/mdoc/Bd/paragraph.in
index e1ebfd01..8e53d0e7 100644
--- a/regress/mdoc/Bd/paragraph.in
+++ b/regress/mdoc/Bd/paragraph.in
@@ -1,5 +1,5 @@
-.\" $OpenBSD: paragraph.in,v 1.1 2019/01/07 06:51:37 schwarze Exp $
-.Dd $Mdocdate: January 7 2019 $
+.\" $OpenBSD: paragraph.in,v 1.2 2020/04/06 09:55:49 schwarze Exp $
+.Dd $Mdocdate: April 6 2020 $
.Dt BD-PARAGRAPH 1
.Os
.Sh NAME
@@ -9,12 +9,15 @@
BEGINTEST
initial
text
+.Tg npara
.Pp
normal
paragraph
+.Tg filled
.Bd -filled
filled
display
+.Tg fpara
.Pp
paragraph
in display
@@ -24,9 +27,11 @@ to normal
.Pp
another
paragraph
+.Tg unfilled
.Bd -unfilled
unfilled
display
+.Tg upara
.Pp
unfilled
paragraph
diff --git a/regress/mdoc/Bd/paragraph.out_ascii b/regress/mdoc/Bd/paragraph.out_ascii
index 216f4530..bf122ce0 100644
--- a/regress/mdoc/Bd/paragraph.out_ascii
+++ b/regress/mdoc/Bd/paragraph.out_ascii
@@ -24,4 +24,4 @@ DDEESSCCRRIIPPTTIIOONN
ENDTEST
end of file
-OpenBSD January 7, 2019 OpenBSD
+OpenBSD April 6, 2020 OpenBSD
diff --git a/regress/mdoc/Bd/paragraph.out_html b/regress/mdoc/Bd/paragraph.out_html
index bec13a88..f537335e 100644
--- a/regress/mdoc/Bd/paragraph.out_html
+++ b/regress/mdoc/Bd/paragraph.out_html
@@ -1,14 +1,14 @@
-<p class="Pp">normal paragraph</p>
-<div class="Bd Pp">filled display
-<p class="Pp">paragraph in display</p>
+<p class="Pp" id="npara">normal paragraph</p>
+<div class="Bd Pp" id="filled">filled display
+<p class="Pp" id="fpara">paragraph in display</p>
</div>
back to normal
<p class="Pp">another paragraph</p>
-<div class="Bd Pp">
+<div class="Bd Pp" id="unfilled">
<pre>
unfilled
display
-
+<mark id="upara"></mark>
unfilled
paragraph
</pre>
diff --git a/regress/mdoc/Bd/paragraph.out_markdown b/regress/mdoc/Bd/paragraph.out_markdown
index 13e43f11..6e569b5d 100644
--- a/regress/mdoc/Bd/paragraph.out_markdown
+++ b/regress/mdoc/Bd/paragraph.out_markdown
@@ -36,4 +36,4 @@ to normal
ENDTEST
end of file
-OpenBSD - January 7, 2019
+OpenBSD - April 6, 2020
diff --git a/regress/mdoc/Bd/paragraph.out_tag b/regress/mdoc/Bd/paragraph.out_tag
new file mode 100644
index 00000000..eab6391f
--- /dev/null
+++ b/regress/mdoc/Bd/paragraph.out_tag
@@ -0,0 +1,7 @@
+NAME 3
+DESCRIPTION 6
+npara 9
+filled 11
+fpara 13
+unfilled 18
+upara 21
diff --git a/regress/mdoc/D1/Makefile b/regress/mdoc/D1/Makefile
index b94d5727..170dc2ca 100644
--- a/regress/mdoc/D1/Makefile
+++ b/regress/mdoc/D1/Makefile
@@ -1,6 +1,7 @@
-# $OpenBSD: Makefile,v 1.5 2019/01/07 06:51:37 schwarze Exp $
+# $OpenBSD: Makefile,v 1.6 2020/04/06 09:55:49 schwarze Exp $
REGRESS_TARGETS = spacing
+TAG_TARGETS = spacing
LINT_TARGETS = spacing
HTML_TARGETS = spacing
diff --git a/regress/mdoc/D1/spacing.in b/regress/mdoc/D1/spacing.in
index c0f293c4..20258caf 100644
--- a/regress/mdoc/D1/spacing.in
+++ b/regress/mdoc/D1/spacing.in
@@ -1,5 +1,5 @@
-.\" $OpenBSD: spacing.in,v 1.4 2019/01/07 06:51:37 schwarze Exp $
-.Dd $Mdocdate: January 7 2019 $
+.\" $OpenBSD: spacing.in,v 1.5 2020/04/06 09:55:49 schwarze Exp $
+.Dd $Mdocdate: April 6 2020 $
.Dt D1-SPACING 1
.Os
.Sh NAME
@@ -10,6 +10,7 @@ BEGINTEST
.Pp
preceding
paragraph
+.Tg display
.D1 spacing in and around one-line displays
empty display:
.D1
diff --git a/regress/mdoc/D1/spacing.out_ascii b/regress/mdoc/D1/spacing.out_ascii
index c0d1556d..c6241a38 100644
--- a/regress/mdoc/D1/spacing.out_ascii
+++ b/regress/mdoc/D1/spacing.out_ascii
@@ -13,4 +13,4 @@ DDEESSCCRRIIPPTTIIOONN
ENDTEST
end of file
-OpenBSD January 7, 2019 OpenBSD
+OpenBSD April 6, 2020 OpenBSD
diff --git a/regress/mdoc/D1/spacing.out_html b/regress/mdoc/D1/spacing.out_html
index 3db40161..3a9affc9 100644
--- a/regress/mdoc/D1/spacing.out_html
+++ b/regress/mdoc/D1/spacing.out_html
@@ -1,5 +1,7 @@
<p class="Pp">preceding paragraph</p>
-<div class="Bd Bd-indent">spacing in and around one-line displays</div>
+<div class="Bd
+ Bd-indent" id="display"><a class="permalink" href="#display">spacing in and
+ around one-line displays</a></div>
empty display:
<div class="Bd Bd-indent"></div>
following text
diff --git a/regress/mdoc/D1/spacing.out_lint b/regress/mdoc/D1/spacing.out_lint
index 0a2790bb..532375d7 100644
--- a/regress/mdoc/D1/spacing.out_lint
+++ b/regress/mdoc/D1/spacing.out_lint
@@ -1 +1 @@
-mandoc: spacing.in:15:2: WARNING: empty block: D1
+mandoc: spacing.in:16:2: WARNING: empty block: D1
diff --git a/regress/mdoc/D1/spacing.out_markdown b/regress/mdoc/D1/spacing.out_markdown
index d1f12f63..225b3a0b 100644
--- a/regress/mdoc/D1/spacing.out_markdown
+++ b/regress/mdoc/D1/spacing.out_markdown
@@ -19,4 +19,4 @@ following text
ENDTEST
end of file
-OpenBSD - January 7, 2019
+OpenBSD - April 6, 2020
diff --git a/regress/mdoc/D1/spacing.out_tag b/regress/mdoc/D1/spacing.out_tag
new file mode 100644
index 00000000..73ab507a
--- /dev/null
+++ b/regress/mdoc/D1/spacing.out_tag
@@ -0,0 +1,3 @@
+NAME 3
+DESCRIPTION 6
+display 10
diff --git a/regress/mdoc/Dl/Makefile b/regress/mdoc/Dl/Makefile
index bed27d1b..51605be0 100644
--- a/regress/mdoc/Dl/Makefile
+++ b/regress/mdoc/Dl/Makefile
@@ -1,6 +1,7 @@
-# $OpenBSD: Makefile,v 1.2 2015/02/06 02:04:35 schwarze Exp $
+# $OpenBSD: Makefile,v 1.5 2020/04/06 09:55:49 schwarze Exp $
REGRESS_TARGETS = spacing
+TAG_TARGETS = spacing
LINT_TARGETS = spacing
.include <bsd.regress.mk>
diff --git a/regress/mdoc/Dl/spacing.in b/regress/mdoc/Dl/spacing.in
index 0f485b83..96d77ac7 100644
--- a/regress/mdoc/Dl/spacing.in
+++ b/regress/mdoc/Dl/spacing.in
@@ -1,5 +1,5 @@
-.\" $OpenBSD: spacing.in,v 1.4 2017/07/04 14:53:25 schwarze Exp $
-.Dd $Mdocdate: July 4 2017 $
+.\" $OpenBSD: spacing.in,v 1.5 2020/04/06 09:55:49 schwarze Exp $
+.Dd $Mdocdate: April 6 2020 $
.Dt DL-SPACING 1
.Os
.Sh NAME
@@ -7,6 +7,7 @@
.Nd spacing in and around one-line literal displays
.Sh DESCRIPTION
preceding text
+.Tg display
.Dl spacing in and around one-line literal displays
empty display:
.Dl
diff --git a/regress/mdoc/Dl/spacing.out_ascii b/regress/mdoc/Dl/spacing.out_ascii
index c0928ec0..c96eca32 100644
--- a/regress/mdoc/Dl/spacing.out_ascii
+++ b/regress/mdoc/Dl/spacing.out_ascii
@@ -9,4 +9,4 @@ DDEESSCCRRIIPPTTIIOONN
empty display:
following text
-OpenBSD July 4, 2017 OpenBSD
+OpenBSD April 6, 2020 OpenBSD
diff --git a/regress/mdoc/Dl/spacing.out_lint b/regress/mdoc/Dl/spacing.out_lint
index a18ed583..a31f329f 100644
--- a/regress/mdoc/Dl/spacing.out_lint
+++ b/regress/mdoc/Dl/spacing.out_lint
@@ -1 +1 @@
-mandoc: spacing.in:12:2: WARNING: empty block: Dl
+mandoc: spacing.in:13:2: WARNING: empty block: Dl
diff --git a/regress/mdoc/Dl/spacing.out_markdown b/regress/mdoc/Dl/spacing.out_markdown
index 08d15972..27dab22c 100644
--- a/regress/mdoc/Dl/spacing.out_markdown
+++ b/regress/mdoc/Dl/spacing.out_markdown
@@ -14,4 +14,4 @@ empty display:
following text
-OpenBSD - July 4, 2017
+OpenBSD - April 6, 2020
diff --git a/regress/mdoc/Dl/spacing.out_tag b/regress/mdoc/Dl/spacing.out_tag
new file mode 100644
index 00000000..b036279d
--- /dev/null
+++ b/regress/mdoc/Dl/spacing.out_tag
@@ -0,0 +1,3 @@
+NAME 3
+DESCRIPTION 6
+display 8
diff --git a/regress/mdoc/Pp/Makefile b/regress/mdoc/Pp/Makefile
index 04e1bc3b..03d32774 100644
--- a/regress/mdoc/Pp/Makefile
+++ b/regress/mdoc/Pp/Makefile
@@ -1,6 +1,7 @@
-# $OpenBSD: Makefile,v 1.4 2015/02/04 19:11:17 schwarze Exp $
+# $OpenBSD: Makefile,v 1.7 2020/04/06 09:55:50 schwarze Exp $
REGRESS_TARGETS = arg
+TAG_TARGETS = arg
LINT_TARGETS = arg
.include <bsd.regress.mk>
diff --git a/regress/mdoc/Pp/arg.in b/regress/mdoc/Pp/arg.in
index 274e558d..1e62c80c 100644
--- a/regress/mdoc/Pp/arg.in
+++ b/regress/mdoc/Pp/arg.in
@@ -1,5 +1,5 @@
-.\" $OpenBSD: arg.in,v 1.4 2017/07/04 14:53:26 schwarze Exp $
-.Dd $Mdocdate: July 4 2017 $
+.\" $OpenBSD: arg.in,v 1.5 2020/04/06 09:55:50 schwarze Exp $
+.Dd $Mdocdate: April 6 2020 $
.Dt PP-ARG 1
.Os
.Sh NAME
@@ -7,9 +7,13 @@
.Nd paragraph macro with arguments
.Sh DESCRIPTION
line 1
+.Tg first
.Pp drop this
line 2
.br drop this
line 3
.sp 1v drop this
line 4
+.Tg last
+.Pp
+final text
diff --git a/regress/mdoc/Pp/arg.out_ascii b/regress/mdoc/Pp/arg.out_ascii
index a15f1598..70eebb4d 100644
--- a/regress/mdoc/Pp/arg.out_ascii
+++ b/regress/mdoc/Pp/arg.out_ascii
@@ -11,4 +11,6 @@ DDEESSCCRRIIPPTTIIOONN
line 4
-OpenBSD July 4, 2017 OpenBSD
+ final text
+
+OpenBSD April 6, 2020 OpenBSD
diff --git a/regress/mdoc/Pp/arg.out_lint b/regress/mdoc/Pp/arg.out_lint
index f49d27d4..40d77064 100644
--- a/regress/mdoc/Pp/arg.out_lint
+++ b/regress/mdoc/Pp/arg.out_lint
@@ -1,3 +1,3 @@
-mandoc: arg.in:12:5: ERROR: skipping all arguments: br drop this
-mandoc: arg.in:14:8: ERROR: skipping excess arguments: sp ... drop this
-mandoc: arg.in:10:2: ERROR: skipping all arguments: Pp drop
+mandoc: arg.in:13:5: ERROR: skipping all arguments: br drop this
+mandoc: arg.in:15:8: ERROR: skipping excess arguments: sp ... drop this
+mandoc: arg.in:11:2: ERROR: skipping all arguments: Pp drop
diff --git a/regress/mdoc/Pp/arg.out_markdown b/regress/mdoc/Pp/arg.out_markdown
index 17c7753a..0b06ac9e 100644
--- a/regress/mdoc/Pp/arg.out_markdown
+++ b/regress/mdoc/Pp/arg.out_markdown
@@ -13,4 +13,6 @@ line 3
line 4
-OpenBSD - July 4, 2017
+final text
+
+OpenBSD - April 6, 2020
diff --git a/regress/mdoc/Pp/arg.out_tag b/regress/mdoc/Pp/arg.out_tag
new file mode 100644
index 00000000..443b1be2
--- /dev/null
+++ b/regress/mdoc/Pp/arg.out_tag
@@ -0,0 +1,4 @@
+NAME 3
+DESCRIPTION 6
+first 9
+last 14
diff --git a/regress/mdoc/Tg/Makefile b/regress/mdoc/Tg/Makefile
index 7f538766..d67ec5af 100644
--- a/regress/mdoc/Tg/Makefile
+++ b/regress/mdoc/Tg/Makefile
@@ -1,8 +1,10 @@
-# $OpenBSD: Makefile,v 1.1 2020/03/13 00:31:06 schwarze Exp $
+# $OpenBSD: Makefile,v 1.2 2020/04/06 09:55:50 schwarze Exp $
-REGRESS_TARGETS = warn
-TAG_TARGETS = warn
+REGRESS_TARGETS = column list warn
+TAG_TARGETS = column list warn
LINT_TARGETS = warn
-HTML_TARGETS = warn
+HTML_TARGETS = column list warn
+
+SKIP_TMAN = column
.include <bsd.regress.mk>
diff --git a/regress/mdoc/Tg/column.in b/regress/mdoc/Tg/column.in
new file mode 100644
index 00000000..50b0d1f0
--- /dev/null
+++ b/regress/mdoc/Tg/column.in
@@ -0,0 +1,17 @@
+.\" $OpenBSD: column.in,v 1.1 2020/04/06 09:55:50 schwarze Exp $
+.Dd $Mdocdate: April 6 2020 $
+.Dt TG-COLUMN 1
+.Os
+.Sh NAME
+.Nm Tg-column
+.Nd explicit tagging of column lists and rows
+.Sh DESCRIPTION
+BEGINTEST
+.Tg list
+.Bl -column one two
+.Tg row1
+.It one Ta two
+.Tg row2
+.It 1 2
+.El
+ENDTEST
diff --git a/regress/mdoc/Tg/column.out_ascii b/regress/mdoc/Tg/column.out_ascii
new file mode 100644
index 00000000..3051005b
--- /dev/null
+++ b/regress/mdoc/Tg/column.out_ascii
@@ -0,0 +1,13 @@
+TG-COLUMN(1) General Commands Manual TG-COLUMN(1)
+
+NNAAMMEE
+ TTgg--ccoolluummnn - explicit tagging of column lists and rows
+
+DDEESSCCRRIIPPTTIIOONN
+ BEGINTEST
+
+ one two
+ 1 2
+ ENDTEST
+
+OpenBSD April 6, 2020 OpenBSD
diff --git a/regress/mdoc/Tg/column.out_html b/regress/mdoc/Tg/column.out_html
new file mode 100644
index 00000000..8374fb9c
--- /dev/null
+++ b/regress/mdoc/Tg/column.out_html
@@ -0,0 +1,10 @@
+<table class="Bl-column" id="list">
+ <tr id="row1">
+ <td>one</td>
+ <td>two</td>
+ </tr>
+ <tr id="row2">
+ <td>1</td>
+ <td>2</td>
+ </tr>
+</table>
diff --git a/regress/mdoc/Tg/column.out_markdown b/regress/mdoc/Tg/column.out_markdown
new file mode 100644
index 00000000..a6820fd0
--- /dev/null
+++ b/regress/mdoc/Tg/column.out_markdown
@@ -0,0 +1,16 @@
+TG-COLUMN(1) - General Commands Manual
+
+# NAME
+
+**Tg-column** - explicit tagging of column lists and rows
+
+# DESCRIPTION
+
+BEGINTEST
+
+ one two
+ 1 2
+
+ENDTEST
+
+OpenBSD - April 6, 2020
diff --git a/regress/mdoc/Tg/column.out_tag b/regress/mdoc/Tg/column.out_tag
new file mode 100644
index 00000000..f34a94b9
--- /dev/null
+++ b/regress/mdoc/Tg/column.out_tag
@@ -0,0 +1,5 @@
+NAME 3
+DESCRIPTION 6
+list 8
+row1 9
+row2 10
diff --git a/regress/mdoc/Tg/list.in b/regress/mdoc/Tg/list.in
new file mode 100644
index 00000000..d89cb865
--- /dev/null
+++ b/regress/mdoc/Tg/list.in
@@ -0,0 +1,22 @@
+.\" $OpenBSD: list.in,v 1.1 2020/04/06 09:55:50 schwarze Exp $
+.Dd $Mdocdate: April 6 2020 $
+.Dt TG-LIST 1
+.Os
+.Sh NAME
+.Nm Tg-list
+.Nd explicit tagging of lists and list elements
+.Sh DESCRIPTION
+BEGINTEST
+.Tg dashlist
+.Bl -dash
+.Tg dashitem
+.It
+item
+.El
+.Tg taglist
+.Bl -tag -width Ds
+.Tg tagitem
+.It tag
+text
+.El
+ENDTEST
diff --git a/regress/mdoc/Tg/list.out_ascii b/regress/mdoc/Tg/list.out_ascii
new file mode 100644
index 00000000..adc476e0
--- /dev/null
+++ b/regress/mdoc/Tg/list.out_ascii
@@ -0,0 +1,14 @@
+TG-LIST(1) General Commands Manual TG-LIST(1)
+
+NNAAMMEE
+ TTgg--lliisstt - explicit tagging of lists and list elements
+
+DDEESSCCRRIIPPTTIIOONN
+ BEGINTEST
+
+ -- item
+
+ tag text
+ ENDTEST
+
+OpenBSD April 6, 2020 OpenBSD
diff --git a/regress/mdoc/Tg/list.out_html b/regress/mdoc/Tg/list.out_html
new file mode 100644
index 00000000..001c994b
--- /dev/null
+++ b/regress/mdoc/Tg/list.out_html
@@ -0,0 +1,7 @@
+<ul class="Bl-dash" id="dashlist">
+ <li id="dashitem"><a class="permalink" href="#dashitem">item</a></li>
+</ul>
+<dl class="Bl-tag" id="taglist">
+ <dt id="tagitem"><a class="permalink" href="#tagitem">tag</a></dt>
+ <dd>text</dd>
+</dl>
diff --git a/regress/mdoc/Tg/list.out_markdown b/regress/mdoc/Tg/list.out_markdown
new file mode 100644
index 00000000..836e5cab
--- /dev/null
+++ b/regress/mdoc/Tg/list.out_markdown
@@ -0,0 +1,19 @@
+TG-LIST(1) - General Commands Manual
+
+# NAME
+
+**Tg-list** - explicit tagging of lists and list elements
+
+# DESCRIPTION
+
+BEGINTEST
+
+- item
+
+tag
+
+> text
+
+ENDTEST
+
+OpenBSD - April 6, 2020
diff --git a/regress/mdoc/Tg/list.out_tag b/regress/mdoc/Tg/list.out_tag
new file mode 100644
index 00000000..48eb6d44
--- /dev/null
+++ b/regress/mdoc/Tg/list.out_tag
@@ -0,0 +1,6 @@
+NAME 3
+DESCRIPTION 6
+dashlist 8
+dashitem 9
+taglist 10
+tagitem 11
diff --git a/roff.c b/roff.c
index 70cf4f37..2de0b7c3 100644
--- a/roff.c
+++ b/roff.c
@@ -1,4 +1,4 @@
-/* $Id: roff.c,v 1.372 2020/04/03 11:35:01 schwarze Exp $ */
+/* $Id: roff.c,v 1.373 2020/04/06 10:16:17 schwarze Exp $ */
/*
* Copyright (c) 2010-2015, 2017-2020 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -1123,7 +1123,13 @@ roff_node_transparent(struct roff_node *n)
return 0;
if (n->type == ROFFT_COMMENT || n->flags & NODE_NOPRT)
return 1;
- switch (n->tok) {
+ return roff_tok_transparent(n->tok);
+}
+
+int
+roff_tok_transparent(enum roff_tok tok)
+{
+ switch (tok) {
case ROFF_ft:
case ROFF_ll:
case ROFF_mc:
diff --git a/roff.h b/roff.h
index d1e05db5..e2ccc373 100644
--- a/roff.h
+++ b/roff.h
@@ -1,7 +1,7 @@
-/* $Id: roff.h,v 1.72 2020/02/27 21:43:45 schwarze Exp $ */
+/* $Id: roff.h,v 1.73 2020/04/06 10:16:18 schwarze Exp $ */
/*
- * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013-2015, 2017-2020 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -557,3 +557,4 @@ struct roff_node *roff_node_child(struct roff_node *);
struct roff_node *roff_node_next(struct roff_node *);
struct roff_node *roff_node_prev(struct roff_node *);
int roff_node_transparent(struct roff_node *);
+int roff_tok_transparent(enum roff_tok);