From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from localhost (fantadrom.bsd.lv [local]) by fantadrom.bsd.lv (OpenSMTPD) with ESMTPA id ca9f7ea6 for ; Mon, 13 Aug 2018 20:27:52 -0500 (EST) Date: Mon, 13 Aug 2018 20:27:52 -0500 (EST) X-Mailinglist: mandoc-source Reply-To: source@mandoc.bsd.lv MIME-Version: 1.0 From: schwarze@mandoc.bsd.lv To: source@mandoc.bsd.lv Subject: mandoc: support tail arguments on the .ME and .UE macros, used for X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Message-Id: Log Message: ----------- support tail arguments on the .ME and .UE macros, used for example in the ditroff(7) manual of the groff package Modified Files: -------------- mandoc: man_macro.c man_term.c tree.c TODO mandoc/regress/man/MT: args.in args.out_ascii args.out_lint mandoc/regress/man/UR: args.in args.out_ascii args.out_lint Revision Data ------------- Index: TODO =================================================================== RCS file: /home/cvs/mandoc/mandoc/TODO,v retrieving revision 1.262 retrieving revision 1.263 diff -LTODO -LTODO -u -p -r1.262 -r1.263 --- TODO +++ TODO @@ -172,9 +172,6 @@ are mere guesses, and some may be wrong. - .SY and .YS, used by many groff manual pages -- preserve punctuation following .ME, - see ditroff(7) for an example - - .TQ tagged paragraph continuation, see groff_diff(7) for examples Index: man_macro.c =================================================================== RCS file: /home/cvs/mandoc/mandoc/man_macro.c,v retrieving revision 1.123 retrieving revision 1.124 diff -Lman_macro.c -Lman_macro.c -u -p -r1.123 -r1.124 --- man_macro.c +++ man_macro.c @@ -1,7 +1,7 @@ /* $Id$ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons - * Copyright (c) 2012-2015, 2017 Ingo Schwarze + * Copyright (c) 2012-2015, 2017, 2018 Ingo Schwarze * Copyright (c) 2013 Franco Fichtner * * Permission to use, copy, modify, and distribute this software for any @@ -189,10 +189,10 @@ rew_scope(struct roff_man *man, enum rof void blk_close(MACRO_PROT_ARGS) { - enum roff_tok ntok; + enum roff_tok ctok, ntok; const struct roff_node *nn; char *p; - int nrew, target; + int cline, cpos, nrew, target; nrew = 1; switch (tok) { @@ -234,22 +234,29 @@ blk_close(MACRO_PROT_ARGS) mandoc_msg(MANDOCERR_BLK_NOTOPEN, man->parse, line, ppos, roff_name[tok]); rew_scope(man, MAN_PP); - } else { - line = man->last->line; - ppos = man->last->pos; - ntok = man->last->tok; - man_unscope(man, nn); - - if (tok == MAN_RE && nn->head->aux > 0) - roff_setreg(man->roff, "an-margin", - nn->head->aux, '-'); - - /* Move a trailing paragraph behind the block. */ - - if (ntok == MAN_LP || ntok == MAN_PP || ntok == MAN_P) { - *pos = strlen(buf); - blk_imp(man, ntok, line, ppos, pos, buf); - } + return; + } + + cline = man->last->line; + cpos = man->last->pos; + ctok = man->last->tok; + man_unscope(man, nn); + + if (tok == MAN_RE && nn->head->aux > 0) + roff_setreg(man->roff, "an-margin", nn->head->aux, '-'); + + /* Trailing text. */ + + if (buf[*pos] != '\0') { + roff_word_alloc(man, line, ppos, buf + *pos); + man->last->flags |= NODE_DELIMC; + } + + /* Move a trailing paragraph behind the block. */ + + if (ctok == MAN_LP || ctok == MAN_PP || ctok == MAN_P) { + *pos = strlen(buf); + blk_imp(man, ctok, line, ppos, pos, buf); } } Index: man_term.c =================================================================== RCS file: /home/cvs/mandoc/mandoc/man_term.c,v retrieving revision 1.211 retrieving revision 1.212 diff -Lman_term.c -Lman_term.c -u -p -r1.211 -r1.212 --- man_term.c +++ man_term.c @@ -884,6 +884,8 @@ print_man_node(DECL_ARGS) } else if (*n->string == ' ' && n->flags & NODE_LINE && (p->flags & TERMP_NONEWLINE) == 0) term_newln(p); + else if (n->flags & NODE_DELIMC) + p->flags |= TERMP_NOSPACE; term_word(p, n->string); goto out; Index: tree.c =================================================================== RCS file: /home/cvs/mandoc/mandoc/tree.c,v retrieving revision 1.78 retrieving revision 1.79 diff -Ltree.c -Ltree.c -u -p -r1.78 -r1.79 --- tree.c +++ tree.c @@ -289,6 +289,8 @@ print_man(const struct roff_node *n, int if (NODE_LINE & n->flags) putchar('*'); printf("%d:%d", n->line, n->pos + 1); + if (NODE_DELIMC & n->flags) + putchar(')'); if (NODE_EOS & n->flags) putchar('.'); putchar('\n'); Index: args.in =================================================================== RCS file: /home/cvs/mandoc/mandoc/regress/man/MT/args.in,v retrieving revision 1.2 retrieving revision 1.3 diff -Lregress/man/MT/args.in -Lregress/man/MT/args.in -u -p -r1.2 -r1.3 --- regress/man/MT/args.in +++ regress/man/MT/args.in @@ -1,13 +1,19 @@ .\" $OpenBSD: args.in,v 1.2 2017/07/04 14:53:23 schwarze Exp $ -.TH MT-ARGS 1 "June 25, 2017" +.TH MT-ARGS 1 "August 13, 2018" .SH NAME MT-args \- argument handling of the man-ext mailto macro .SH DESCRIPTION +argument, text, and tail: +.MT test@example.com +text +.ME tail args +.PP argument plus text: .MT test@example.com invalid address .ME +next line .PP argument but no text: .MT test@example.com Index: args.out_lint =================================================================== RCS file: /home/cvs/mandoc/mandoc/regress/man/MT/args.out_lint,v retrieving revision 1.2 retrieving revision 1.3 diff -Lregress/man/MT/args.out_lint -Lregress/man/MT/args.out_lint -u -p -r1.2 -r1.3 --- regress/man/MT/args.out_lint +++ regress/man/MT/args.out_lint @@ -1,5 +1,5 @@ -mandoc: args.in:22:11: ERROR: skipping excess arguments: MT ... second -mandoc: args.in:27:11: ERROR: skipping excess arguments: MT ... second -mandoc: args.in:13:2: WARNING: empty block: MT -mandoc: args.in:17:2: WARNING: missing resource identifier, using "": MT -mandoc: args.in:27:2: WARNING: empty block: MT +mandoc: args.in:28:11: ERROR: skipping excess arguments: MT ... second +mandoc: args.in:33:11: ERROR: skipping excess arguments: MT ... second +mandoc: args.in:19:2: WARNING: empty block: MT +mandoc: args.in:23:2: WARNING: missing resource identifier, using "": MT +mandoc: args.in:33:2: WARNING: empty block: MT Index: args.out_ascii =================================================================== RCS file: /home/cvs/mandoc/mandoc/regress/man/MT/args.out_ascii,v retrieving revision 1.1 retrieving revision 1.2 diff -Lregress/man/MT/args.out_ascii -Lregress/man/MT/args.out_ascii -u -p -r1.1 -r1.2 --- regress/man/MT/args.out_ascii +++ regress/man/MT/args.out_ascii @@ -6,7 +6,9 @@ NNAAMMEE MT-args - argument handling of the man-ext mailto macro DDEESSCCRRIIPPTTIIOONN - argument plus text: invalid address + argument, text, and tail: text tail args + + argument plus text: invalid address next line argument but no text: @@ -20,4 +22,4 @@ DDEESSCCRRIIPPTTIIOONN -OpenBSD June 25, 2017 MT-ARGS(1) +OpenBSD August 13, 2018 MT-ARGS(1) Index: args.out_lint =================================================================== RCS file: /home/cvs/mandoc/mandoc/regress/man/UR/args.out_lint,v retrieving revision 1.4 retrieving revision 1.5 diff -Lregress/man/UR/args.out_lint -Lregress/man/UR/args.out_lint -u -p -r1.4 -r1.5 --- regress/man/UR/args.out_lint +++ regress/man/UR/args.out_lint @@ -1,5 +1,5 @@ -mandoc: args.in:22:11: ERROR: skipping excess arguments: UR ... second -mandoc: args.in:27:11: ERROR: skipping excess arguments: UR ... second -mandoc: args.in:13:2: WARNING: empty block: UR -mandoc: args.in:17:2: WARNING: missing resource identifier, using "": UR -mandoc: args.in:27:2: WARNING: empty block: UR +mandoc: args.in:28:11: ERROR: skipping excess arguments: UR ... second +mandoc: args.in:33:11: ERROR: skipping excess arguments: UR ... second +mandoc: args.in:19:2: WARNING: empty block: UR +mandoc: args.in:23:2: WARNING: missing resource identifier, using "": UR +mandoc: args.in:33:2: WARNING: empty block: UR Index: args.in =================================================================== RCS file: /home/cvs/mandoc/mandoc/regress/man/UR/args.in,v retrieving revision 1.2 retrieving revision 1.3 diff -Lregress/man/UR/args.in -Lregress/man/UR/args.in -u -p -r1.2 -r1.3 --- regress/man/UR/args.in +++ regress/man/UR/args.in @@ -1,13 +1,19 @@ .\" $OpenBSD: args.in,v 1.2 2017/07/04 14:53:24 schwarze Exp $ -.TH UR-ARGS 1 "October 17, 2013" +.TH UR-ARGS 1 "August 14, 2018" .SH NAME UR-basic \- argument handling of the man-ext URI macro .SH DESCRIPTION +argument, text, and tail: +.UR http://www.openbsd.org/ +text +.UE tail argument +.PP argument plus text: .UR http://www.openbsd.org/ OpenBSD homepage .UE +next line .PP argument but no text: .UR http://www.netbsd.org/ Index: args.out_ascii =================================================================== RCS file: /home/cvs/mandoc/mandoc/regress/man/UR/args.out_ascii,v retrieving revision 1.1 retrieving revision 1.2 diff -Lregress/man/UR/args.out_ascii -Lregress/man/UR/args.out_ascii -u -p -r1.1 -r1.2 --- regress/man/UR/args.out_ascii +++ regress/man/UR/args.out_ascii @@ -6,7 +6,10 @@ NNAAMMEE UR-basic - argument handling of the man-ext URI macro DDEESSCCRRIIPPTTIIOONN - argument plus text: OpenBSD homepage + argument, text, and tail: text tail argument + + argument plus text: OpenBSD homepage next + line argument but no text: @@ -20,4 +23,4 @@ DDEESSCCRRIIPPTTIIOONN -OpenBSD October 17, 2013 UR-ARGS(1) +OpenBSD August 14, 2018 UR-ARGS(1) -- To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv