diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2020-04-02 14:55:30 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2020-04-02 14:55:30 +0000 |
commit | d63e7a931f446ce7a10e2d4231879fc522a48866 (patch) | |
tree | a78d4d9370c297866d2a6cd449b80d477fab4dc0 | |
parent | 19a51092a2b39d5878b7384d275a5c79c9fa0b64 (diff) |
Copy tagged strings before marking hyphens as breakable.
For example, this makes ":tCo-processes" work in ksh(1).
-rw-r--r-- | regress/usr.bin/mandoc/mdoc/Em/tag.in | 6 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/mdoc/Em/tag.out_ascii | 5 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/mdoc/Em/tag.out_html | 2 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/mdoc/Em/tag.out_markdown | 4 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/mdoc/Em/tag.out_tag | 6 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/mdoc/Sh/tag.in | 6 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/mdoc/Sh/tag.out_ascii | 5 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/mdoc/Sh/tag.out_html | 4 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/mdoc/Sh/tag.out_lint | 4 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/mdoc/Sh/tag.out_markdown | 6 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/mdoc/Sh/tag.out_tag | 3 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/mdoc/Tg/warn.in | 6 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/mdoc/Tg/warn.out_ascii | 2 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/mdoc/Tg/warn.out_html | 2 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/mdoc/Tg/warn.out_markdown | 2 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/mdoc/Tg/warn.out_tag | 2 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc_validate.c | 12 |
17 files changed, 48 insertions, 29 deletions
diff --git a/regress/usr.bin/mandoc/mdoc/Em/tag.in b/regress/usr.bin/mandoc/mdoc/Em/tag.in index 70e6eb447ec..eb6ac085160 100644 --- a/regress/usr.bin/mandoc/mdoc/Em/tag.in +++ b/regress/usr.bin/mandoc/mdoc/Em/tag.in @@ -1,5 +1,5 @@ -.\" $OpenBSD: tag.in,v 1.1 2020/03/13 00:31:05 schwarze Exp $ -.Dd $Mdocdate: March 13 2020 $ +.\" $OpenBSD: tag.in,v 1.2 2020/04/02 14:55:29 schwarze Exp $ +.Dd $Mdocdate: April 2 2020 $ .Dt EM-TAG 1 .Os .Sh NAME @@ -11,7 +11,7 @@ BEGINTEST .It Em one | two text .It Xo -.Em three +.Em three-with-hyphens .Xc text .El diff --git a/regress/usr.bin/mandoc/mdoc/Em/tag.out_ascii b/regress/usr.bin/mandoc/mdoc/Em/tag.out_ascii index 74f8212bf71..283c1120b82 100644 --- a/regress/usr.bin/mandoc/mdoc/Em/tag.out_ascii +++ b/regress/usr.bin/mandoc/mdoc/Em/tag.out_ascii @@ -9,9 +9,10 @@ DDEESSCCRRIIPPTTIIOONN _o_n_e | _t_w_o text - _t_h_r_e_e text + _t_h_r_e_e_-_w_i_t_h_-_h_y_p_h_e_n_s + text _f_o_u_r _o_n_e _f_i_v_e ENDTEST -OpenBSD March 13, 2020 OpenBSD +OpenBSD April 2, 2020 OpenBSD diff --git a/regress/usr.bin/mandoc/mdoc/Em/tag.out_html b/regress/usr.bin/mandoc/mdoc/Em/tag.out_html index 4046673f833..225343eebd0 100644 --- a/regress/usr.bin/mandoc/mdoc/Em/tag.out_html +++ b/regress/usr.bin/mandoc/mdoc/Em/tag.out_html @@ -2,7 +2,7 @@ <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> + <dt><a class="permalink" href="#three-with-hyphens"><i class="Em" id="three-with-hyphens">three-with-hyphens</i></a></dt> <dd>text</dd> </dl> <a class="permalink" href="#four"><i class="Em" id="four">four</i></a> diff --git a/regress/usr.bin/mandoc/mdoc/Em/tag.out_markdown b/regress/usr.bin/mandoc/mdoc/Em/tag.out_markdown index 4c10715982f..c881c2d9cb4 100644 --- a/regress/usr.bin/mandoc/mdoc/Em/tag.out_markdown +++ b/regress/usr.bin/mandoc/mdoc/Em/tag.out_markdown @@ -12,7 +12,7 @@ BEGINTEST > text -*three* +*three-with-hyphens* > text @@ -22,4 +22,4 @@ BEGINTEST ENDTEST -OpenBSD - March 13, 2020 +OpenBSD - April 2, 2020 diff --git a/regress/usr.bin/mandoc/mdoc/Em/tag.out_tag b/regress/usr.bin/mandoc/mdoc/Em/tag.out_tag index dd032f4f1f0..965d3e47b78 100644 --- a/regress/usr.bin/mandoc/mdoc/Em/tag.out_tag +++ b/regress/usr.bin/mandoc/mdoc/Em/tag.out_tag @@ -2,6 +2,6 @@ NAME 3 DESCRIPTION 6 one 9 two 9 -three 12 -four 13 -explicit 13 +three-with-hyphens 12 +four 14 +explicit 14 diff --git a/regress/usr.bin/mandoc/mdoc/Sh/tag.in b/regress/usr.bin/mandoc/mdoc/Sh/tag.in index da8a884a200..c44abbbfd2b 100644 --- a/regress/usr.bin/mandoc/mdoc/Sh/tag.in +++ b/regress/usr.bin/mandoc/mdoc/Sh/tag.in @@ -1,5 +1,5 @@ -.\" $OpenBSD: tag.in,v 1.2 2020/04/01 20:10:18 schwarze Exp $ -.Dd $Mdocdate: April 1 2020 $ +.\" $OpenBSD: tag.in,v 1.3 2020/04/02 14:55:29 schwarze Exp $ +.Dd $Mdocdate: April 2 2020 $ .Dt SH-TAG 1 .Os .Sh NAME @@ -19,6 +19,8 @@ Text introducing examples. .Tg example .Ss Subsection Example text. +.Ss Sub-section +More example text. .Sh "\& WEIRD SECTION " Text in weird section. .Sh \ \& diff --git a/regress/usr.bin/mandoc/mdoc/Sh/tag.out_ascii b/regress/usr.bin/mandoc/mdoc/Sh/tag.out_ascii index 309cb5597bf..8e6cce9d1f6 100644 --- a/regress/usr.bin/mandoc/mdoc/Sh/tag.out_ascii +++ b/regress/usr.bin/mandoc/mdoc/Sh/tag.out_ascii @@ -20,6 +20,9 @@ EEXXAAMMPPLLEESS SSuubbsseeccttiioonn Example text. + SSuubb--sseeccttiioonn + More example text. + WWEEIIRRDD SSEECCTTIIOONN Text in weird section. @@ -28,4 +31,4 @@ EEXXAAMMPPLLEESS ENDTEST -OpenBSD April 1, 2020 OpenBSD +OpenBSD April 2, 2020 OpenBSD diff --git a/regress/usr.bin/mandoc/mdoc/Sh/tag.out_html b/regress/usr.bin/mandoc/mdoc/Sh/tag.out_html index 49c45fdb18e..d99c6d4da69 100644 --- a/regress/usr.bin/mandoc/mdoc/Sh/tag.out_html +++ b/regress/usr.bin/mandoc/mdoc/Sh/tag.out_html @@ -12,6 +12,10 @@ <h2 class="Ss" id="example"><a class="permalink" href="#example">Subsection</a></h2> <p class="Pp">Example text.</p> </section> +<section class="Ss"> +<h2 class="Ss" id="Sub-section"><a class="permalink" href="#Sub-section">Sub-section</a></h2> +<p class="Pp">More example text.</p> +</section> </section> <section class="Sh"> <h1 class="Sh" id="WEIRD_SECTION"><a class="permalink" href="#WEIRD_SECTION"> diff --git a/regress/usr.bin/mandoc/mdoc/Sh/tag.out_lint b/regress/usr.bin/mandoc/mdoc/Sh/tag.out_lint index cfb1dfad13e..63f9d2e4884 100644 --- a/regress/usr.bin/mandoc/mdoc/Sh/tag.out_lint +++ b/regress/usr.bin/mandoc/mdoc/Sh/tag.out_lint @@ -1,3 +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 +mandoc: tag.in:24:7: WARNING: tab in filled text +mandoc: tag.in:24:22: WARNING: tab in filled text diff --git a/regress/usr.bin/mandoc/mdoc/Sh/tag.out_markdown b/regress/usr.bin/mandoc/mdoc/Sh/tag.out_markdown index 75a1e58e437..4b87b144e38 100644 --- a/regress/usr.bin/mandoc/mdoc/Sh/tag.out_markdown +++ b/regress/usr.bin/mandoc/mdoc/Sh/tag.out_markdown @@ -26,6 +26,10 @@ Text introducing examples. Example text. +## Sub-section + +More example text. + # WEIRD SECTION Text in weird section. @@ -36,4 +40,4 @@ Text in section with empty header. ENDTEST -OpenBSD - April 1, 2020 +OpenBSD - April 2, 2020 diff --git a/regress/usr.bin/mandoc/mdoc/Sh/tag.out_tag b/regress/usr.bin/mandoc/mdoc/Sh/tag.out_tag index 04b11882b7d..b4adea63444 100644 --- a/regress/usr.bin/mandoc/mdoc/Sh/tag.out_tag +++ b/regress/usr.bin/mandoc/mdoc/Sh/tag.out_tag @@ -4,4 +4,5 @@ Subsection 9 DESCRIPTION 14 examples 17 example 20 -WEIRD_SECTION 23 +Sub-section 23 +WEIRD_SECTION 26 diff --git a/regress/usr.bin/mandoc/mdoc/Tg/warn.in b/regress/usr.bin/mandoc/mdoc/Tg/warn.in index e36f4506150..d4dd3296f3b 100644 --- a/regress/usr.bin/mandoc/mdoc/Tg/warn.in +++ b/regress/usr.bin/mandoc/mdoc/Tg/warn.in @@ -1,5 +1,5 @@ -.\" $OpenBSD: warn.in,v 1.1 2020/03/13 00:31:06 schwarze Exp $ -.Dd $Mdocdate: March 13 2020 $ +.\" $OpenBSD: warn.in,v 1.2 2020/04/02 14:55:29 schwarze Exp $ +.Dd $Mdocdate: April 2 2020 $ .Dt TG-WARN 1 .Os .Sh NAME @@ -8,7 +8,7 @@ .Sh DESCRIPTION BEGINTEST .Pp -.Tg start +.Tg start-tag initial text .Tg diff --git a/regress/usr.bin/mandoc/mdoc/Tg/warn.out_ascii b/regress/usr.bin/mandoc/mdoc/Tg/warn.out_ascii index 8dee9aed406..cb199b1f4e7 100644 --- a/regress/usr.bin/mandoc/mdoc/Tg/warn.out_ascii +++ b/regress/usr.bin/mandoc/mdoc/Tg/warn.out_ascii @@ -16,4 +16,4 @@ EEXXAAMMPPLLEESS ENDTEST -OpenBSD March 13, 2020 OpenBSD +OpenBSD April 2, 2020 OpenBSD diff --git a/regress/usr.bin/mandoc/mdoc/Tg/warn.out_html b/regress/usr.bin/mandoc/mdoc/Tg/warn.out_html index b4d3cf74c57..fdc333b6577 100644 --- a/regress/usr.bin/mandoc/mdoc/Tg/warn.out_html +++ b/regress/usr.bin/mandoc/mdoc/Tg/warn.out_html @@ -1,4 +1,4 @@ -<p class="Pp"><mark id="start"></mark>initial text +<p class="Pp"><mark id="start-tag"></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"> diff --git a/regress/usr.bin/mandoc/mdoc/Tg/warn.out_markdown b/regress/usr.bin/mandoc/mdoc/Tg/warn.out_markdown index 872044244a7..ccc13bcec44 100644 --- a/regress/usr.bin/mandoc/mdoc/Tg/warn.out_markdown +++ b/regress/usr.bin/mandoc/mdoc/Tg/warn.out_markdown @@ -27,4 +27,4 @@ text ENDTEST -OpenBSD - March 13, 2020 +OpenBSD - April 2, 2020 diff --git a/regress/usr.bin/mandoc/mdoc/Tg/warn.out_tag b/regress/usr.bin/mandoc/mdoc/Tg/warn.out_tag index 6426c3b57e3..9009af0ea4f 100644 --- a/regress/usr.bin/mandoc/mdoc/Tg/warn.out_tag +++ b/regress/usr.bin/mandoc/mdoc/Tg/warn.out_tag @@ -1,6 +1,6 @@ NAME 3 DESCRIPTION 6 -start 9 +start-tag 9 macro 9 sub 9 double 11 diff --git a/usr.bin/mandoc/mdoc_validate.c b/usr.bin/mandoc/mdoc_validate.c index 689cab24a95..4b22e617e22 100644 --- a/usr.bin/mandoc/mdoc_validate.c +++ b/usr.bin/mandoc/mdoc_validate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mdoc_validate.c,v 1.296 2020/04/01 20:10:17 schwarze Exp $ */ +/* $OpenBSD: mdoc_validate.c,v 1.297 2020/04/02 14:55:29 schwarze Exp $ */ /* * Copyright (c) 2010-2020 Ingo Schwarze <schwarze@openbsd.org> * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> @@ -2149,10 +2149,11 @@ post_rs(POST_ARGS) static void post_hyph(POST_ARGS) { - struct roff_node *nch; + struct roff_node *n, *nch; char *cp; - for (nch = mdoc->last->child; nch != NULL; nch = nch->next) { + n = mdoc->last; + for (nch = n->child; nch != NULL; nch = nch->next) { if (nch->type != ROFFT_TEXT) continue; cp = nch->string; @@ -2161,8 +2162,11 @@ post_hyph(POST_ARGS) while (*(++cp) != '\0') if (*cp == '-' && isalpha((unsigned char)cp[-1]) && - isalpha((unsigned char)cp[1])) + isalpha((unsigned char)cp[1])) { + if (n->string == NULL && n->flags & NODE_ID) + n->string = mandoc_strdup(nch->string); *cp = ASCII_HYPH; + } } } |