source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mandoc: add support for the MT and ME mailto macros, used for example in
@ 2017-06-25 11:46 schwarze
  0 siblings, 0 replies; 2+ messages in thread
From: schwarze @ 2017-06-25 11:46 UTC (permalink / raw)
  To: source

Log Message:
-----------
add support for the MT and ME mailto macros, used for example in wg(8);
patch from bentley@

Modified Files:
--------------
    mandoc:
        man_macro.c

Revision Data
-------------
Index: man_macro.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/man_macro.c,v
retrieving revision 1.122
retrieving revision 1.123
diff -Lman_macro.c -Lman_macro.c -u -p -r1.122 -r1.123
--- man_macro.c
+++ man_macro.c
@@ -75,6 +75,8 @@ const	struct man_macro __man_macros[MAN_
 	{ in_line_eoln, MAN_BSCOPE }, /* EE */
 	{ blk_exp, MAN_BSCOPE }, /* UR */
 	{ blk_close, MAN_BSCOPE }, /* UE */
+	{ blk_exp, MAN_BSCOPE }, /* MT */
+	{ blk_close, MAN_BSCOPE }, /* ME */
 };
 const	struct man_macro *const man_macros = __man_macros - MAN_TH;
 
@@ -216,6 +218,9 @@ blk_close(MACRO_PROT_ARGS)
 		break;
 	case MAN_UE:
 		ntok = MAN_UR;
+		break;
+	case MAN_ME:
+		ntok = MAN_MT;
 		break;
 	default:
 		abort();
--
 To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv

^ permalink raw reply	[flat|nested] 2+ messages in thread

* mandoc: add support for the MT and ME mailto macros, used for example in
@ 2017-06-25 11:42 schwarze
  0 siblings, 0 replies; 2+ messages in thread
From: schwarze @ 2017-06-25 11:42 UTC (permalink / raw)
  To: source

Log Message:
-----------
add support for the MT and ME mailto macros, used for example in wg(8);
patch from bentley@

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

Revision Data
-------------
Index: roff.h
===================================================================
RCS file: /home/cvs/mandoc/mandoc/roff.h,v
retrieving revision 1.56
retrieving revision 1.57
diff -Lroff.h -Lroff.h -u -p -r1.56 -r1.57
--- roff.h
+++ roff.h
@@ -467,6 +467,8 @@ enum	roff_tok {
 	MAN_EE,
 	MAN_UR,
 	MAN_UE,
+	MAN_MT,
+	MAN_ME,
 	MAN_MAX
 };
 
Index: roff.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/roff.c,v
retrieving revision 1.316
retrieving revision 1.317
diff -Lroff.c -Lroff.c -u -p -r1.316 -r1.317
--- roff.c
+++ roff.c
@@ -330,7 +330,7 @@ const char *__roff_name[MAN_MAX + 1] = {
 	"RE",		"RS",		"DT",		"UC",
 	"PD",		"AT",		"in",
 	"OP",		"EX",		"EE",		"UR",
-	"UE",		NULL
+	"UE",		"MT",		"ME",		NULL
 };
 const	char *const *roff_name = __roff_name;
 
Index: man_html.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/man_html.c,v
retrieving revision 1.144
retrieving revision 1.145
diff -Lman_html.c -Lman_html.c -u -p -r1.144 -r1.145
--- man_html.c
+++ man_html.c
@@ -106,6 +106,8 @@ static	const struct htmlman __mans[MAN_M
 	{ NULL, NULL }, /* EE */
 	{ man_UR_pre, NULL }, /* UR */
 	{ NULL, NULL }, /* UE */
+	{ man_UR_pre, NULL }, /* MT */
+	{ NULL, NULL }, /* ME */
 };
 static	const struct htmlman *const mans = __mans - MAN_TH;
 
@@ -230,6 +232,7 @@ print_man_node(MAN_ARGS)
 		case MAN_P:   /* reopen .nf in the body.	*/
 		case MAN_RS:
 		case MAN_UR:
+		case MAN_MT:
 			fillmode(h, MAN_fi);
 			break;
 		default:
@@ -644,11 +647,17 @@ man_RS_pre(MAN_ARGS)
 static int
 man_UR_pre(MAN_ARGS)
 {
+	char *cp;
 	n = n->child;
 	assert(n->type == ROFFT_HEAD);
 	if (n->child != NULL) {
 		assert(n->child->type == ROFFT_TEXT);
-		print_otag(h, TAG_A, "cTh", "Lk", n->child->string);
+		if (n->tok == MAN_MT) {
+			mandoc_asprintf(&cp, "mailto:%s", n->child->string);
+			print_otag(h, TAG_A, "cTh", "Mt", cp);
+			free(cp);
+		} else
+			print_otag(h, TAG_A, "cTh", "Lk", n->child->string);
 	}
 
 	assert(n->next->type == ROFFT_BODY);
Index: man_term.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/man_term.c,v
retrieving revision 1.207
retrieving revision 1.208
diff -Lman_term.c -Lman_term.c -u -p -r1.207 -r1.208
--- man_term.c
+++ man_term.c
@@ -128,6 +128,8 @@ static	const struct termact __termacts[M
 	{ pre_literal, NULL, 0 }, /* EE */
 	{ pre_UR, post_UR, 0 }, /* UR */
 	{ NULL, NULL, 0 }, /* UE */
+	{ pre_UR, post_UR, 0 }, /* MT */
+	{ NULL, NULL, 0 }, /* ME */
 };
 static	const struct termact *termacts = __termacts - MAN_TH;
 
Index: man_validate.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/man_validate.c,v
retrieving revision 1.131
retrieving revision 1.132
diff -Lman_validate.c -Lman_validate.c -u -p -r1.131 -r1.132
--- man_validate.c
+++ man_validate.c
@@ -89,6 +89,8 @@ static	const v_check __man_valids[MAN_MA
 	NULL,       /* EE */
 	post_UR,    /* UR */
 	NULL,       /* UE */
+	post_UR,    /* MT */
+	NULL,       /* ME */
 };
 static	const v_check *man_valids = __man_valids - MAN_TH;
 
@@ -212,7 +214,7 @@ post_UR(CHKARGS)
 
 	if (n->type == ROFFT_HEAD && n->child == NULL)
 		mandoc_vmsg(MANDOCERR_UR_NOHEAD, man->parse,
-		    n->line, n->pos, "UR");
+		    n->line, n->pos, roff_name[n->tok]);
 	check_part(man, n);
 }
 
Index: man.7
===================================================================
RCS file: /home/cvs/mandoc/mandoc/man.7,v
retrieving revision 1.135
retrieving revision 1.136
diff -Lman.7 -Lman.7 -u -p -r1.135 -r1.136
--- man.7
+++ man.7
@@ -466,6 +466,20 @@ See also
 .Sx \&PP ,
 and
 .Sx \&TP .
+.Ss \&ME
+End a mailto block.
+This is a non-standard GNU extension, included only for compatibility.
+See
+.Sx \&MT .
+.Ss \&MT
+Begin a mailto block.
+This is a non-standard GNU extension, included only for compatibility.
+It has the following syntax:
+.Bd -literal -offset indent
+.Pf \. Sx \&MT Ar address
+link description to be shown
+.Pf \. Sx ME
+.Ed
 .Ss \&OP
 Optional command-line argument.
 This is a non-standard GNU extension, included only for compatibility.
Index: mandoc.1
===================================================================
RCS file: /home/cvs/mandoc/mandoc/mandoc.1,v
retrieving revision 1.205
retrieving revision 1.206
diff -Lmandoc.1 -Lmandoc.1 -u -p -r1.205 -r1.206
--- mandoc.1
+++ mandoc.1
@@ -1278,6 +1278,7 @@ A
 .Ic \&Bl ,
 .Ic \&D1 ,
 .Ic \&Dl ,
+.Ic \&MT ,
 .Ic \&RS ,
 or
 .Ic \&UR
@@ -1413,6 +1414,8 @@ An empty pair of square brackets is show
 .It Sy "missing resource identifier, using \(dq\(dq"
 .Pq man
 The
+.Ic \&MT
+or
 .Ic \&UR
 macro is invoked without any argument.
 An empty pair of angle brackets is shown.
@@ -1765,7 +1768,7 @@ An
 .Xr mdoc 7
 block closing macro, a
 .Xr man 7
-.Ic \&RE
+.Ic \&ME , \&RE
 or
 .Ic \&UE
 macro, an
@@ -1799,7 +1802,7 @@ At the end of the document, an explicit
 block, a
 .Xr man 7
 next-line scope or
-.Ic \&RS
+.Ic \&MT , \&RS
 or
 .Ic \&UR
 block, an equation, table, or
@@ -1971,6 +1974,7 @@ A macro or request is invoked with too m
 .Bl -dash -offset 2n -width 2n -compact
 .It
 .Ic \&Fo ,
+.Ic \&MT ,
 .Ic \&PD ,
 .Ic \&RS ,
 .Ic \&UR ,
--
 To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-06-25 11:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-25 11:46 mandoc: add support for the MT and ME mailto macros, used for example in schwarze
  -- strict thread matches above, loose matches on Subject: below --
2017-06-25 11:42 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).