From: schwarze Date: Thu, 16 Aug 2018 23:40:19 +0000 (+0000) Subject: implement the GNU man-ext .TQ macro in man(7), X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=d991fc2c8b66fe5ca2f1f2204be1fe49af11f387;p=openbsd implement the GNU man-ext .TQ macro in man(7), used for example by groff_diff(7) --- diff --git a/share/man/man7/man.7 b/share/man/man7/man.7 index a6a7c9aa7a1..db988002887 100644 --- a/share/man/man7/man.7 +++ b/share/man/man7/man.7 @@ -1,4 +1,4 @@ -.\" $OpenBSD: man.7,v 1.49 2018/04/05 22:12:09 schwarze Exp $ +.\" $OpenBSD: man.7,v 1.50 2018/08/16 23:40:19 schwarze Exp $ .\" .\" Copyright (c) 2009, 2010, 2011, 2012 Kristaps Dzonsons .\" Copyright (c) 2011-2015 Ingo Schwarze @@ -16,7 +16,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: April 5 2018 $ +.Dd $Mdocdate: August 16 2018 $ .Dt MAN 7 .Os .Sh NAME @@ -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 diff --git a/usr.bin/mandoc/man_html.c b/usr.bin/mandoc/man_html.c index 39016c56983..487bf9d2d0b 100644 --- a/usr.bin/mandoc/man_html.c +++ b/usr.bin/mandoc/man_html.c @@ -1,4 +1,4 @@ -/* $OpenBSD: man_html.c,v 1.106 2018/07/27 17:47:05 schwarze Exp $ */ +/* $OpenBSD: man_html.c,v 1.107 2018/08/16 23:40:19 schwarze Exp $ */ /* * Copyright (c) 2008-2012, 2014 Kristaps Dzonsons * Copyright (c) 2013,2014,2015,2017,2018 Ingo Schwarze @@ -73,6 +73,7 @@ static const struct htmlman __mans[MAN_MAX - MAN_TH] = { { 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 */ @@ -516,25 +517,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; diff --git a/usr.bin/mandoc/man_macro.c b/usr.bin/mandoc/man_macro.c index 59e22c4b597..6191777300a 100644 --- a/usr.bin/mandoc/man_macro.c +++ b/usr.bin/mandoc/man_macro.c @@ -1,4 +1,4 @@ -/* $OpenBSD: man_macro.c,v 1.87 2018/08/15 15:36:11 schwarze Exp $ */ +/* $OpenBSD: man_macro.c,v 1.88 2018/08/16 23:40:19 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2012-2015, 2017, 2018 Ingo Schwarze @@ -43,6 +43,7 @@ const struct man_macro __man_macros[MAN_MAX - MAN_TH] = { { 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 */ @@ -325,7 +326,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; } diff --git a/usr.bin/mandoc/man_term.c b/usr.bin/mandoc/man_term.c index 6197f65a0c4..76133ba8bf0 100644 --- a/usr.bin/mandoc/man_term.c +++ b/usr.bin/mandoc/man_term.c @@ -1,4 +1,4 @@ -/* $OpenBSD: man_term.c,v 1.165 2018/08/14 01:26:12 schwarze Exp $ */ +/* $OpenBSD: man_term.c,v 1.166 2018/08/16 23:40:19 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010-2015, 2017, 2018 Ingo Schwarze @@ -96,6 +96,7 @@ static const struct termact __termacts[MAN_MAX - MAN_TH] = { { 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 */ @@ -582,7 +583,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; diff --git a/usr.bin/mandoc/man_validate.c b/usr.bin/mandoc/man_validate.c index d35048d030b..01e38bc6f83 100644 --- a/usr.bin/mandoc/man_validate.c +++ b/usr.bin/mandoc/man_validate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: man_validate.c,v 1.106 2018/08/16 15:04:45 schwarze Exp $ */ +/* $OpenBSD: man_validate.c,v 1.107 2018/08/16 23:40:19 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2010, 2012-2018 Ingo Schwarze @@ -57,6 +57,7 @@ static const v_check man_valids[MAN_MAX - MAN_TH] = { NULL, /* SH */ NULL, /* SS */ NULL, /* TP */ + NULL, /* TQ */ check_par, /* LP */ check_par, /* PP */ check_par, /* P */ diff --git a/usr.bin/mandoc/roff.c b/usr.bin/mandoc/roff.c index 6c6261ea80f..c2f6f982300 100644 --- a/usr.bin/mandoc/roff.c +++ b/usr.bin/mandoc/roff.c @@ -1,4 +1,4 @@ -/* $OpenBSD: roff.c,v 1.203 2018/08/16 13:49:40 schwarze Exp $ */ +/* $OpenBSD: roff.c,v 1.204 2018/08/16 23:40:19 schwarze Exp $ */ /* * Copyright (c) 2008-2012, 2014 Kristaps Dzonsons * Copyright (c) 2010-2015, 2017, 2018 Ingo Schwarze @@ -325,6 +325,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", diff --git a/usr.bin/mandoc/roff.h b/usr.bin/mandoc/roff.h index a13d9662bf1..1c5fd059b12 100644 --- a/usr.bin/mandoc/roff.h +++ b/usr.bin/mandoc/roff.h @@ -1,4 +1,4 @@ -/* $OpenBSD: roff.h,v 1.41 2018/04/11 17:10:35 schwarze Exp $ */ +/* $OpenBSD: roff.h,v 1.42 2018/08/16 23:40:19 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2013, 2014, 2015, 2017 Ingo Schwarze @@ -438,6 +438,7 @@ enum roff_tok { MAN_SH, MAN_SS, MAN_TP, + MAN_TQ, MAN_LP, MAN_PP, MAN_P,