summaryrefslogtreecommitdiff
path: root/regress/usr.bin/mandoc/mdoc
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2020-03-13 00:31:07 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2020-03-13 00:31:07 +0000
commit5a8dc5b083d2bade011c458f35eb196bcc221b20 (patch)
treea0cd3ee8339d3a6ae418ef4dde4c2f1257b682e3 /regress/usr.bin/mandoc/mdoc
parentc36c15a6ac30c2c450f6854e51dd494932b163d6 (diff)
Split tagging into a validation part including prioritization
in tag.{h,c} and {mdoc,man}_validate.c and into a formatting part including command line argument checking in term_tag.{h,c}, html.c, and {mdoc|man}_{term|html}.c. Immediate functional benefits include: * Improved prioritization of automatic tags for .Em and .Sy. * Avoiding bogus automatic tags when .Em, .Fn, or .Sy are explicitly tagged. * Explicit tagging of .Er and .Fl now works in HTML output. * Automatic tagging of .IP and .TP now works in HTML output. But mainly, this patch provides clean earth to build further improvements on. Technical changes: * Main program: Write a tag file for ASCII and UTF-8 output only. * All formatters: There is no more need to delay writing the tags. * mdoc(7)+man(7) formatters: No more need for elaborate syntax tree inspection. * HTML formatter: If available, use the "string" attribute as the tag. * HTML formatter: New function to write permalinks, to reduce code duplication. Style cleanup in the vicinity while here: * mdoc(7) terminal formatter: To set up bold font for children, defer to termp_bold_pre() rather than calling term_fontpush() manually. * mdoc(7) terminal formatter: Garbage collect some duplicate functions. * mdoc(7) HTML formatter: Unify <code> handling, delete redundant functions. * Where possible, use switch statements rather than if cascades. * Get rid of some more Yoda notation. The necessity for such changes was first discussed with kn@, but i didn't bother him with a request to review the resulting -673/+782 line patch.
Diffstat (limited to 'regress/usr.bin/mandoc/mdoc')
-rw-r--r--regress/usr.bin/mandoc/mdoc/Cm/Makefile6
-rw-r--r--regress/usr.bin/mandoc/mdoc/Cm/tag.in21
-rw-r--r--regress/usr.bin/mandoc/mdoc/Cm/tag.out_ascii17
-rw-r--r--regress/usr.bin/mandoc/mdoc/Cm/tag.out_html9
-rw-r--r--regress/usr.bin/mandoc/mdoc/Cm/tag.out_markdown23
-rw-r--r--regress/usr.bin/mandoc/mdoc/Cm/tag.out_tag4
-rw-r--r--regress/usr.bin/mandoc/mdoc/Dv/Makefile6
-rw-r--r--regress/usr.bin/mandoc/mdoc/Dv/tag.in21
-rw-r--r--regress/usr.bin/mandoc/mdoc/Dv/tag.out_ascii17
-rw-r--r--regress/usr.bin/mandoc/mdoc/Dv/tag.out_html9
-rw-r--r--regress/usr.bin/mandoc/mdoc/Dv/tag.out_markdown23
-rw-r--r--regress/usr.bin/mandoc/mdoc/Dv/tag.out_tag4
-rw-r--r--regress/usr.bin/mandoc/mdoc/Em/Makefile6
-rw-r--r--regress/usr.bin/mandoc/mdoc/Em/tag.in23
-rw-r--r--regress/usr.bin/mandoc/mdoc/Em/tag.out_ascii17
-rw-r--r--regress/usr.bin/mandoc/mdoc/Em/tag.out_html10
-rw-r--r--regress/usr.bin/mandoc/mdoc/Em/tag.out_markdown25
-rw-r--r--regress/usr.bin/mandoc/mdoc/Em/tag.out_tag5
-rw-r--r--regress/usr.bin/mandoc/mdoc/Er/Makefile6
-rw-r--r--regress/usr.bin/mandoc/mdoc/Er/tag.in21
-rw-r--r--regress/usr.bin/mandoc/mdoc/Er/tag.out_ascii16
-rw-r--r--regress/usr.bin/mandoc/mdoc/Er/tag.out_html12
-rw-r--r--regress/usr.bin/mandoc/mdoc/Er/tag.out_markdown25
-rw-r--r--regress/usr.bin/mandoc/mdoc/Er/tag.out_tag2
-rw-r--r--regress/usr.bin/mandoc/mdoc/Ev/Makefile6
-rw-r--r--regress/usr.bin/mandoc/mdoc/Ev/tag.in21
-rw-r--r--regress/usr.bin/mandoc/mdoc/Ev/tag.out_ascii17
-rw-r--r--regress/usr.bin/mandoc/mdoc/Ev/tag.out_html9
-rw-r--r--regress/usr.bin/mandoc/mdoc/Ev/tag.out_markdown23
-rw-r--r--regress/usr.bin/mandoc/mdoc/Ev/tag.out_tag4
-rw-r--r--regress/usr.bin/mandoc/mdoc/Fl/Makefile7
-rw-r--r--regress/usr.bin/mandoc/mdoc/Fl/tag.in21
-rw-r--r--regress/usr.bin/mandoc/mdoc/Fl/tag.out_ascii17
-rw-r--r--regress/usr.bin/mandoc/mdoc/Fl/tag.out_html8
-rw-r--r--regress/usr.bin/mandoc/mdoc/Fl/tag.out_markdown23
-rw-r--r--regress/usr.bin/mandoc/mdoc/Fl/tag.out_tag4
-rw-r--r--regress/usr.bin/mandoc/mdoc/Fo/Makefile6
-rw-r--r--regress/usr.bin/mandoc/mdoc/Fo/tag.in29
-rw-r--r--regress/usr.bin/mandoc/mdoc/Fo/tag.out_ascii17
-rw-r--r--regress/usr.bin/mandoc/mdoc/Fo/tag.out_html9
-rw-r--r--regress/usr.bin/mandoc/mdoc/Fo/tag.out_markdown27
-rw-r--r--regress/usr.bin/mandoc/mdoc/Fo/tag.out_tag4
-rw-r--r--regress/usr.bin/mandoc/mdoc/Ic/Makefile6
-rw-r--r--regress/usr.bin/mandoc/mdoc/Ic/tag.in21
-rw-r--r--regress/usr.bin/mandoc/mdoc/Ic/tag.out_ascii17
-rw-r--r--regress/usr.bin/mandoc/mdoc/Ic/tag.out_html9
-rw-r--r--regress/usr.bin/mandoc/mdoc/Ic/tag.out_markdown23
-rw-r--r--regress/usr.bin/mandoc/mdoc/Ic/tag.out_tag4
-rw-r--r--regress/usr.bin/mandoc/mdoc/Li/Makefile6
-rw-r--r--regress/usr.bin/mandoc/mdoc/Li/tag.in21
-rw-r--r--regress/usr.bin/mandoc/mdoc/Li/tag.out_ascii17
-rw-r--r--regress/usr.bin/mandoc/mdoc/Li/tag.out_html9
-rw-r--r--regress/usr.bin/mandoc/mdoc/Li/tag.out_markdown23
-rw-r--r--regress/usr.bin/mandoc/mdoc/Li/tag.out_tag4
-rw-r--r--regress/usr.bin/mandoc/mdoc/Makefile4
-rw-r--r--regress/usr.bin/mandoc/mdoc/Ms/Makefile6
-rw-r--r--regress/usr.bin/mandoc/mdoc/Ms/tag.in21
-rw-r--r--regress/usr.bin/mandoc/mdoc/Ms/tag.out_ascii17
-rw-r--r--regress/usr.bin/mandoc/mdoc/Ms/tag.out_html9
-rw-r--r--regress/usr.bin/mandoc/mdoc/Ms/tag.out_markdown23
-rw-r--r--regress/usr.bin/mandoc/mdoc/Ms/tag.out_tag4
-rw-r--r--regress/usr.bin/mandoc/mdoc/No/Makefile6
-rw-r--r--regress/usr.bin/mandoc/mdoc/No/punct.out_lint1
-rw-r--r--regress/usr.bin/mandoc/mdoc/No/tag.in21
-rw-r--r--regress/usr.bin/mandoc/mdoc/No/tag.out_ascii17
-rw-r--r--regress/usr.bin/mandoc/mdoc/No/tag.out_html9
-rw-r--r--regress/usr.bin/mandoc/mdoc/No/tag.out_markdown23
-rw-r--r--regress/usr.bin/mandoc/mdoc/No/tag.out_tag4
-rw-r--r--regress/usr.bin/mandoc/mdoc/Sy/Makefile6
-rw-r--r--regress/usr.bin/mandoc/mdoc/Sy/tag.in23
-rw-r--r--regress/usr.bin/mandoc/mdoc/Sy/tag.out_ascii17
-rw-r--r--regress/usr.bin/mandoc/mdoc/Sy/tag.out_html10
-rw-r--r--regress/usr.bin/mandoc/mdoc/Sy/tag.out_markdown25
-rw-r--r--regress/usr.bin/mandoc/mdoc/Sy/tag.out_tag5
-rw-r--r--regress/usr.bin/mandoc/mdoc/Tg/Makefile8
-rw-r--r--regress/usr.bin/mandoc/mdoc/Tg/warn.in34
-rw-r--r--regress/usr.bin/mandoc/mdoc/Tg/warn.out_ascii19
-rw-r--r--regress/usr.bin/mandoc/mdoc/Tg/warn.out_html11
-rw-r--r--regress/usr.bin/mandoc/mdoc/Tg/warn.out_lint6
-rw-r--r--regress/usr.bin/mandoc/mdoc/Tg/warn.out_markdown30
-rw-r--r--regress/usr.bin/mandoc/mdoc/Tg/warn.out_tag5
81 files changed, 1078 insertions, 26 deletions
diff --git a/regress/usr.bin/mandoc/mdoc/Cm/Makefile b/regress/usr.bin/mandoc/mdoc/Cm/Makefile
index 6681facf14a..7bc3fc20125 100644
--- a/regress/usr.bin/mandoc/mdoc/Cm/Makefile
+++ b/regress/usr.bin/mandoc/mdoc/Cm/Makefile
@@ -1,6 +1,8 @@
-# $OpenBSD: Makefile,v 1.6 2017/05/30 16:21:08 schwarze Exp $
+# $OpenBSD: Makefile,v 1.7 2020/03/13 00:31:05 schwarze Exp $
-REGRESS_TARGETS = basic font noarg punct
+REGRESS_TARGETS = basic font noarg punct tag
+TAG_TARGETS = tag
LINT_TARGETS = noarg
+HTML_TARGETS = tag
.include <bsd.regress.mk>
diff --git a/regress/usr.bin/mandoc/mdoc/Cm/tag.in b/regress/usr.bin/mandoc/mdoc/Cm/tag.in
new file mode 100644
index 00000000000..3db1d1e0d65
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Cm/tag.in
@@ -0,0 +1,21 @@
+.\" $OpenBSD: tag.in,v 1.1 2020/03/13 00:31:05 schwarze Exp $
+.Dd $Mdocdate: March 13 2020 $
+.Dt CM-TAG 1
+.Os
+.Sh NAME
+.Nm Cm-tag
+.Nd tagging of command modifier macros
+.Sh DESCRIPTION
+BEGINTEST
+.Bl -tag -width Ds
+.It Cm one | two
+text
+.It Xo
+.Cm three
+.Xc
+text
+.El
+.Tg
+.Cm four
+.Pp
+ENDTEST
diff --git a/regress/usr.bin/mandoc/mdoc/Cm/tag.out_ascii b/regress/usr.bin/mandoc/mdoc/Cm/tag.out_ascii
new file mode 100644
index 00000000000..071408c7676
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Cm/tag.out_ascii
@@ -0,0 +1,17 @@
+CM-TAG(1) General Commands Manual CM-TAG(1)
+
+NNAAMMEE
+ CCmm--ttaagg - tagging of command modifier macros
+
+DDEESSCCRRIIPPTTIIOONN
+ BEGINTEST
+
+ oonnee | ttwwoo
+ text
+
+ tthhrreeee text
+ ffoouurr
+
+ ENDTEST
+
+OpenBSD March 13, 2020 OpenBSD
diff --git a/regress/usr.bin/mandoc/mdoc/Cm/tag.out_html b/regress/usr.bin/mandoc/mdoc/Cm/tag.out_html
new file mode 100644
index 00000000000..a140fe3e386
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Cm/tag.out_html
@@ -0,0 +1,9 @@
+<dl class="Bl-tag">
+ <dt><a class="permalink" href="#one"><code class="Cm" id="one">one</code></a>
+ |
+ <a class="permalink" href="#two"><code class="Cm" id="two">two</code></a></dt>
+ <dd>text</dd>
+ <dt><a class="permalink" href="#three"><code class="Cm" id="three">three</code></a></dt>
+ <dd>text</dd>
+</dl>
+<a class="permalink" href="#four"><code class="Cm" id="four">four</code></a>
diff --git a/regress/usr.bin/mandoc/mdoc/Cm/tag.out_markdown b/regress/usr.bin/mandoc/mdoc/Cm/tag.out_markdown
new file mode 100644
index 00000000000..893a8fe5b2b
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Cm/tag.out_markdown
@@ -0,0 +1,23 @@
+CM-TAG(1) - General Commands Manual
+
+# NAME
+
+**Cm-tag** - tagging of command modifier macros
+
+# DESCRIPTION
+
+BEGINTEST
+
+**one** | **two**
+
+> text
+
+**three**
+
+> text
+
+**four**
+
+ENDTEST
+
+OpenBSD - March 13, 2020
diff --git a/regress/usr.bin/mandoc/mdoc/Cm/tag.out_tag b/regress/usr.bin/mandoc/mdoc/Cm/tag.out_tag
new file mode 100644
index 00000000000..94f0cfb2c0d
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Cm/tag.out_tag
@@ -0,0 +1,4 @@
+one 9
+two 9
+three 12
+four 13
diff --git a/regress/usr.bin/mandoc/mdoc/Dv/Makefile b/regress/usr.bin/mandoc/mdoc/Dv/Makefile
index bbeabf5bc4f..979e182605a 100644
--- a/regress/usr.bin/mandoc/mdoc/Dv/Makefile
+++ b/regress/usr.bin/mandoc/mdoc/Dv/Makefile
@@ -1,6 +1,8 @@
-# $OpenBSD: Makefile,v 1.4 2017/03/08 22:53:35 schwarze Exp $
+# $OpenBSD: Makefile,v 1.5 2020/03/13 00:31:05 schwarze Exp $
-REGRESS_TARGETS = font noarg
+REGRESS_TARGETS = font noarg tag
+TAG_TARGETS = tag
LINT_TARGETS = noarg
+HTML_TARGETS = tag
.include <bsd.regress.mk>
diff --git a/regress/usr.bin/mandoc/mdoc/Dv/tag.in b/regress/usr.bin/mandoc/mdoc/Dv/tag.in
new file mode 100644
index 00000000000..b6c79ad14d9
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Dv/tag.in
@@ -0,0 +1,21 @@
+.\" $OpenBSD: tag.in,v 1.1 2020/03/13 00:31:05 schwarze Exp $
+.Dd $Mdocdate: March 13 2020 $
+.Dt DV-TAG 1
+.Os
+.Sh NAME
+.Nm Dv-tag
+.Nd tagging of defined variable macros
+.Sh DESCRIPTION
+BEGINTEST
+.Bl -tag -width Ds
+.It Dv one | two
+text
+.It Xo
+.Dv three
+.Xc
+text
+.El
+.Tg
+.Dv four
+.Pp
+ENDTEST
diff --git a/regress/usr.bin/mandoc/mdoc/Dv/tag.out_ascii b/regress/usr.bin/mandoc/mdoc/Dv/tag.out_ascii
new file mode 100644
index 00000000000..119e3509891
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Dv/tag.out_ascii
@@ -0,0 +1,17 @@
+DV-TAG(1) General Commands Manual DV-TAG(1)
+
+NNAAMMEE
+ DDvv--ttaagg - tagging of defined variable macros
+
+DDEESSCCRRIIPPTTIIOONN
+ BEGINTEST
+
+ one | two
+ text
+
+ three text
+ four
+
+ ENDTEST
+
+OpenBSD March 13, 2020 OpenBSD
diff --git a/regress/usr.bin/mandoc/mdoc/Dv/tag.out_html b/regress/usr.bin/mandoc/mdoc/Dv/tag.out_html
new file mode 100644
index 00000000000..cee78340802
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Dv/tag.out_html
@@ -0,0 +1,9 @@
+<dl class="Bl-tag">
+ <dt><a class="permalink" href="#one"><code class="Dv" id="one">one</code></a>
+ |
+ <a class="permalink" href="#two"><code class="Dv" id="two">two</code></a></dt>
+ <dd>text</dd>
+ <dt><a class="permalink" href="#three"><code class="Dv" id="three">three</code></a></dt>
+ <dd>text</dd>
+</dl>
+<a class="permalink" href="#four"><code class="Dv" id="four">four</code></a>
diff --git a/regress/usr.bin/mandoc/mdoc/Dv/tag.out_markdown b/regress/usr.bin/mandoc/mdoc/Dv/tag.out_markdown
new file mode 100644
index 00000000000..29b454bbd23
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Dv/tag.out_markdown
@@ -0,0 +1,23 @@
+DV-TAG(1) - General Commands Manual
+
+# NAME
+
+**Dv-tag** - tagging of defined variable macros
+
+# DESCRIPTION
+
+BEGINTEST
+
+`one` | `two`
+
+> text
+
+`three`
+
+> text
+
+`four`
+
+ENDTEST
+
+OpenBSD - March 13, 2020
diff --git a/regress/usr.bin/mandoc/mdoc/Dv/tag.out_tag b/regress/usr.bin/mandoc/mdoc/Dv/tag.out_tag
new file mode 100644
index 00000000000..94f0cfb2c0d
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Dv/tag.out_tag
@@ -0,0 +1,4 @@
+one 9
+two 9
+three 12
+four 13
diff --git a/regress/usr.bin/mandoc/mdoc/Em/Makefile b/regress/usr.bin/mandoc/mdoc/Em/Makefile
index ced9d1f0852..2b500444863 100644
--- a/regress/usr.bin/mandoc/mdoc/Em/Makefile
+++ b/regress/usr.bin/mandoc/mdoc/Em/Makefile
@@ -1,6 +1,8 @@
-# $OpenBSD: Makefile,v 1.5 2017/03/08 22:53:35 schwarze Exp $
+# $OpenBSD: Makefile,v 1.6 2020/03/13 00:31:05 schwarze Exp $
-REGRESS_TARGETS = font noarg punct
+REGRESS_TARGETS = font noarg punct tag
+TAG_TARGETS = tag
LINT_TARGETS = noarg punct
+HTML_TARGETS = tag
.include <bsd.regress.mk>
diff --git a/regress/usr.bin/mandoc/mdoc/Em/tag.in b/regress/usr.bin/mandoc/mdoc/Em/tag.in
new file mode 100644
index 00000000000..70e6eb447ec
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Em/tag.in
@@ -0,0 +1,23 @@
+.\" $OpenBSD: tag.in,v 1.1 2020/03/13 00:31:05 schwarze Exp $
+.Dd $Mdocdate: March 13 2020 $
+.Dt EM-TAG 1
+.Os
+.Sh NAME
+.Nm Em-tag
+.Nd tagging of emphasis macros
+.Sh DESCRIPTION
+BEGINTEST
+.Bl -tag -width Ds
+.It Em one | two
+text
+.It Xo
+.Em three
+.Xc
+text
+.El
+.Em four
+.Em one
+.Tg explicit
+.Em five
+.Pp
+ENDTEST
diff --git a/regress/usr.bin/mandoc/mdoc/Em/tag.out_ascii b/regress/usr.bin/mandoc/mdoc/Em/tag.out_ascii
new file mode 100644
index 00000000000..74f8212bf71
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Em/tag.out_ascii
@@ -0,0 +1,17 @@
+EM-TAG(1) General Commands Manual EM-TAG(1)
+
+NNAAMMEE
+ EEmm--ttaagg - tagging of emphasis macros
+
+DDEESSCCRRIIPPTTIIOONN
+ BEGINTEST
+
+ _o_n_e | _t_w_o
+ text
+
+ _t_h_r_e_e text
+ _f_o_u_r _o_n_e _f_i_v_e
+
+ ENDTEST
+
+OpenBSD March 13, 2020 OpenBSD
diff --git a/regress/usr.bin/mandoc/mdoc/Em/tag.out_html b/regress/usr.bin/mandoc/mdoc/Em/tag.out_html
new file mode 100644
index 00000000000..4046673f833
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Em/tag.out_html
@@ -0,0 +1,10 @@
+<dl class="Bl-tag">
+ <dt><a class="permalink" href="#one"><i class="Em" id="one">one</i></a> |
+ <a class="permalink" href="#two"><i class="Em" id="two">two</i></a></dt>
+ <dd>text</dd>
+ <dt><a class="permalink" href="#three"><i class="Em" id="three">three</i></a></dt>
+ <dd>text</dd>
+</dl>
+<a class="permalink" href="#four"><i class="Em" id="four">four</i></a>
+ <i class="Em">one</i>
+ <a class="permalink" href="#explicit"><i class="Em" id="explicit">five</i></a>
diff --git a/regress/usr.bin/mandoc/mdoc/Em/tag.out_markdown b/regress/usr.bin/mandoc/mdoc/Em/tag.out_markdown
new file mode 100644
index 00000000000..4c10715982f
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Em/tag.out_markdown
@@ -0,0 +1,25 @@
+EM-TAG(1) - General Commands Manual
+
+# NAME
+
+**Em-tag** - tagging of emphasis macros
+
+# DESCRIPTION
+
+BEGINTEST
+
+*one* | *two*
+
+> text
+
+*three*
+
+> text
+
+*four*
+*one*
+*five*
+
+ENDTEST
+
+OpenBSD - March 13, 2020
diff --git a/regress/usr.bin/mandoc/mdoc/Em/tag.out_tag b/regress/usr.bin/mandoc/mdoc/Em/tag.out_tag
new file mode 100644
index 00000000000..c2fbaf59646
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Em/tag.out_tag
@@ -0,0 +1,5 @@
+one 9
+two 9
+three 12
+four 13
+explicit 13
diff --git a/regress/usr.bin/mandoc/mdoc/Er/Makefile b/regress/usr.bin/mandoc/mdoc/Er/Makefile
index 78da864da6f..55f6cc761f8 100644
--- a/regress/usr.bin/mandoc/mdoc/Er/Makefile
+++ b/regress/usr.bin/mandoc/mdoc/Er/Makefile
@@ -1,6 +1,8 @@
-# $OpenBSD: Makefile,v 1.6 2017/03/08 22:53:35 schwarze Exp $
+# $OpenBSD: Makefile,v 1.7 2020/03/13 00:31:05 schwarze Exp $
-REGRESS_TARGETS = noarg font
+REGRESS_TARGETS = noarg font tag
+TAG_TARGETS = tag
LINT_TARGETS = noarg
+HTML_TARGETS = tag
.include <bsd.regress.mk>
diff --git a/regress/usr.bin/mandoc/mdoc/Er/tag.in b/regress/usr.bin/mandoc/mdoc/Er/tag.in
new file mode 100644
index 00000000000..4227648b69f
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Er/tag.in
@@ -0,0 +1,21 @@
+.\" $OpenBSD: tag.in,v 1.1 2020/03/13 00:31:05 schwarze Exp $
+.Dd $Mdocdate: March 13 2020 $
+.Dt ER-TAG 1
+.Os
+.Sh NAME
+.Nm Er-tag
+.Nd tagging of error number macros
+.Sh DESCRIPTION
+BEGINTEST
+.Bl -tag -width Ds
+.It Er one
+text
+.El
+.Tg
+.Er two
+.Sh ERRORS
+.Bl -tag -width Er
+.It Bq Er ENOENT
+text
+.El
+ENDTEST
diff --git a/regress/usr.bin/mandoc/mdoc/Er/tag.out_ascii b/regress/usr.bin/mandoc/mdoc/Er/tag.out_ascii
new file mode 100644
index 00000000000..62dbf9ca792
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Er/tag.out_ascii
@@ -0,0 +1,16 @@
+ER-TAG(1) General Commands Manual ER-TAG(1)
+
+NNAAMMEE
+ EErr--ttaagg - tagging of error number macros
+
+DDEESSCCRRIIPPTTIIOONN
+ BEGINTEST
+
+ one text
+ two
+
+EERRRROORRSS
+ [ENOENT] text
+ ENDTEST
+
+OpenBSD March 13, 2020 OpenBSD
diff --git a/regress/usr.bin/mandoc/mdoc/Er/tag.out_html b/regress/usr.bin/mandoc/mdoc/Er/tag.out_html
new file mode 100644
index 00000000000..a2c2978f2dc
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Er/tag.out_html
@@ -0,0 +1,12 @@
+<dl class="Bl-tag">
+ <dt><code class="Er">one</code></dt>
+ <dd>text</dd>
+</dl>
+<a class="permalink" href="#two"><code class="Er" id="two">two</code></a>
+</section>
+<section class="Sh">
+<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1>
+<dl class="Bl-tag">
+ <dt>[<a class="permalink" href="#ENOENT"><code class="Er" id="ENOENT">ENOENT</code></a>]</dt>
+ <dd>text</dd>
+</dl>
diff --git a/regress/usr.bin/mandoc/mdoc/Er/tag.out_markdown b/regress/usr.bin/mandoc/mdoc/Er/tag.out_markdown
new file mode 100644
index 00000000000..d11eb4b9383
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Er/tag.out_markdown
@@ -0,0 +1,25 @@
+ER-TAG(1) - General Commands Manual
+
+# NAME
+
+**Er-tag** - tagging of error number macros
+
+# DESCRIPTION
+
+BEGINTEST
+
+`one`
+
+> text
+
+`two`
+
+# ERRORS
+
+\[`ENOENT`]
+
+> text
+
+ENDTEST
+
+OpenBSD - March 13, 2020
diff --git a/regress/usr.bin/mandoc/mdoc/Er/tag.out_tag b/regress/usr.bin/mandoc/mdoc/Er/tag.out_tag
new file mode 100644
index 00000000000..b00a67187e0
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Er/tag.out_tag
@@ -0,0 +1,2 @@
+two 10
+ENOENT 13
diff --git a/regress/usr.bin/mandoc/mdoc/Ev/Makefile b/regress/usr.bin/mandoc/mdoc/Ev/Makefile
index bbeabf5bc4f..979e182605a 100644
--- a/regress/usr.bin/mandoc/mdoc/Ev/Makefile
+++ b/regress/usr.bin/mandoc/mdoc/Ev/Makefile
@@ -1,6 +1,8 @@
-# $OpenBSD: Makefile,v 1.4 2017/03/08 22:53:35 schwarze Exp $
+# $OpenBSD: Makefile,v 1.5 2020/03/13 00:31:05 schwarze Exp $
-REGRESS_TARGETS = font noarg
+REGRESS_TARGETS = font noarg tag
+TAG_TARGETS = tag
LINT_TARGETS = noarg
+HTML_TARGETS = tag
.include <bsd.regress.mk>
diff --git a/regress/usr.bin/mandoc/mdoc/Ev/tag.in b/regress/usr.bin/mandoc/mdoc/Ev/tag.in
new file mode 100644
index 00000000000..2627fdeb9af
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Ev/tag.in
@@ -0,0 +1,21 @@
+.\" $OpenBSD: tag.in,v 1.1 2020/03/13 00:31:05 schwarze Exp $
+.Dd $Mdocdate: March 13 2020 $
+.Dt EV-TAG 1
+.Os
+.Sh NAME
+.Nm Ev-tag
+.Nd tagging of environment variable macros
+.Sh DESCRIPTION
+BEGINTEST
+.Bl -tag -width Ds
+.It Ev one | two
+text
+.It Xo
+.Ev three
+.Xc
+text
+.El
+.Tg
+.Ev four
+.Pp
+ENDTEST
diff --git a/regress/usr.bin/mandoc/mdoc/Ev/tag.out_ascii b/regress/usr.bin/mandoc/mdoc/Ev/tag.out_ascii
new file mode 100644
index 00000000000..5569d1c8e79
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Ev/tag.out_ascii
@@ -0,0 +1,17 @@
+EV-TAG(1) General Commands Manual EV-TAG(1)
+
+NNAAMMEE
+ EEvv--ttaagg - tagging of environment variable macros
+
+DDEESSCCRRIIPPTTIIOONN
+ BEGINTEST
+
+ one | two
+ text
+
+ three text
+ four
+
+ ENDTEST
+
+OpenBSD March 13, 2020 OpenBSD
diff --git a/regress/usr.bin/mandoc/mdoc/Ev/tag.out_html b/regress/usr.bin/mandoc/mdoc/Ev/tag.out_html
new file mode 100644
index 00000000000..1e1c92b9a2f
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Ev/tag.out_html
@@ -0,0 +1,9 @@
+<dl class="Bl-tag">
+ <dt><a class="permalink" href="#one"><code class="Ev" id="one">one</code></a>
+ |
+ <a class="permalink" href="#two"><code class="Ev" id="two">two</code></a></dt>
+ <dd>text</dd>
+ <dt><a class="permalink" href="#three"><code class="Ev" id="three">three</code></a></dt>
+ <dd>text</dd>
+</dl>
+<a class="permalink" href="#four"><code class="Ev" id="four">four</code></a>
diff --git a/regress/usr.bin/mandoc/mdoc/Ev/tag.out_markdown b/regress/usr.bin/mandoc/mdoc/Ev/tag.out_markdown
new file mode 100644
index 00000000000..f9a6712b19c
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Ev/tag.out_markdown
@@ -0,0 +1,23 @@
+EV-TAG(1) - General Commands Manual
+
+# NAME
+
+**Ev-tag** - tagging of environment variable macros
+
+# DESCRIPTION
+
+BEGINTEST
+
+`one` | `two`
+
+> text
+
+`three`
+
+> text
+
+`four`
+
+ENDTEST
+
+OpenBSD - March 13, 2020
diff --git a/regress/usr.bin/mandoc/mdoc/Ev/tag.out_tag b/regress/usr.bin/mandoc/mdoc/Ev/tag.out_tag
new file mode 100644
index 00000000000..94f0cfb2c0d
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Ev/tag.out_tag
@@ -0,0 +1,4 @@
+one 9
+two 9
+three 12
+four 13
diff --git a/regress/usr.bin/mandoc/mdoc/Fl/Makefile b/regress/usr.bin/mandoc/mdoc/Fl/Makefile
index e4e4a6bc958..c061adef434 100644
--- a/regress/usr.bin/mandoc/mdoc/Fl/Makefile
+++ b/regress/usr.bin/mandoc/mdoc/Fl/Makefile
@@ -1,6 +1,9 @@
-# $OpenBSD: Makefile,v 1.13 2020/02/27 01:25:58 schwarze Exp $
+# $OpenBSD: Makefile,v 1.14 2020/03/13 00:31:06 schwarze Exp $
-REGRESS_TARGETS = font multiarg noarg parsed punct spacing
+REGRESS_TARGETS = font multiarg noarg parsed punct spacing tag
+TAG_TARGETS = tag
LINT_TARGETS = punct
+HTML_TARGETS = tag
+SKIP_TMAN = tag
.include <bsd.regress.mk>
diff --git a/regress/usr.bin/mandoc/mdoc/Fl/tag.in b/regress/usr.bin/mandoc/mdoc/Fl/tag.in
new file mode 100644
index 00000000000..f7e24b9f0d2
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Fl/tag.in
@@ -0,0 +1,21 @@
+.\" $OpenBSD: tag.in,v 1.1 2020/03/13 00:31:06 schwarze Exp $
+.Dd $Mdocdate: March 13 2020 $
+.Dt FL-TAG 1
+.Os
+.Sh NAME
+.Nm Fl-tag
+.Nd tagging of command line option macros
+.Sh DESCRIPTION
+BEGINTEST
+.Bl -tag -width Ds
+.It Fl a | b
+text
+.It Xo
+.Fl c
+.Xc
+text
+.El
+.Tg
+.Fl d
+.Pp
+ENDTEST
diff --git a/regress/usr.bin/mandoc/mdoc/Fl/tag.out_ascii b/regress/usr.bin/mandoc/mdoc/Fl/tag.out_ascii
new file mode 100644
index 00000000000..4fcf803c8c0
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Fl/tag.out_ascii
@@ -0,0 +1,17 @@
+FL-TAG(1) General Commands Manual FL-TAG(1)
+
+NNAAMMEE
+ FFll--ttaagg - tagging of command line option macros
+
+DDEESSCCRRIIPPTTIIOONN
+ BEGINTEST
+
+ --aa | --bb
+ text
+
+ --cc text
+ --dd
+
+ ENDTEST
+
+OpenBSD March 13, 2020 OpenBSD
diff --git a/regress/usr.bin/mandoc/mdoc/Fl/tag.out_html b/regress/usr.bin/mandoc/mdoc/Fl/tag.out_html
new file mode 100644
index 00000000000..f67a30c04d8
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Fl/tag.out_html
@@ -0,0 +1,8 @@
+<dl class="Bl-tag">
+ <dt><a class="permalink" href="#a"><code class="Fl" id="a">-a</code></a> |
+ <a class="permalink" href="#b"><code class="Fl" id="b">-b</code></a></dt>
+ <dd>text</dd>
+ <dt><a class="permalink" href="#c"><code class="Fl" id="c">-c</code></a></dt>
+ <dd>text</dd>
+</dl>
+<a class="permalink" href="#d"><code class="Fl" id="d">-d</code></a>
diff --git a/regress/usr.bin/mandoc/mdoc/Fl/tag.out_markdown b/regress/usr.bin/mandoc/mdoc/Fl/tag.out_markdown
new file mode 100644
index 00000000000..1e7c6f14268
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Fl/tag.out_markdown
@@ -0,0 +1,23 @@
+FL-TAG(1) - General Commands Manual
+
+# NAME
+
+**Fl-tag** - tagging of command line option macros
+
+# DESCRIPTION
+
+BEGINTEST
+
+**-a** | **-b**
+
+> text
+
+**-c**
+
+> text
+
+**-d**
+
+ENDTEST
+
+OpenBSD - March 13, 2020
diff --git a/regress/usr.bin/mandoc/mdoc/Fl/tag.out_tag b/regress/usr.bin/mandoc/mdoc/Fl/tag.out_tag
new file mode 100644
index 00000000000..89a94151c0d
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Fl/tag.out_tag
@@ -0,0 +1,4 @@
+a 9
+b 9
+c 12
+d 13
diff --git a/regress/usr.bin/mandoc/mdoc/Fo/Makefile b/regress/usr.bin/mandoc/mdoc/Fo/Makefile
index 7770e9a1921..ce25ddf345a 100644
--- a/regress/usr.bin/mandoc/mdoc/Fo/Makefile
+++ b/regress/usr.bin/mandoc/mdoc/Fo/Makefile
@@ -1,8 +1,10 @@
-# $OpenBSD: Makefile,v 1.17 2020/02/27 01:25:58 schwarze Exp $
+# $OpenBSD: Makefile,v 1.18 2020/03/13 00:31:06 schwarze Exp $
REGRESS_TARGETS = basic break eos font noarg nohead
-REGRESS_TARGETS += obsolete punct section transp warn
+REGRESS_TARGETS += obsolete punct section tag transp warn
+TAG_TARGETS = tag
LINT_TARGETS = noarg nohead obsolete punct warn
+HTML_TARGETS = tag
# groff-1.22.3 defects:
# - .Fo without an argument prints unbalanced parentheses
diff --git a/regress/usr.bin/mandoc/mdoc/Fo/tag.in b/regress/usr.bin/mandoc/mdoc/Fo/tag.in
new file mode 100644
index 00000000000..29b84ffef57
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Fo/tag.in
@@ -0,0 +1,29 @@
+.\" $OpenBSD: tag.in,v 1.1 2020/03/13 00:31:06 schwarze Exp $
+.Dd $Mdocdate: March 13 2020 $
+.Dt FO-TAG 1
+.Os
+.Sh NAME
+.Nm Fo-tag
+.Nd tagging of function name macros
+.Sh DESCRIPTION
+BEGINTEST
+.Pp
+automatic:
+.Fn first
+and
+.Fn second
+.Pp
+.Fn second
+and
+.Fn first
+.Pp
+explicit:
+.Tg e3
+.Fn third
+and
+.Tg e4
+.Fo fourth
+.Fa void
+.Fc
+.Pp
+ENDTEST
diff --git a/regress/usr.bin/mandoc/mdoc/Fo/tag.out_ascii b/regress/usr.bin/mandoc/mdoc/Fo/tag.out_ascii
new file mode 100644
index 00000000000..505c0b7a2b9
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Fo/tag.out_ascii
@@ -0,0 +1,17 @@
+FO-TAG(1) General Commands Manual FO-TAG(1)
+
+NNAAMMEE
+ FFoo--ttaagg - tagging of function name macros
+
+DDEESSCCRRIIPPTTIIOONN
+ BEGINTEST
+
+ automatic: ffiirrsstt() and sseeccoonndd()
+
+ sseeccoonndd() and ffiirrsstt()
+
+ explicit: tthhiirrdd() and ffoouurrtthh(_v_o_i_d)
+
+ ENDTEST
+
+OpenBSD March 13, 2020 OpenBSD
diff --git a/regress/usr.bin/mandoc/mdoc/Fo/tag.out_html b/regress/usr.bin/mandoc/mdoc/Fo/tag.out_html
new file mode 100644
index 00000000000..b350861482e
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Fo/tag.out_html
@@ -0,0 +1,9 @@
+<p class="Pp">automatic:
+ <a class="permalink" href="#first"><code class="Fn" id="first">first</code></a>()
+ and <code class="Fn">second</code>()</p>
+<p class="Pp"><a class="permalink" href="#second"><code class="Fn" id="second">second</code></a>()
+ and <code class="Fn">first</code>()</p>
+<p class="Pp">explicit:
+ <a class="permalink" href="#e3"><code class="Fn" id="e3">third</code></a>()
+ and
+ <a class="permalink" href="#e4"><code class="Fn" id="e4">fourth</code></a>(<var class="Fa">void</var>);</p>
diff --git a/regress/usr.bin/mandoc/mdoc/Fo/tag.out_markdown b/regress/usr.bin/mandoc/mdoc/Fo/tag.out_markdown
new file mode 100644
index 00000000000..273a00d4be0
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Fo/tag.out_markdown
@@ -0,0 +1,27 @@
+FO-TAG(1) - General Commands Manual
+
+# NAME
+
+**Fo-tag** - tagging of function name macros
+
+# DESCRIPTION
+
+BEGINTEST
+
+automatic:
+**first**()
+and
+**second**()
+
+**second**()
+and
+**first**()
+
+explicit:
+**third**()
+and
+**fourth**(*void*)
+
+ENDTEST
+
+OpenBSD - March 13, 2020
diff --git a/regress/usr.bin/mandoc/mdoc/Fo/tag.out_tag b/regress/usr.bin/mandoc/mdoc/Fo/tag.out_tag
new file mode 100644
index 00000000000..2387023c8f4
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Fo/tag.out_tag
@@ -0,0 +1,4 @@
+first 9
+second 11
+e3 13
+e4 13
diff --git a/regress/usr.bin/mandoc/mdoc/Ic/Makefile b/regress/usr.bin/mandoc/mdoc/Ic/Makefile
index bba07fb34b1..4a06ee20eb4 100644
--- a/regress/usr.bin/mandoc/mdoc/Ic/Makefile
+++ b/regress/usr.bin/mandoc/mdoc/Ic/Makefile
@@ -1,6 +1,8 @@
-# $OpenBSD: Makefile,v 1.7 2017/05/30 16:21:08 schwarze Exp $
+# $OpenBSD: Makefile,v 1.8 2020/03/13 00:31:06 schwarze Exp $
-REGRESS_TARGETS = font noarg punct
+REGRESS_TARGETS = font noarg punct tag
+TAG_TARGETS = tag
LINT_TARGETS = noarg
+HTML_TARGETS = tag
.include <bsd.regress.mk>
diff --git a/regress/usr.bin/mandoc/mdoc/Ic/tag.in b/regress/usr.bin/mandoc/mdoc/Ic/tag.in
new file mode 100644
index 00000000000..9d21426e8a3
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Ic/tag.in
@@ -0,0 +1,21 @@
+.\" $OpenBSD: tag.in,v 1.1 2020/03/13 00:31:06 schwarze Exp $
+.Dd $Mdocdate: March 13 2020 $
+.Dt IC-TAG 1
+.Os
+.Sh NAME
+.Nm Ic-tag
+.Nd tagging of internal command macros
+.Sh DESCRIPTION
+BEGINTEST
+.Bl -tag -width Ds
+.It Ic one | two
+text
+.It Xo
+.Ic three
+.Xc
+text
+.El
+.Tg
+.Ic four
+.Pp
+ENDTEST
diff --git a/regress/usr.bin/mandoc/mdoc/Ic/tag.out_ascii b/regress/usr.bin/mandoc/mdoc/Ic/tag.out_ascii
new file mode 100644
index 00000000000..513b2638c51
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Ic/tag.out_ascii
@@ -0,0 +1,17 @@
+IC-TAG(1) General Commands Manual IC-TAG(1)
+
+NNAAMMEE
+ IIcc--ttaagg - tagging of internal command macros
+
+DDEESSCCRRIIPPTTIIOONN
+ BEGINTEST
+
+ oonnee | ttwwoo
+ text
+
+ tthhrreeee text
+ ffoouurr
+
+ ENDTEST
+
+OpenBSD March 13, 2020 OpenBSD
diff --git a/regress/usr.bin/mandoc/mdoc/Ic/tag.out_html b/regress/usr.bin/mandoc/mdoc/Ic/tag.out_html
new file mode 100644
index 00000000000..ad3cc1efc52
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Ic/tag.out_html
@@ -0,0 +1,9 @@
+<dl class="Bl-tag">
+ <dt><a class="permalink" href="#one"><code class="Ic" id="one">one</code></a>
+ |
+ <a class="permalink" href="#two"><code class="Ic" id="two">two</code></a></dt>
+ <dd>text</dd>
+ <dt><a class="permalink" href="#three"><code class="Ic" id="three">three</code></a></dt>
+ <dd>text</dd>
+</dl>
+<a class="permalink" href="#four"><code class="Ic" id="four">four</code></a>
diff --git a/regress/usr.bin/mandoc/mdoc/Ic/tag.out_markdown b/regress/usr.bin/mandoc/mdoc/Ic/tag.out_markdown
new file mode 100644
index 00000000000..c0f13879fba
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Ic/tag.out_markdown
@@ -0,0 +1,23 @@
+IC-TAG(1) - General Commands Manual
+
+# NAME
+
+**Ic-tag** - tagging of internal command macros
+
+# DESCRIPTION
+
+BEGINTEST
+
+**one** | **two**
+
+> text
+
+**three**
+
+> text
+
+**four**
+
+ENDTEST
+
+OpenBSD - March 13, 2020
diff --git a/regress/usr.bin/mandoc/mdoc/Ic/tag.out_tag b/regress/usr.bin/mandoc/mdoc/Ic/tag.out_tag
new file mode 100644
index 00000000000..94f0cfb2c0d
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Ic/tag.out_tag
@@ -0,0 +1,4 @@
+one 9
+two 9
+three 12
+four 13
diff --git a/regress/usr.bin/mandoc/mdoc/Li/Makefile b/regress/usr.bin/mandoc/mdoc/Li/Makefile
index 7b2a3313c5a..44dcf01cf83 100644
--- a/regress/usr.bin/mandoc/mdoc/Li/Makefile
+++ b/regress/usr.bin/mandoc/mdoc/Li/Makefile
@@ -1,6 +1,8 @@
-# $OpenBSD: Makefile,v 1.7 2018/12/21 16:58:49 schwarze Exp $
+# $OpenBSD: Makefile,v 1.8 2020/03/13 00:31:06 schwarze Exp $
-REGRESS_TARGETS = arg punct font
+REGRESS_TARGETS = arg punct font tag
+TAG_TARGETS = tag
LINT_TARGETS = punct
+HTML_TARGETS = tag
.include <bsd.regress.mk>
diff --git a/regress/usr.bin/mandoc/mdoc/Li/tag.in b/regress/usr.bin/mandoc/mdoc/Li/tag.in
new file mode 100644
index 00000000000..0ee9ce8208f
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Li/tag.in
@@ -0,0 +1,21 @@
+.\" $OpenBSD: tag.in,v 1.1 2020/03/13 00:31:06 schwarze Exp $
+.Dd $Mdocdate: March 13 2020 $
+.Dt LI-TAG 1
+.Os
+.Sh NAME
+.Nm Li-tag
+.Nd tagging of literal font macros
+.Sh DESCRIPTION
+BEGINTEST
+.Bl -tag -width Ds
+.It Li one | two
+text
+.It Xo
+.Li three
+.Xc
+text
+.El
+.Tg
+.Li four
+.Pp
+ENDTEST
diff --git a/regress/usr.bin/mandoc/mdoc/Li/tag.out_ascii b/regress/usr.bin/mandoc/mdoc/Li/tag.out_ascii
new file mode 100644
index 00000000000..e1afda6e9b4
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Li/tag.out_ascii
@@ -0,0 +1,17 @@
+LI-TAG(1) General Commands Manual LI-TAG(1)
+
+NNAAMMEE
+ LLii--ttaagg - tagging of literal font macros
+
+DDEESSCCRRIIPPTTIIOONN
+ BEGINTEST
+
+ one | two
+ text
+
+ three text
+ four
+
+ ENDTEST
+
+OpenBSD March 13, 2020 OpenBSD
diff --git a/regress/usr.bin/mandoc/mdoc/Li/tag.out_html b/regress/usr.bin/mandoc/mdoc/Li/tag.out_html
new file mode 100644
index 00000000000..3730caa6a52
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Li/tag.out_html
@@ -0,0 +1,9 @@
+<dl class="Bl-tag">
+ <dt><a class="permalink" href="#one"><code class="Li" id="one">one</code></a>
+ |
+ <a class="permalink" href="#two"><code class="Li" id="two">two</code></a></dt>
+ <dd>text</dd>
+ <dt><a class="permalink" href="#three"><code class="Li" id="three">three</code></a></dt>
+ <dd>text</dd>
+</dl>
+<a class="permalink" href="#four"><code class="Li" id="four">four</code></a>
diff --git a/regress/usr.bin/mandoc/mdoc/Li/tag.out_markdown b/regress/usr.bin/mandoc/mdoc/Li/tag.out_markdown
new file mode 100644
index 00000000000..6467e16d675
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Li/tag.out_markdown
@@ -0,0 +1,23 @@
+LI-TAG(1) - General Commands Manual
+
+# NAME
+
+**Li-tag** - tagging of literal font macros
+
+# DESCRIPTION
+
+BEGINTEST
+
+`one` | `two`
+
+> text
+
+`three`
+
+> text
+
+`four`
+
+ENDTEST
+
+OpenBSD - March 13, 2020
diff --git a/regress/usr.bin/mandoc/mdoc/Li/tag.out_tag b/regress/usr.bin/mandoc/mdoc/Li/tag.out_tag
new file mode 100644
index 00000000000..94f0cfb2c0d
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Li/tag.out_tag
@@ -0,0 +1,4 @@
+one 9
+two 9
+three 12
+four 13
diff --git a/regress/usr.bin/mandoc/mdoc/Makefile b/regress/usr.bin/mandoc/mdoc/Makefile
index 86bdcb7a2ff..83bd7fb7d40 100644
--- a/regress/usr.bin/mandoc/mdoc/Makefile
+++ b/regress/usr.bin/mandoc/mdoc/Makefile
@@ -1,9 +1,9 @@
-# $OpenBSD: Makefile,v 1.32 2017/01/11 17:39:45 schwarze Exp $
+# $OpenBSD: Makefile,v 1.33 2020/03/13 00:31:05 schwarze Exp $
SUBDIR = Ad An Ap Aq Ar At Bd Bf Bk Bl Brq Bx Cd Cm
SUBDIR += D1 Db Dd Dl Dq Dt Dv Em Eo Er Ev Ex Fd Fl Fo Ft Ic In Lb Li Lk
SUBDIR += Ms Mt Nd Nm No Ns Oo Op Os Ox Pa Pf Pp Qq Rs Rv
-SUBDIR += Sh Sm Sq St Sx Sy Tn Ud Ux Va Vt Xr blank break
+SUBDIR += Sh Sm Sq St Sx Sy Tg Tn Ud Ux Va Vt Xr blank break
.include "../Makefile.sub"
.include <bsd.subdir.mk>
diff --git a/regress/usr.bin/mandoc/mdoc/Ms/Makefile b/regress/usr.bin/mandoc/mdoc/Ms/Makefile
index 78da864da6f..defbb29481a 100644
--- a/regress/usr.bin/mandoc/mdoc/Ms/Makefile
+++ b/regress/usr.bin/mandoc/mdoc/Ms/Makefile
@@ -1,6 +1,8 @@
-# $OpenBSD: Makefile,v 1.6 2017/03/08 22:53:35 schwarze Exp $
+# $OpenBSD: Makefile,v 1.7 2020/03/13 00:31:06 schwarze Exp $
-REGRESS_TARGETS = noarg font
+REGRESS_TARGETS = noarg font tag
+TAG_TARGET = tag
LINT_TARGETS = noarg
+HTML_TARGET = tag
.include <bsd.regress.mk>
diff --git a/regress/usr.bin/mandoc/mdoc/Ms/tag.in b/regress/usr.bin/mandoc/mdoc/Ms/tag.in
new file mode 100644
index 00000000000..da65a07e51e
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Ms/tag.in
@@ -0,0 +1,21 @@
+.\" $OpenBSD: tag.in,v 1.1 2020/03/13 00:31:06 schwarze Exp $
+.Dd $Mdocdate: March 13 2020 $
+.Dt MS-TAG 1
+.Os
+.Sh NAME
+.Nm Ms-tag
+.Nd tagging of mathematical symbol macros
+.Sh DESCRIPTION
+BEGINTEST
+.Bl -tag -width Ds
+.It Ms one | two
+text
+.It Xo
+.Ms three
+.Xc
+text
+.El
+.Tg
+.Ms four
+.Pp
+ENDTEST
diff --git a/regress/usr.bin/mandoc/mdoc/Ms/tag.out_ascii b/regress/usr.bin/mandoc/mdoc/Ms/tag.out_ascii
new file mode 100644
index 00000000000..2d06f4bffcb
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Ms/tag.out_ascii
@@ -0,0 +1,17 @@
+MS-TAG(1) General Commands Manual MS-TAG(1)
+
+NNAAMMEE
+ MMss--ttaagg - tagging of mathematical symbol macros
+
+DDEESSCCRRIIPPTTIIOONN
+ BEGINTEST
+
+ oonnee | ttwwoo
+ text
+
+ tthhrreeee text
+ ffoouurr
+
+ ENDTEST
+
+OpenBSD March 13, 2020 OpenBSD
diff --git a/regress/usr.bin/mandoc/mdoc/Ms/tag.out_html b/regress/usr.bin/mandoc/mdoc/Ms/tag.out_html
new file mode 100644
index 00000000000..a140fe3e386
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Ms/tag.out_html
@@ -0,0 +1,9 @@
+<dl class="Bl-tag">
+ <dt><a class="permalink" href="#one"><code class="Cm" id="one">one</code></a>
+ |
+ <a class="permalink" href="#two"><code class="Cm" id="two">two</code></a></dt>
+ <dd>text</dd>
+ <dt><a class="permalink" href="#three"><code class="Cm" id="three">three</code></a></dt>
+ <dd>text</dd>
+</dl>
+<a class="permalink" href="#four"><code class="Cm" id="four">four</code></a>
diff --git a/regress/usr.bin/mandoc/mdoc/Ms/tag.out_markdown b/regress/usr.bin/mandoc/mdoc/Ms/tag.out_markdown
new file mode 100644
index 00000000000..055c386002c
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Ms/tag.out_markdown
@@ -0,0 +1,23 @@
+MS-TAG(1) - General Commands Manual
+
+# NAME
+
+**Ms-tag** - tagging of mathematical symbol macros
+
+# DESCRIPTION
+
+BEGINTEST
+
+**one** | **two**
+
+> text
+
+**three**
+
+> text
+
+**four**
+
+ENDTEST
+
+OpenBSD - March 13, 2020
diff --git a/regress/usr.bin/mandoc/mdoc/Ms/tag.out_tag b/regress/usr.bin/mandoc/mdoc/Ms/tag.out_tag
new file mode 100644
index 00000000000..94f0cfb2c0d
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Ms/tag.out_tag
@@ -0,0 +1,4 @@
+one 9
+two 9
+three 12
+four 13
diff --git a/regress/usr.bin/mandoc/mdoc/No/Makefile b/regress/usr.bin/mandoc/mdoc/No/Makefile
index 1187d98bff1..35aa4e1e19d 100644
--- a/regress/usr.bin/mandoc/mdoc/No/Makefile
+++ b/regress/usr.bin/mandoc/mdoc/No/Makefile
@@ -1,6 +1,8 @@
-# $OpenBSD: Makefile,v 1.6 2017/03/08 22:53:35 schwarze Exp $
+# $OpenBSD: Makefile,v 1.7 2020/03/13 00:31:06 schwarze Exp $
-REGRESS_TARGETS = punct spacing
+REGRESS_TARGETS = punct spacing tag
+TAG_TARGETS = tag
LINT_TARGETS = punct
+HTML_TARGETS = tag
.include <bsd.regress.mk>
diff --git a/regress/usr.bin/mandoc/mdoc/No/punct.out_lint b/regress/usr.bin/mandoc/mdoc/No/punct.out_lint
index e046da6a10c..6a65c3b4034 100644
--- a/regress/usr.bin/mandoc/mdoc/No/punct.out_lint
+++ b/regress/usr.bin/mandoc/mdoc/No/punct.out_lint
@@ -23,3 +23,4 @@ mandoc: punct.in:72:7: WARNING: skipping empty macro: No
mandoc: punct.in:75:7: WARNING: skipping empty macro: No
mandoc: punct.in:76:7: WARNING: skipping empty macro: No
mandoc: punct.in:84:2: WARNING: skipping empty macro: No
+mandoc: punct.in:87:6: STYLE: no blank before trailing delimiter: No a.
diff --git a/regress/usr.bin/mandoc/mdoc/No/tag.in b/regress/usr.bin/mandoc/mdoc/No/tag.in
new file mode 100644
index 00000000000..a9d4415f799
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/No/tag.in
@@ -0,0 +1,21 @@
+.\" $OpenBSD: tag.in,v 1.1 2020/03/13 00:31:06 schwarze Exp $
+.Dd $Mdocdate: March 13 2020 $
+.Dt NO-TAG 1
+.Os
+.Sh NAME
+.Nm No-tag
+.Nd tagging of normal font macros
+.Sh DESCRIPTION
+BEGINTEST
+.Bl -tag -width Ds
+.It No one | two
+text
+.It Xo
+.No three
+.Xc
+text
+.El
+.Tg
+.No four
+.Pp
+ENDTEST
diff --git a/regress/usr.bin/mandoc/mdoc/No/tag.out_ascii b/regress/usr.bin/mandoc/mdoc/No/tag.out_ascii
new file mode 100644
index 00000000000..44481b02a4e
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/No/tag.out_ascii
@@ -0,0 +1,17 @@
+NO-TAG(1) General Commands Manual NO-TAG(1)
+
+NNAAMMEE
+ NNoo--ttaagg - tagging of normal font macros
+
+DDEESSCCRRIIPPTTIIOONN
+ BEGINTEST
+
+ one | two
+ text
+
+ three text
+ four
+
+ ENDTEST
+
+OpenBSD March 13, 2020 OpenBSD
diff --git a/regress/usr.bin/mandoc/mdoc/No/tag.out_html b/regress/usr.bin/mandoc/mdoc/No/tag.out_html
new file mode 100644
index 00000000000..32696917362
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/No/tag.out_html
@@ -0,0 +1,9 @@
+<dl class="Bl-tag">
+ <dt><a class="permalink" href="#one"><span class="No" id="one">one</span></a>
+ |
+ <a class="permalink" href="#two"><span class="No" id="two">two</span></a></dt>
+ <dd>text</dd>
+ <dt><a class="permalink" href="#three"><span class="No" id="three">three</span></a></dt>
+ <dd>text</dd>
+</dl>
+<a class="permalink" href="#four"><span class="No" id="four">four</span></a>
diff --git a/regress/usr.bin/mandoc/mdoc/No/tag.out_markdown b/regress/usr.bin/mandoc/mdoc/No/tag.out_markdown
new file mode 100644
index 00000000000..1590c01059f
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/No/tag.out_markdown
@@ -0,0 +1,23 @@
+NO-TAG(1) - General Commands Manual
+
+# NAME
+
+**No-tag** - tagging of normal font macros
+
+# DESCRIPTION
+
+BEGINTEST
+
+one | two
+
+> text
+
+three
+
+> text
+
+four
+
+ENDTEST
+
+OpenBSD - March 13, 2020
diff --git a/regress/usr.bin/mandoc/mdoc/No/tag.out_tag b/regress/usr.bin/mandoc/mdoc/No/tag.out_tag
new file mode 100644
index 00000000000..94f0cfb2c0d
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/No/tag.out_tag
@@ -0,0 +1,4 @@
+one 9
+two 9
+three 12
+four 13
diff --git a/regress/usr.bin/mandoc/mdoc/Sy/Makefile b/regress/usr.bin/mandoc/mdoc/Sy/Makefile
index 6a72abfa5ec..752d1382597 100644
--- a/regress/usr.bin/mandoc/mdoc/Sy/Makefile
+++ b/regress/usr.bin/mandoc/mdoc/Sy/Makefile
@@ -1,6 +1,8 @@
-# $OpenBSD: Makefile,v 1.7 2017/03/08 22:53:36 schwarze Exp $
+# $OpenBSD: Makefile,v 1.8 2020/03/13 00:31:06 schwarze Exp $
-REGRESS_TARGETS = noarg font punct
+REGRESS_TARGETS = noarg font punct tag
+TAG_TARGETS = tag
LINT_TARGETS = noarg punct
+HTML_TARGETS = tag
.include <bsd.regress.mk>
diff --git a/regress/usr.bin/mandoc/mdoc/Sy/tag.in b/regress/usr.bin/mandoc/mdoc/Sy/tag.in
new file mode 100644
index 00000000000..1294e17da7d
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Sy/tag.in
@@ -0,0 +1,23 @@
+.\" $OpenBSD: tag.in,v 1.1 2020/03/13 00:31:06 schwarze Exp $
+.Dd $Mdocdate: March 13 2020 $
+.Dt SY-TAG 1
+.Os
+.Sh NAME
+.Nm Sy-tag
+.Nd tagging of symbolic font macros
+.Sh DESCRIPTION
+BEGINTEST
+.Bl -tag -width Ds
+.It Sy one | two
+text
+.It Xo
+.Sy three
+.Xc
+text
+.El
+.Sy four
+.Sy one
+.Tg explicit
+.Sy five
+.Pp
+ENDTEST
diff --git a/regress/usr.bin/mandoc/mdoc/Sy/tag.out_ascii b/regress/usr.bin/mandoc/mdoc/Sy/tag.out_ascii
new file mode 100644
index 00000000000..3b89cb4157b
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Sy/tag.out_ascii
@@ -0,0 +1,17 @@
+SY-TAG(1) General Commands Manual SY-TAG(1)
+
+NNAAMMEE
+ SSyy--ttaagg - tagging of symbolic font macros
+
+DDEESSCCRRIIPPTTIIOONN
+ BEGINTEST
+
+ oonnee | ttwwoo
+ text
+
+ tthhrreeee text
+ ffoouurr oonnee ffiivvee
+
+ ENDTEST
+
+OpenBSD March 13, 2020 OpenBSD
diff --git a/regress/usr.bin/mandoc/mdoc/Sy/tag.out_html b/regress/usr.bin/mandoc/mdoc/Sy/tag.out_html
new file mode 100644
index 00000000000..69276a1883b
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Sy/tag.out_html
@@ -0,0 +1,10 @@
+<dl class="Bl-tag">
+ <dt><a class="permalink" href="#one"><b class="Sy" id="one">one</b></a> |
+ <a class="permalink" href="#two"><b class="Sy" id="two">two</b></a></dt>
+ <dd>text</dd>
+ <dt><a class="permalink" href="#three"><b class="Sy" id="three">three</b></a></dt>
+ <dd>text</dd>
+</dl>
+<a class="permalink" href="#four"><b class="Sy" id="four">four</b></a>
+ <b class="Sy">one</b>
+ <a class="permalink" href="#explicit"><b class="Sy" id="explicit">five</b></a>
diff --git a/regress/usr.bin/mandoc/mdoc/Sy/tag.out_markdown b/regress/usr.bin/mandoc/mdoc/Sy/tag.out_markdown
new file mode 100644
index 00000000000..5382a5e254f
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Sy/tag.out_markdown
@@ -0,0 +1,25 @@
+SY-TAG(1) - General Commands Manual
+
+# NAME
+
+**Sy-tag** - tagging of symbolic font macros
+
+# DESCRIPTION
+
+BEGINTEST
+
+**one** | **two**
+
+> text
+
+**three**
+
+> text
+
+**four**
+**one**
+**five**
+
+ENDTEST
+
+OpenBSD - March 13, 2020
diff --git a/regress/usr.bin/mandoc/mdoc/Sy/tag.out_tag b/regress/usr.bin/mandoc/mdoc/Sy/tag.out_tag
new file mode 100644
index 00000000000..c2fbaf59646
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Sy/tag.out_tag
@@ -0,0 +1,5 @@
+one 9
+two 9
+three 12
+four 13
+explicit 13
diff --git a/regress/usr.bin/mandoc/mdoc/Tg/Makefile b/regress/usr.bin/mandoc/mdoc/Tg/Makefile
new file mode 100644
index 00000000000..7f5387660af
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Tg/Makefile
@@ -0,0 +1,8 @@
+# $OpenBSD: Makefile,v 1.1 2020/03/13 00:31:06 schwarze Exp $
+
+REGRESS_TARGETS = warn
+TAG_TARGETS = warn
+LINT_TARGETS = warn
+HTML_TARGETS = warn
+
+.include <bsd.regress.mk>
diff --git a/regress/usr.bin/mandoc/mdoc/Tg/warn.in b/regress/usr.bin/mandoc/mdoc/Tg/warn.in
new file mode 100644
index 00000000000..e36f4506150
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Tg/warn.in
@@ -0,0 +1,34 @@
+.\" $OpenBSD: warn.in,v 1.1 2020/03/13 00:31:06 schwarze Exp $
+.Dd $Mdocdate: March 13 2020 $
+.Dt TG-WARN 1
+.Os
+.Sh NAME
+.Nm Tg-warn
+.Nd warnings about tagging macros
+.Sh DESCRIPTION
+BEGINTEST
+.Pp
+.Tg start
+initial
+text
+.Tg
+.Ic macro
+.Tg "" ignored arguments
+too many
+.Tg \&badstart
+badstart
+.Tg badend\&
+badend
+.Tg "white space"
+whitespace
+.Tg sub
+.Tg double
+.Ss Subsection
+subtext
+.Tg examples
+.Sh EXAMPLES
+example
+text
+.Pp
+ENDTEST
+.Tg
diff --git a/regress/usr.bin/mandoc/mdoc/Tg/warn.out_ascii b/regress/usr.bin/mandoc/mdoc/Tg/warn.out_ascii
new file mode 100644
index 00000000000..8dee9aed406
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Tg/warn.out_ascii
@@ -0,0 +1,19 @@
+TG-WARN(1) General Commands Manual TG-WARN(1)
+
+NNAAMMEE
+ TTgg--wwaarrnn - warnings about tagging macros
+
+DDEESSCCRRIIPPTTIIOONN
+ BEGINTEST
+
+ initial text mmaaccrroo too many badstart badend whitespace
+
+ SSuubbsseeccttiioonn
+ subtext
+
+EEXXAAMMPPLLEESS
+ example text
+
+ ENDTEST
+
+OpenBSD March 13, 2020 OpenBSD
diff --git a/regress/usr.bin/mandoc/mdoc/Tg/warn.out_html b/regress/usr.bin/mandoc/mdoc/Tg/warn.out_html
new file mode 100644
index 00000000000..b4d3cf74c57
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Tg/warn.out_html
@@ -0,0 +1,11 @@
+<p class="Pp"><mark id="start"></mark>initial text
+ <a class="permalink" href="#macro"><code class="Ic" id="macro">macro</code></a>
+ too many badstart badend whitespace <mark id="sub"></mark></p>
+<section class="Ss">
+<h2 class="Ss" id="double"><a class="permalink" href="#double">Subsection</a></h2>
+<p class="Pp">subtext</p>
+</section>
+</section>
+<section class="Sh">
+<h1 class="Sh" id="examples"><a class="permalink" href="#examples">EXAMPLES</a></h1>
+<p class="Pp">example text</p>
diff --git a/regress/usr.bin/mandoc/mdoc/Tg/warn.out_lint b/regress/usr.bin/mandoc/mdoc/Tg/warn.out_lint
new file mode 100644
index 00000000000..39c1f541fbc
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Tg/warn.out_lint
@@ -0,0 +1,6 @@
+mandoc: warn.in:16:2: WARNING: skipping empty macro: Tg
+mandoc: warn.in:16:8: ERROR: skipping excess arguments: Tg ... ignored
+mandoc: warn.in:18:5: ERROR: skipping tag containing whitespace: Tg \&badstart
+mandoc: warn.in:20:11: ERROR: skipping tag containing whitespace: Tg badend\&
+mandoc: warn.in:22:10: ERROR: skipping tag containing whitespace: Tg white space
+mandoc: warn.in:34:2: WARNING: skipping empty macro: Tg
diff --git a/regress/usr.bin/mandoc/mdoc/Tg/warn.out_markdown b/regress/usr.bin/mandoc/mdoc/Tg/warn.out_markdown
new file mode 100644
index 00000000000..872044244a7
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Tg/warn.out_markdown
@@ -0,0 +1,30 @@
+TG-WARN(1) - General Commands Manual
+
+# NAME
+
+**Tg-warn** - warnings about tagging macros
+
+# DESCRIPTION
+
+BEGINTEST
+
+initial
+text
+**macro**
+too many
+badstart
+badend
+whitespace
+
+## Subsection
+
+subtext
+
+# EXAMPLES
+
+example
+text
+
+ENDTEST
+
+OpenBSD - March 13, 2020
diff --git a/regress/usr.bin/mandoc/mdoc/Tg/warn.out_tag b/regress/usr.bin/mandoc/mdoc/Tg/warn.out_tag
new file mode 100644
index 00000000000..e1fc141c346
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Tg/warn.out_tag
@@ -0,0 +1,5 @@
+start 9
+macro 9
+sub 9
+double 11
+examples 14