diff options
-rw-r--r-- | mdoc_html.c | 2 | ||||
-rw-r--r-- | mdoc_validate.c | 60 | ||||
-rw-r--r-- | regress/mdoc/Cm/tag.out_tag | 2 | ||||
-rw-r--r-- | regress/mdoc/Dv/tag.out_tag | 2 | ||||
-rw-r--r-- | regress/mdoc/Em/tag.out_tag | 2 | ||||
-rw-r--r-- | regress/mdoc/Er/tag.out_tag | 3 | ||||
-rw-r--r-- | regress/mdoc/Ev/tag.out_tag | 2 | ||||
-rw-r--r-- | regress/mdoc/Fl/tag.out_tag | 2 | ||||
-rw-r--r-- | regress/mdoc/Fo/tag.out_tag | 2 | ||||
-rw-r--r-- | regress/mdoc/Ic/tag.out_tag | 2 | ||||
-rw-r--r-- | regress/mdoc/Li/tag.out_tag | 2 | ||||
-rw-r--r-- | regress/mdoc/Ms/tag.out_tag | 2 | ||||
-rw-r--r-- | regress/mdoc/No/tag.out_tag | 2 | ||||
-rw-r--r-- | regress/mdoc/Sh/Makefile | 5 | ||||
-rw-r--r-- | regress/mdoc/Sh/tag.in | 8 | ||||
-rw-r--r-- | regress/mdoc/Sh/tag.out_ascii | 11 | ||||
-rw-r--r-- | regress/mdoc/Sh/tag.out_html | 14 | ||||
-rw-r--r-- | regress/mdoc/Sh/tag.out_lint | 3 | ||||
-rw-r--r-- | regress/mdoc/Sh/tag.out_markdown | 14 | ||||
-rw-r--r-- | regress/mdoc/Sh/tag.out_tag | 7 | ||||
-rw-r--r-- | regress/mdoc/Sy/tag.out_tag | 2 | ||||
-rw-r--r-- | regress/mdoc/Tg/warn.out_tag | 2 |
22 files changed, 121 insertions, 30 deletions
diff --git a/mdoc_html.c b/mdoc_html.c index 946af309..05813f5f 100644 --- a/mdoc_html.c +++ b/mdoc_html.c @@ -569,7 +569,6 @@ mdoc_sh_pre(MDOC_ARGS) print_otag(h, TAG_SECTION, "c", "Sh"); break; case ROFFT_HEAD: - n->flags |= NODE_ID; print_otag_id(h, TAG_H1, "Sh", n); break; case ROFFT_BODY: @@ -591,7 +590,6 @@ mdoc_ss_pre(MDOC_ARGS) print_otag(h, TAG_SECTION, "c", "Ss"); break; case ROFFT_HEAD: - n->flags |= NODE_ID; print_otag_id(h, TAG_H2, "Ss", n); break; case ROFFT_BODY: diff --git a/mdoc_validate.c b/mdoc_validate.c index 7bcb841d..067e7d12 100644 --- a/mdoc_validate.c +++ b/mdoc_validate.c @@ -96,7 +96,6 @@ static void post_fn(POST_ARGS); static void post_fname(POST_ARGS); static void post_fo(POST_ARGS); static void post_hyph(POST_ARGS); -static void post_ignpar(POST_ARGS); static void post_it(POST_ARGS); static void post_lb(POST_ARGS); static void post_nd(POST_ARGS); @@ -109,6 +108,7 @@ static void post_prevpar(POST_ARGS); static void post_root(POST_ARGS); static void post_rs(POST_ARGS); static void post_rv(POST_ARGS); +static void post_section(POST_ARGS); static void post_sh(POST_ARGS); static void post_sh_head(POST_ARGS); static void post_sh_name(POST_ARGS); @@ -129,7 +129,7 @@ static const v_post mdoc_valids[MDOC_MAX - MDOC_Dd] = { post_dt, /* Dt */ post_os, /* Os */ post_sh, /* Sh */ - post_ignpar, /* Ss */ + post_section, /* Ss */ post_par, /* Pp */ post_display, /* D1 */ post_display, /* Dl */ @@ -2202,7 +2202,7 @@ post_sx(POST_ARGS) static void post_sh(POST_ARGS) { - post_ignpar(mdoc); + post_section(mdoc); switch (mdoc->last->type) { case ROFFT_HEAD: @@ -2535,15 +2535,31 @@ post_xr(POST_ARGS) } static void -post_ignpar(POST_ARGS) +post_section(POST_ARGS) { - struct roff_node *np; + struct roff_node *n, *nch; + char *cp, *tag; - switch (mdoc->last->type) { + n = mdoc->last; + switch (n->type) { case ROFFT_BLOCK: post_prevpar(mdoc); return; case ROFFT_HEAD: + tag = NULL; + deroff(&tag, n); + if (tag != NULL) { + for (cp = tag; *cp != '\0'; cp++) + if (*cp == ' ') + *cp = '_'; + if ((nch = n->child) != NULL && + nch->type == ROFFT_TEXT && + strcmp(nch->string, tag) == 0) + tag_put(NULL, TAG_WEAK, n); + else + tag_put(tag, TAG_FALLBACK, n); + free(tag); + } post_delim(mdoc); post_hyph(mdoc); return; @@ -2552,23 +2568,21 @@ post_ignpar(POST_ARGS) default: return; } - - if ((np = mdoc->last->child) != NULL) - if (np->tok == MDOC_Pp || - np->tok == ROFF_br || np->tok == ROFF_sp) { - mandoc_msg(MANDOCERR_PAR_SKIP, np->line, np->pos, - "%s after %s", roff_name[np->tok], - roff_name[mdoc->last->tok]); - roff_node_delete(mdoc, np); - } - - if ((np = mdoc->last->last) != NULL) - if (np->tok == MDOC_Pp || np->tok == ROFF_br) { - mandoc_msg(MANDOCERR_PAR_SKIP, np->line, np->pos, - "%s at the end of %s", roff_name[np->tok], - roff_name[mdoc->last->tok]); - roff_node_delete(mdoc, np); - } + if ((nch = n->child) != NULL && + (nch->tok == MDOC_Pp || nch->tok == ROFF_br || + nch->tok == ROFF_sp)) { + mandoc_msg(MANDOCERR_PAR_SKIP, nch->line, nch->pos, + "%s after %s", roff_name[nch->tok], + roff_name[n->tok]); + roff_node_delete(mdoc, nch); + } + if ((nch = n->last) != NULL && + (nch->tok == MDOC_Pp || nch->tok == ROFF_br)) { + mandoc_msg(MANDOCERR_PAR_SKIP, nch->line, nch->pos, + "%s at the end of %s", roff_name[nch->tok], + roff_name[n->tok]); + roff_node_delete(mdoc, nch); + } } static void diff --git a/regress/mdoc/Cm/tag.out_tag b/regress/mdoc/Cm/tag.out_tag index 0b97edbc..3a3a6b13 100644 --- a/regress/mdoc/Cm/tag.out_tag +++ b/regress/mdoc/Cm/tag.out_tag @@ -1,3 +1,5 @@ +NAME 3 +DESCRIPTION 6 one 9 two 9 three 12 diff --git a/regress/mdoc/Dv/tag.out_tag b/regress/mdoc/Dv/tag.out_tag index 94f0cfb2..848d769f 100644 --- a/regress/mdoc/Dv/tag.out_tag +++ b/regress/mdoc/Dv/tag.out_tag @@ -1,3 +1,5 @@ +NAME 3 +DESCRIPTION 6 one 9 two 9 three 12 diff --git a/regress/mdoc/Em/tag.out_tag b/regress/mdoc/Em/tag.out_tag index c2fbaf59..dd032f4f 100644 --- a/regress/mdoc/Em/tag.out_tag +++ b/regress/mdoc/Em/tag.out_tag @@ -1,3 +1,5 @@ +NAME 3 +DESCRIPTION 6 one 9 two 9 three 12 diff --git a/regress/mdoc/Er/tag.out_tag b/regress/mdoc/Er/tag.out_tag index b00a6718..c074e6cd 100644 --- a/regress/mdoc/Er/tag.out_tag +++ b/regress/mdoc/Er/tag.out_tag @@ -1,2 +1,5 @@ +NAME 3 +DESCRIPTION 6 two 10 +ERRORS 12 ENOENT 13 diff --git a/regress/mdoc/Ev/tag.out_tag b/regress/mdoc/Ev/tag.out_tag index 94f0cfb2..848d769f 100644 --- a/regress/mdoc/Ev/tag.out_tag +++ b/regress/mdoc/Ev/tag.out_tag @@ -1,3 +1,5 @@ +NAME 3 +DESCRIPTION 6 one 9 two 9 three 12 diff --git a/regress/mdoc/Fl/tag.out_tag b/regress/mdoc/Fl/tag.out_tag index 89a94151..a3710cac 100644 --- a/regress/mdoc/Fl/tag.out_tag +++ b/regress/mdoc/Fl/tag.out_tag @@ -1,3 +1,5 @@ +NAME 3 +DESCRIPTION 6 a 9 b 9 c 12 diff --git a/regress/mdoc/Fo/tag.out_tag b/regress/mdoc/Fo/tag.out_tag index 2387023c..901861d1 100644 --- a/regress/mdoc/Fo/tag.out_tag +++ b/regress/mdoc/Fo/tag.out_tag @@ -1,3 +1,5 @@ +NAME 3 +DESCRIPTION 6 first 9 second 11 e3 13 diff --git a/regress/mdoc/Ic/tag.out_tag b/regress/mdoc/Ic/tag.out_tag index 94f0cfb2..848d769f 100644 --- a/regress/mdoc/Ic/tag.out_tag +++ b/regress/mdoc/Ic/tag.out_tag @@ -1,3 +1,5 @@ +NAME 3 +DESCRIPTION 6 one 9 two 9 three 12 diff --git a/regress/mdoc/Li/tag.out_tag b/regress/mdoc/Li/tag.out_tag index 94f0cfb2..848d769f 100644 --- a/regress/mdoc/Li/tag.out_tag +++ b/regress/mdoc/Li/tag.out_tag @@ -1,3 +1,5 @@ +NAME 3 +DESCRIPTION 6 one 9 two 9 three 12 diff --git a/regress/mdoc/Ms/tag.out_tag b/regress/mdoc/Ms/tag.out_tag index 94f0cfb2..848d769f 100644 --- a/regress/mdoc/Ms/tag.out_tag +++ b/regress/mdoc/Ms/tag.out_tag @@ -1,3 +1,5 @@ +NAME 3 +DESCRIPTION 6 one 9 two 9 three 12 diff --git a/regress/mdoc/No/tag.out_tag b/regress/mdoc/No/tag.out_tag index 94f0cfb2..848d769f 100644 --- a/regress/mdoc/No/tag.out_tag +++ b/regress/mdoc/No/tag.out_tag @@ -1,3 +1,5 @@ +NAME 3 +DESCRIPTION 6 one 9 two 9 three 12 diff --git a/regress/mdoc/Sh/Makefile b/regress/mdoc/Sh/Makefile index 4b37bb2a..ea21e502 100644 --- a/regress/mdoc/Sh/Makefile +++ b/regress/mdoc/Sh/Makefile @@ -1,11 +1,12 @@ -# $OpenBSD: Makefile,v 1.13 2020/02/27 21:38:27 schwarze Exp $ +# $OpenBSD: Makefile,v 1.14 2020/04/01 20:10:18 schwarze Exp $ REGRESS_TARGETS = badNAME before empty emptyNAME first nohead order REGRESS_TARGETS += orderNAME paragraph parbefore parborder punctNAME REGRESS_TARGETS += subbefore tag transp LINT_TARGETS = badNAME before empty emptyNAME first nohead order -LINT_TARGETS += orderNAME parbefore parborder punctNAME subbefore +LINT_TARGETS += orderNAME parbefore parborder punctNAME subbefore tag HTML_TARGETS = paragraph tag +TAG_TARGETS = tag # groff-1.22.3 defects: # - .Pp before .Sh NAME causes a blank line before the header line diff --git a/regress/mdoc/Sh/tag.in b/regress/mdoc/Sh/tag.in index c204fc6b..dc59a90c 100644 --- a/regress/mdoc/Sh/tag.in +++ b/regress/mdoc/Sh/tag.in @@ -1,4 +1,4 @@ -.\" $OpenBSD: tag.in,v 1.1 2020/02/27 21:38:27 schwarze Exp $ +.\" $OpenBSD: tag.in,v 1.2 2020/04/01 20:10:18 schwarze Exp $ .Dd $Mdocdate$ .Dt SH-TAG 1 .Os @@ -11,11 +11,17 @@ Text in the description. BEGINTEST .Pp Text in the subsection. +.Sh DESCRIPTION +Text in duplicate description section. .Tg examples .Sh EXAMPLES Text introducing examples. .Tg example .Ss Subsection Example text. +.Sh "\& WEIRD SECTION " +Text in weird section. +.Sh \ \& +Text in section with empty header. .Pp ENDTEST diff --git a/regress/mdoc/Sh/tag.out_ascii b/regress/mdoc/Sh/tag.out_ascii index df0ab050..309cb559 100644 --- a/regress/mdoc/Sh/tag.out_ascii +++ b/regress/mdoc/Sh/tag.out_ascii @@ -11,12 +11,21 @@ DDEESSCCRRIIPPTTIIOONN Text in the subsection. +DDEESSCCRRIIPPTTIIOONN + Text in duplicate description section. + EEXXAAMMPPLLEESS Text introducing examples. SSuubbsseeccttiioonn Example text. + WWEEIIRRDD SSEECCTTIIOONN + Text in weird section. + + + Text in section with empty header. + ENDTEST -OpenBSD February 27, 2020 OpenBSD +OpenBSD April 1, 2020 OpenBSD diff --git a/regress/mdoc/Sh/tag.out_html b/regress/mdoc/Sh/tag.out_html index 9722aa8c..49c45fdb 100644 --- a/regress/mdoc/Sh/tag.out_html +++ b/regress/mdoc/Sh/tag.out_html @@ -2,8 +2,22 @@ </section> </section> <section class="Sh"> +<h1 class="Sh" id="DESCRIPTION_2"><a class="permalink" href="#DESCRIPTION_2">DESCRIPTION</a></h1> +<p class="Pp">Text in duplicate description section.</p> +</section> +<section class="Sh"> <h1 class="Sh" id="examples"><a class="permalink" href="#examples">EXAMPLES</a></h1> <p class="Pp">Text introducing examples.</p> <section class="Ss"> <h2 class="Ss" id="example"><a class="permalink" href="#example">Subsection</a></h2> <p class="Pp">Example text.</p> +</section> +</section> +<section class="Sh"> +<h1 class="Sh" id="WEIRD_SECTION"><a class="permalink" href="#WEIRD_SECTION"> + WEIRD SECTION </a></h1> +<p class="Pp">Text in weird section.</p> +</section> +<section class="Sh"> +<h1 class="Sh"> </h1> +<p class="Pp">Text in section with empty header.</p> diff --git a/regress/mdoc/Sh/tag.out_lint b/regress/mdoc/Sh/tag.out_lint new file mode 100644 index 00000000..cfb1dfad --- /dev/null +++ b/regress/mdoc/Sh/tag.out_lint @@ -0,0 +1,3 @@ +mandoc: tag.in:14:2: WARNING: duplicate section title: Sh DESCRIPTION +mandoc: tag.in:22:7: WARNING: tab in filled text +mandoc: tag.in:22:22: WARNING: tab in filled text diff --git a/regress/mdoc/Sh/tag.out_markdown b/regress/mdoc/Sh/tag.out_markdown index 2813f8f0..75a1e58e 100644 --- a/regress/mdoc/Sh/tag.out_markdown +++ b/regress/mdoc/Sh/tag.out_markdown @@ -14,6 +14,10 @@ BEGINTEST Text in the subsection. +# DESCRIPTION + +Text in duplicate description section. + # EXAMPLES Text introducing examples. @@ -22,6 +26,14 @@ Text introducing examples. Example text. +# WEIRD SECTION + +Text in weird section. + +#   + +Text in section with empty header. + ENDTEST -OpenBSD - February 27, 2020 +OpenBSD - April 1, 2020 diff --git a/regress/mdoc/Sh/tag.out_tag b/regress/mdoc/Sh/tag.out_tag new file mode 100644 index 00000000..04b11882 --- /dev/null +++ b/regress/mdoc/Sh/tag.out_tag @@ -0,0 +1,7 @@ +NAME 3 +DESCRIPTION 6 +Subsection 9 +DESCRIPTION 14 +examples 17 +example 20 +WEIRD_SECTION 23 diff --git a/regress/mdoc/Sy/tag.out_tag b/regress/mdoc/Sy/tag.out_tag index c2fbaf59..dd032f4f 100644 --- a/regress/mdoc/Sy/tag.out_tag +++ b/regress/mdoc/Sy/tag.out_tag @@ -1,3 +1,5 @@ +NAME 3 +DESCRIPTION 6 one 9 two 9 three 12 diff --git a/regress/mdoc/Tg/warn.out_tag b/regress/mdoc/Tg/warn.out_tag index e1fc141c..6426c3b5 100644 --- a/regress/mdoc/Tg/warn.out_tag +++ b/regress/mdoc/Tg/warn.out_tag @@ -1,3 +1,5 @@ +NAME 3 +DESCRIPTION 6 start 9 macro 9 sub 9 |