source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mandoc: Copy tagged strings before marking hyphens as breakable.
@ 2020-04-02 15:05 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2020-04-02 15:05 UTC (permalink / raw)
  To: source

Log Message:
-----------
Copy tagged strings before marking hyphens as breakable.
For example, this makes ":tCo-processes" work in ksh(1).

Modified Files:
--------------
    mandoc:
        mdoc_validate.c
    mandoc/regress/mdoc/Em:
        tag.in
        tag.out_ascii
        tag.out_html
        tag.out_markdown
        tag.out_tag
    mandoc/regress/mdoc/Sh:
        tag.in
        tag.out_ascii
        tag.out_html
        tag.out_lint
        tag.out_markdown
        tag.out_tag
    mandoc/regress/mdoc/Tg:
        warn.in
        warn.out_ascii
        warn.out_html
        warn.out_markdown
        warn.out_tag

Revision Data
-------------
Index: tag.out_lint
===================================================================
RCS file: /home/cvs/mandoc/mandoc/regress/mdoc/Sh/tag.out_lint,v
retrieving revision 1.1
retrieving revision 1.2
diff -Lregress/mdoc/Sh/tag.out_lint -Lregress/mdoc/Sh/tag.out_lint -u -p -r1.1 -r1.2
--- regress/mdoc/Sh/tag.out_lint
+++ regress/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
Index: tag.out_tag
===================================================================
RCS file: /home/cvs/mandoc/mandoc/regress/mdoc/Sh/tag.out_tag,v
retrieving revision 1.1
retrieving revision 1.2
diff -Lregress/mdoc/Sh/tag.out_tag -Lregress/mdoc/Sh/tag.out_tag -u -p -r1.1 -r1.2
--- regress/mdoc/Sh/tag.out_tag
+++ regress/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
Index: tag.out_ascii
===================================================================
RCS file: /home/cvs/mandoc/mandoc/regress/mdoc/Sh/tag.out_ascii,v
retrieving revision 1.2
retrieving revision 1.3
diff -Lregress/mdoc/Sh/tag.out_ascii -Lregress/mdoc/Sh/tag.out_ascii -u -p -r1.2 -r1.3
--- regress/mdoc/Sh/tag.out_ascii
+++ regress/mdoc/Sh/tag.out_ascii
@@ -20,6 +20,9 @@ E\bEX\bXA\bAM\bMP\bPL\bLE\bES\bS
    S\bSu\bub\bbs\bse\bec\bct\bti\bio\bon\bn
      Example text.
 
+   S\bSu\bub\bb-\b-s\bse\bec\bct\bti\bio\bon\bn
+     More example text.
+
       W\bWE\bEI\bIR\bRD\bD S\bSE\bEC\bCT\bTI\bIO\bON\bN
      Text in weird section.
 
@@ -28,4 +31,4 @@ E\bEX\bXA\bAM\bMP\bPL\bLE\bES\bS
 
      ENDTEST
 
-OpenBSD                          April 1, 2020                         OpenBSD
+OpenBSD                          April 2, 2020                         OpenBSD
Index: tag.out_markdown
===================================================================
RCS file: /home/cvs/mandoc/mandoc/regress/mdoc/Sh/tag.out_markdown,v
retrieving revision 1.2
retrieving revision 1.3
diff -Lregress/mdoc/Sh/tag.out_markdown -Lregress/mdoc/Sh/tag.out_markdown -u -p -r1.2 -r1.3
--- regress/mdoc/Sh/tag.out_markdown
+++ regress/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
Index: tag.in
===================================================================
RCS file: /home/cvs/mandoc/mandoc/regress/mdoc/Sh/tag.in,v
retrieving revision 1.2
retrieving revision 1.3
diff -Lregress/mdoc/Sh/tag.in -Lregress/mdoc/Sh/tag.in -u -p -r1.2 -r1.3
--- regress/mdoc/Sh/tag.in
+++ regress/mdoc/Sh/tag.in
@@ -1,4 +1,4 @@
-.\" $OpenBSD: tag.in,v 1.2 2020/04/01 20:10:18 schwarze Exp $
+.\" $OpenBSD: tag.in,v 1.3 2020/04/02 14:55:29 schwarze Exp $
 .Dd $Mdocdate$
 .Dt SH-TAG 1
 .Os
@@ -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 \ \&
Index: tag.out_html
===================================================================
RCS file: /home/cvs/mandoc/mandoc/regress/mdoc/Sh/tag.out_html,v
retrieving revision 1.2
retrieving revision 1.3
diff -Lregress/mdoc/Sh/tag.out_html -Lregress/mdoc/Sh/tag.out_html -u -p -r1.2 -r1.3
--- regress/mdoc/Sh/tag.out_html
+++ regress/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">	
Index: mdoc_validate.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/mdoc_validate.c,v
retrieving revision 1.381
retrieving revision 1.382
diff -Lmdoc_validate.c -Lmdoc_validate.c -u -p -r1.381 -r1.382
--- mdoc_validate.c
+++ mdoc_validate.c
@@ -2164,10 +2164,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;
@@ -2176,8 +2177,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;
+			}
 	}
 }
 
Index: tag.out_tag
===================================================================
RCS file: /home/cvs/mandoc/mandoc/regress/mdoc/Em/tag.out_tag,v
retrieving revision 1.2
retrieving revision 1.3
diff -Lregress/mdoc/Em/tag.out_tag -Lregress/mdoc/Em/tag.out_tag -u -p -r1.2 -r1.3
--- regress/mdoc/Em/tag.out_tag
+++ regress/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
Index: tag.out_ascii
===================================================================
RCS file: /home/cvs/mandoc/mandoc/regress/mdoc/Em/tag.out_ascii,v
retrieving revision 1.1
retrieving revision 1.2
diff -Lregress/mdoc/Em/tag.out_ascii -Lregress/mdoc/Em/tag.out_ascii -u -p -r1.1 -r1.2
--- regress/mdoc/Em/tag.out_ascii
+++ regress/mdoc/Em/tag.out_ascii
@@ -9,9 +9,10 @@ D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
      _\bo_\bn_\be | _\bt_\bw_\bo
              text
 
-     _\bt_\bh_\br_\be_\be   text
+     _\bt_\bh_\br_\be_\be_\b-_\bw_\bi_\bt_\bh_\b-_\bh_\by_\bp_\bh_\be_\bn_\bs
+             text
      _\bf_\bo_\bu_\br _\bo_\bn_\be _\bf_\bi_\bv_\be
 
      ENDTEST
 
-OpenBSD                         March 13, 2020                         OpenBSD
+OpenBSD                          April 2, 2020                         OpenBSD
Index: tag.in
===================================================================
RCS file: /home/cvs/mandoc/mandoc/regress/mdoc/Em/tag.in,v
retrieving revision 1.1
retrieving revision 1.2
diff -Lregress/mdoc/Em/tag.in -Lregress/mdoc/Em/tag.in -u -p -r1.1 -r1.2
--- regress/mdoc/Em/tag.in
+++ regress/mdoc/Em/tag.in
@@ -1,4 +1,4 @@
-.\" $OpenBSD: tag.in,v 1.1 2020/03/13 00:31:05 schwarze Exp $
+.\" $OpenBSD: tag.in,v 1.2 2020/04/02 14:55:29 schwarze Exp $
 .Dd $Mdocdate$
 .Dt EM-TAG 1
 .Os
@@ -11,7 +11,7 @@ BEGINTEST
 .It Em one | two
 text
 .It Xo
-.Em three
+.Em three-with-hyphens
 .Xc
 text
 .El
Index: tag.out_html
===================================================================
RCS file: /home/cvs/mandoc/mandoc/regress/mdoc/Em/tag.out_html,v
retrieving revision 1.1
retrieving revision 1.2
diff -Lregress/mdoc/Em/tag.out_html -Lregress/mdoc/Em/tag.out_html -u -p -r1.1 -r1.2
--- regress/mdoc/Em/tag.out_html
+++ regress/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>
Index: tag.out_markdown
===================================================================
RCS file: /home/cvs/mandoc/mandoc/regress/mdoc/Em/tag.out_markdown,v
retrieving revision 1.1
retrieving revision 1.2
diff -Lregress/mdoc/Em/tag.out_markdown -Lregress/mdoc/Em/tag.out_markdown -u -p -r1.1 -r1.2
--- regress/mdoc/Em/tag.out_markdown
+++ regress/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
Index: warn.out_tag
===================================================================
RCS file: /home/cvs/mandoc/mandoc/regress/mdoc/Tg/warn.out_tag,v
retrieving revision 1.2
retrieving revision 1.3
diff -Lregress/mdoc/Tg/warn.out_tag -Lregress/mdoc/Tg/warn.out_tag -u -p -r1.2 -r1.3
--- regress/mdoc/Tg/warn.out_tag
+++ regress/mdoc/Tg/warn.out_tag
@@ -1,6 +1,6 @@
 NAME 3
 DESCRIPTION 6
-start 9
+start-tag 9
 macro 9
 sub 9
 double 11
Index: warn.out_ascii
===================================================================
RCS file: /home/cvs/mandoc/mandoc/regress/mdoc/Tg/warn.out_ascii,v
retrieving revision 1.1
retrieving revision 1.2
diff -Lregress/mdoc/Tg/warn.out_ascii -Lregress/mdoc/Tg/warn.out_ascii -u -p -r1.1 -r1.2
--- regress/mdoc/Tg/warn.out_ascii
+++ regress/mdoc/Tg/warn.out_ascii
@@ -16,4 +16,4 @@ E\bEX\bXA\bAM\bMP\bPL\bLE\bES\bS
 
      ENDTEST
 
-OpenBSD                         March 13, 2020                         OpenBSD
+OpenBSD                          April 2, 2020                         OpenBSD
Index: warn.out_markdown
===================================================================
RCS file: /home/cvs/mandoc/mandoc/regress/mdoc/Tg/warn.out_markdown,v
retrieving revision 1.1
retrieving revision 1.2
diff -Lregress/mdoc/Tg/warn.out_markdown -Lregress/mdoc/Tg/warn.out_markdown -u -p -r1.1 -r1.2
--- regress/mdoc/Tg/warn.out_markdown
+++ regress/mdoc/Tg/warn.out_markdown
@@ -27,4 +27,4 @@ text
 
 ENDTEST
 
-OpenBSD - March 13, 2020
+OpenBSD - April 2, 2020
Index: warn.in
===================================================================
RCS file: /home/cvs/mandoc/mandoc/regress/mdoc/Tg/warn.in,v
retrieving revision 1.1
retrieving revision 1.2
diff -Lregress/mdoc/Tg/warn.in -Lregress/mdoc/Tg/warn.in -u -p -r1.1 -r1.2
--- regress/mdoc/Tg/warn.in
+++ regress/mdoc/Tg/warn.in
@@ -1,4 +1,4 @@
-.\" $OpenBSD: warn.in,v 1.1 2020/03/13 00:31:06 schwarze Exp $
+.\" $OpenBSD: warn.in,v 1.2 2020/04/02 14:55:29 schwarze Exp $
 .Dd $Mdocdate$
 .Dt TG-WARN 1
 .Os
@@ -8,7 +8,7 @@
 .Sh DESCRIPTION
 BEGINTEST
 .Pp
-.Tg start
+.Tg start-tag
 initial
 text
 .Tg
Index: warn.out_html
===================================================================
RCS file: /home/cvs/mandoc/mandoc/regress/mdoc/Tg/warn.out_html,v
retrieving revision 1.1
retrieving revision 1.2
diff -Lregress/mdoc/Tg/warn.out_html -Lregress/mdoc/Tg/warn.out_html -u -p -r1.1 -r1.2
--- regress/mdoc/Tg/warn.out_html
+++ regress/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">
--
 To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-04-02 15:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-02 15:05 mandoc: Copy tagged strings before marking hyphens as breakable schwarze

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