source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mandoc: implement the GNU man-ext .TQ macro in man(7), used for example
@ 2018-08-16 23:44 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2018-08-16 23:44 UTC (permalink / raw)
  To: source

Log Message:
-----------
implement the GNU man-ext .TQ macro in man(7),
used for example by groff_diff(7)

Modified Files:
--------------
    mandoc:
        TODO
        man.7
        man_html.c
        man_macro.c
        man_term.c
        man_validate.c
        roff.c
        roff.h

Revision Data
-------------
Index: man.7
===================================================================
RCS file: /home/cvs/mandoc/mandoc/man.7,v
retrieving revision 1.137
retrieving revision 1.138
diff -Lman.7 -Lman.7 -u -p -r1.137 -r1.138
--- man.7
+++ man.7
@@ -693,6 +693,12 @@ See also
 .Sx \&P ,
 and
 .Sx \&PP .
+.Ss \&TQ
+Like
+.Sx \&TP ,
+except that no vertical spacing is inserted before the paragraph.
+This is a non-standard GNU extension and rarely used even by GNU
+manual pages.
 .Ss \&UC
 Sets the volume for the footer for compatibility with man pages from
 .Bx
Index: TODO
===================================================================
RCS file: /home/cvs/mandoc/mandoc/TODO,v
retrieving revision 1.264
retrieving revision 1.265
diff -LTODO -LTODO -u -p -r1.264 -r1.265
--- TODO
+++ TODO
@@ -165,9 +165,6 @@ are mere guesses, and some may be wrong.
 - .SY and .YS,
   used by many groff manual pages
 
-- .TQ tagged paragraph continuation,
-  see groff_diff(7) for examples
-
 - groff_www(7) .MTO and .URL
   These macros were used by the GNU grep(1) man page.
   The groff_www(7) manual page itself uses them, too.
Index: roff.h
===================================================================
RCS file: /home/cvs/mandoc/mandoc/roff.h,v
retrieving revision 1.59
retrieving revision 1.60
diff -Lroff.h -Lroff.h -u -p -r1.59 -r1.60
--- roff.h
+++ roff.h
@@ -438,6 +438,7 @@ enum	roff_tok {
 	MAN_SH,
 	MAN_SS,
 	MAN_TP,
+	MAN_TQ,
 	MAN_LP,
 	MAN_PP,
 	MAN_P,
Index: man_html.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/man_html.c,v
retrieving revision 1.153
retrieving revision 1.154
diff -Lman_html.c -Lman_html.c -u -p -r1.153 -r1.154
--- man_html.c
+++ man_html.c
@@ -75,6 +75,7 @@ static	const struct htmlman __mans[MAN_M
 	{ man_SH_pre, NULL }, /* SH */
 	{ man_SS_pre, NULL }, /* SS */
 	{ man_IP_pre, NULL }, /* TP */
+	{ man_IP_pre, NULL }, /* TQ */
 	{ man_PP_pre, NULL }, /* LP */
 	{ man_PP_pre, NULL }, /* PP */
 	{ man_PP_pre, NULL }, /* P */
@@ -518,25 +519,25 @@ man_IP_pre(MAN_ARGS)
 		return 1;
 	}
 
-	/* FIXME: width specification. */
-
 	print_otag(h, TAG_DT, "");
 
-	/* For IP, only print the first header element. */
-
-	if (MAN_IP == n->tok && n->child)
-		print_man_node(man, n->child, h);
-
-	/* For TP, only print next-line header elements. */
-
-	if (MAN_TP == n->tok) {
+	switch(n->tok) {
+	case MAN_IP:  /* Only print the first header element. */
+		if (n->child != NULL)
+			print_man_node(man, n->child, h);
+		break;
+	case MAN_TP:  /* Only print next-line header elements. */
+	case MAN_TQ:
 		nn = n->child;
-		while (NULL != nn && 0 == (NODE_LINE & nn->flags))
+		while (nn != NULL && (NODE_LINE & nn->flags) == 0)
 			nn = nn->next;
-		while (NULL != nn) {
+		while (nn != NULL) {
 			print_man_node(man, nn, h);
 			nn = nn->next;
 		}
+		break;
+	default:
+		abort();
 	}
 
 	return 0;
Index: man_macro.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/man_macro.c,v
retrieving revision 1.125
retrieving revision 1.126
diff -Lman_macro.c -Lman_macro.c -u -p -r1.125 -r1.126
--- man_macro.c
+++ man_macro.c
@@ -45,6 +45,7 @@ const	struct man_macro __man_macros[MAN_
 	{ blk_imp, MAN_BSCOPE | MAN_SCOPED }, /* SH */
 	{ blk_imp, MAN_BSCOPE | MAN_SCOPED }, /* SS */
 	{ blk_imp, MAN_BSCOPE | MAN_SCOPED }, /* TP */
+	{ blk_imp, MAN_BSCOPE | MAN_SCOPED }, /* TQ */
 	{ blk_imp, MAN_BSCOPE }, /* LP */
 	{ blk_imp, MAN_BSCOPE }, /* PP */
 	{ blk_imp, MAN_BSCOPE }, /* P */
@@ -327,7 +328,7 @@ blk_imp(MACRO_PROT_ARGS)
 	 */
 
 	if (man_macros[tok].flags & MAN_SCOPED &&
-	    (tok == MAN_TP || n == man->last)) {
+	    (tok == MAN_TP || tok == MAN_TQ || n == man->last)) {
 		man->flags |= MAN_BLINE;
 		return;
 	}
Index: roff.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/roff.c,v
retrieving revision 1.331
retrieving revision 1.332
diff -Lroff.c -Lroff.c -u -p -r1.331 -r1.332
--- roff.c
+++ roff.c
@@ -327,6 +327,7 @@ const char *__roff_name[MAN_MAX + 1] = {
 	"Dx",		"%Q",		"%U",		"Ta",
 	NULL,
 	"TH",		"SH",		"SS",		"TP",
+	"TQ",
 	"LP",		"PP",		"P",		"IP",
 	"HP",		"SM",		"SB",		"BI",
 	"IB",		"BR",		"RB",		"R",
Index: man_term.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/man_term.c,v
retrieving revision 1.212
retrieving revision 1.213
diff -Lman_term.c -Lman_term.c -u -p -r1.212 -r1.213
--- man_term.c
+++ man_term.c
@@ -98,6 +98,7 @@ static	const struct termact __termacts[M
 	{ pre_SH, post_SH, 0 }, /* SH */
 	{ pre_SS, post_SS, 0 }, /* SS */
 	{ pre_TP, post_TP, 0 }, /* TP */
+	{ pre_TP, post_TP, 0 }, /* TQ */
 	{ pre_PP, NULL, 0 }, /* LP */
 	{ pre_PP, NULL, 0 }, /* PP */
 	{ pre_PP, NULL, 0 }, /* P */
@@ -584,7 +585,8 @@ pre_TP(DECL_ARGS)
 		p->flags |= TERMP_NOSPACE;
 		break;
 	case ROFFT_BLOCK:
-		print_bvspace(p, n, mt->pardist);
+		if (n->tok == MAN_TP)
+			print_bvspace(p, n, mt->pardist);
 		/* FALLTHROUGH */
 	default:
 		return 1;
Index: man_validate.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/man_validate.c,v
retrieving revision 1.135
retrieving revision 1.136
diff -Lman_validate.c -Lman_validate.c -u -p -r1.135 -r1.136
--- man_validate.c
+++ man_validate.c
@@ -59,6 +59,7 @@ static	const v_check man_valids[MAN_MAX 
 	NULL,       /* SH */
 	NULL,       /* SS */
 	NULL,       /* TP */
+	NULL,       /* TQ */
 	check_par,  /* LP */
 	check_par,  /* PP */
 	check_par,  /* P */
--
 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:[~2018-08-16 23:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-16 23:44 mandoc: implement the GNU man-ext .TQ macro in man(7), used for example 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).