source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: schwarze@mandoc.bsd.lv
To: source@mandoc.bsd.lv
Subject: mandoc: implement the GNU man-ext .TQ macro in man(7), used for example
Date: Thu, 16 Aug 2018 18:44:07 -0500 (EST)	[thread overview]
Message-ID: <c89f088261d0392b@fantadrom.bsd.lv> (raw)

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

                 reply	other threads:[~2018-08-16 23:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c89f088261d0392b@fantadrom.bsd.lv \
    --to=schwarze@mandoc.bsd.lv \
    --cc=source@mandoc.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).