diff options
-rw-r--r-- | regress/usr.bin/mandoc/mdoc/Nm/Makefile | 9 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/mdoc/Nm/par.in | 11 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/mdoc/Nm/par.out_ascii | 11 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/mdoc/Nm/parns.in | 23 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/mdoc/Nm/parns.out_ascii | 17 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc_macro.c | 15 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc_validate.c | 16 |
7 files changed, 90 insertions, 12 deletions
diff --git a/regress/usr.bin/mandoc/mdoc/Nm/Makefile b/regress/usr.bin/mandoc/mdoc/Nm/Makefile index d575de0285a..c8bce02c630 100644 --- a/regress/usr.bin/mandoc/mdoc/Nm/Makefile +++ b/regress/usr.bin/mandoc/mdoc/Nm/Makefile @@ -1,8 +1,8 @@ -# $OpenBSD: Makefile,v 1.11 2015/02/02 04:04:18 schwarze Exp $ +# $OpenBSD: Makefile,v 1.12 2015/02/03 00:48:27 schwarze Exp $ REGRESS_TARGETS = badNAME badNAMEuse break broken REGRESS_TARGETS += empty emptyNAME emptyNAMEuse -REGRESS_TARGETS += font long punct +REGRESS_TARGETS += font long par parns punct LINT_TARGETS = badNAME badNAMEuse break @@ -13,9 +13,10 @@ LINT_TARGETS = badNAME badNAMEuse break # - When the head of an Nm block in the SYNOPSIS is broken by an # explicit block end macro on the same line, formatting differs, # but doesn't make sense either way. +# - Groff doesn't support the nS register. -SKIP_GROFF = badNAMEuse emptyNAMEuse broken -SKIP_TMAN = broken SILENT +SKIP_GROFF = badNAMEuse emptyNAMEuse broken parns +SKIP_TMAN = broken par parns # groff-1.22.3 defect: # When a SYNOPSIS Nm block head breaks a sub block, all the diff --git a/regress/usr.bin/mandoc/mdoc/Nm/par.in b/regress/usr.bin/mandoc/mdoc/Nm/par.in new file mode 100644 index 00000000000..1d5e3ebd70a --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/Nm/par.in @@ -0,0 +1,11 @@ +.Dd February 3, 2015 +.Dt NM-PAR 1 +.Os OpenBSD +.Sh NAME +.Nm Nm-par +.Nd paragraph macro in a synopsis name block +.Sh SYNOPSIS +.Nm +.Fl a +.Pp +.Fl b diff --git a/regress/usr.bin/mandoc/mdoc/Nm/par.out_ascii b/regress/usr.bin/mandoc/mdoc/Nm/par.out_ascii new file mode 100644 index 00000000000..8943d37f0b5 --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/Nm/par.out_ascii @@ -0,0 +1,11 @@ +NM-PAR(1) General Commands Manual NM-PAR(1) + +NNAAMMEE + NNmm--ppaarr - paragraph macro in a synopsis name block + +SSYYNNOOPPSSIISS + NNmm--ppaarr --aa + + --bb + +OpenBSD February 3, 2015 OpenBSD diff --git a/regress/usr.bin/mandoc/mdoc/Nm/parns.in b/regress/usr.bin/mandoc/mdoc/Nm/parns.in new file mode 100644 index 00000000000..03f2d641d72 --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/Nm/parns.in @@ -0,0 +1,23 @@ +.Dd February 3, 2015 +.Dt NM-PAR 1 +.Os OpenBSD +.Sh NAME +.Nm Nm-par +.Nd paragraph macro in a name block +.Sh DESCRIPTION +.nr nS 1 +.Nm +.Fl a +.Pp +.Fl b +.Nm +.Fl a +.nr nS 0 +.Pp +.Fl b +.nr nS 1 +.Nm +.Oo Fl a +.nr nS 0 +.Pp +.Fl b Oc diff --git a/regress/usr.bin/mandoc/mdoc/Nm/parns.out_ascii b/regress/usr.bin/mandoc/mdoc/Nm/parns.out_ascii new file mode 100644 index 00000000000..daa6331e90e --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/Nm/parns.out_ascii @@ -0,0 +1,17 @@ +NM-PAR(1) General Commands Manual NM-PAR(1) + +NNAAMMEE + NNmm--ppaarr - paragraph macro in a name block + +DDEESSCCRRIIPPTTIIOONN + NNmm--ppaarr --aa + + --bb + NNmm--ppaarr --aa + + --bb + NNmm--ppaarr [--aa + + --bb] + +OpenBSD February 3, 2015 OpenBSD diff --git a/usr.bin/mandoc/mdoc_macro.c b/usr.bin/mandoc/mdoc_macro.c index e54625fa504..12e7dd62dcb 100644 --- a/usr.bin/mandoc/mdoc_macro.c +++ b/usr.bin/mandoc/mdoc_macro.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mdoc_macro.c,v 1.125 2015/02/02 19:22:46 schwarze Exp $ */ +/* $OpenBSD: mdoc_macro.c,v 1.126 2015/02/03 00:48:27 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010, 2012-2015 Ingo Schwarze <schwarze@openbsd.org> @@ -1457,10 +1457,17 @@ in_line_argn(MACRO_PROT_ARGS) static void in_line_eoln(MACRO_PROT_ARGS) { - struct mdoc_arg *arg; + struct mdoc_node *n; + struct mdoc_arg *arg; - if (tok == MDOC_Pp) - rew_sub(MDOC_BLOCK, mdoc, MDOC_Nm, line, ppos); + if ((tok == MDOC_Pp || tok == MDOC_Lp) && + ! (mdoc->flags & MDOC_SYNOPSIS)) { + n = mdoc->last; + if (mdoc->next == MDOC_NEXT_SIBLING) + n = n->parent; + if (n->tok == MDOC_Nm) + rew_last(mdoc, mdoc->last->parent); + } mdoc_argv(mdoc, line, tok, &arg, pos, buf); mdoc_elem_alloc(mdoc, line, ppos, tok, arg); diff --git a/usr.bin/mandoc/mdoc_validate.c b/usr.bin/mandoc/mdoc_validate.c index 760592f10fd..38c8e5fb0f5 100644 --- a/usr.bin/mandoc/mdoc_validate.c +++ b/usr.bin/mandoc/mdoc_validate.c @@ -1,7 +1,7 @@ -/* $OpenBSD: mdoc_validate.c,v 1.181 2014/12/18 20:15:31 schwarze Exp $ */ +/* $OpenBSD: mdoc_validate.c,v 1.182 2015/02/03 00:48:27 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> - * Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org> + * Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org> * Copyright (c) 2010 Joerg Sonnenberger <joerg@netbsd.org> * * Permission to use, copy, modify, and distribute this software for any @@ -1038,15 +1038,23 @@ post_vt(POST_ARGS) static void post_nm(POST_ARGS) { + struct mdoc_node *n; + + n = mdoc->last; + + if (n->last != NULL && + (n->last->tok == MDOC_Pp || + n->last->tok == MDOC_Lp)) + mdoc_node_relink(mdoc, n->last); if (NULL != mdoc->meta.name) return; - mdoc_deroff(&mdoc->meta.name, mdoc->last); + mdoc_deroff(&mdoc->meta.name, n); if (NULL == mdoc->meta.name) mandoc_msg(MANDOCERR_NM_NONAME, mdoc->parse, - mdoc->last->line, mdoc->last->pos, "Nm"); + n->line, n->pos, "Nm"); } static void |