From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from scc-mailout-kit-01.scc.kit.edu (scc-mailout-kit-01.scc.kit.edu [129.13.231.81]) by fantadrom.bsd.lv (OpenSMTPD) with ESMTP id f34e050d for ; Mon, 6 Mar 2017 12:34:09 -0500 (EST) Received: from asta-nat.asta.uni-karlsruhe.de ([172.22.63.82] helo=hekate.usta.de) by scc-mailout-kit-01.scc.kit.edu with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (envelope-from ) id 1ckwWM-0005Ac-L9; Mon, 06 Mar 2017 18:34:08 +0100 Received: from donnerwolke.usta.de ([172.24.96.3]) by hekate.usta.de with esmtp (Exim 4.77) (envelope-from ) id 1ckwWM-00087x-2I; Mon, 06 Mar 2017 18:34:06 +0100 Received: from athene.usta.de ([172.24.96.10]) by donnerwolke.usta.de with esmtp (Exim 4.84_2) (envelope-from ) id 1ckwWL-0002wj-Ua; Mon, 06 Mar 2017 18:34:06 +0100 Received: from localhost (athene.usta.de [local]) by athene.usta.de (OpenSMTPD) with ESMTPA id 9a88c4ca; Mon, 6 Mar 2017 18:34:05 +0100 (CET) Date: Mon, 6 Mar 2017 18:34:05 +0100 From: Ingo Schwarze To: Dag-Erling =?utf-8?B?U23DuHJncmF2?= Cc: discuss@mdocml.bsd.lv Subject: Re: Dashes and strange markup Message-ID: <20170306173405.GD58385@athene.usta.de> References: <86wpc2ac39.fsf@desk.des.no> <20170306155714.GB58385@athene.usta.de> <86h936pdes.fsf@desk.des.no> X-Mailinglist: mdocml-discuss Reply-To: discuss@mdocml.bsd.lv MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <86h936pdes.fsf@desk.des.no> User-Agent: Mutt/1.6.2 (2016-07-01) Hi, Dag-Erling Smoergrav wrote on Mon, Mar 06, 2017 at 05:39:55PM +0100: > Ingo Schwarze writes: >> Well, abusing .Nd outside NAME is so bizarre that being forgiving >> about it would be a bad idea. > Technically, mandoc *is* forgiving about it: it renders it the way the > author (incorrectly) expected instead of throwing an error, which is > probably why it has gone unnoticed until now. Good point! Now, mandoc(1) never errors out, which is an important feature. But it should indeed throw a warning. I just committed the patch below, implementing the missing warning. >> Anthony correctly answered the rest, so my impression is that no >> code or documentation changes are required. > I asked for advice, not changes. Fair enough. Then again, when intelligent people ask for advice, there is often something that can be improved. :) Thanks for the report, Ingo Log Message: ----------- Using .Nd only makes sense in the NAME section. Warn if that macro occurs elsewhere. Triggered by a question from Dag-Erling Smoergrav . Modified Files: -------------- mdocml: mandoc.1 mandoc.h mdoc_validate.c read.c mdocml/regress/mdoc/Nd: broken.out_lint Revision Data ------------- Index: mandoc.1 =================================================================== RCS file: /home/cvs/mdocml/mdocml/mandoc.1,v retrieving revision 1.176 retrieving revision 1.177 diff -Lmandoc.1 -Lmandoc.1 -u -p -r1.176 -r1.177 --- mandoc.1 +++ mandoc.1 @@ -908,6 +908,14 @@ The .Ic \&Nd macro lacks the required argument. The title line of the manual will end after the dash. +.It Sy "description line outside NAME section" +.Pq mdoc +An +.Ic \&Nd +macro appears outside the NAME section. +The arguments are printed anyway and the following text is used for +.Xr apropos 1 , +but none of that behaviour is portable. .It Sy "sections out of conventional order" .Pq mdoc A standard section occurs after another section it usually precedes. Index: read.c =================================================================== RCS file: /home/cvs/mdocml/mdocml/read.c,v retrieving revision 1.161 retrieving revision 1.162 diff -Lread.c -Lread.c -u -p -r1.161 -r1.162 --- read.c +++ read.c @@ -113,6 +113,7 @@ static const char * const mandocerrs[MAN "bad NAME section content", "missing comma before name", "missing description line, using \"\"", + "description line outside NAME section", "sections out of conventional order", "duplicate section title", "unexpected section", Index: mandoc.h =================================================================== RCS file: /home/cvs/mdocml/mdocml/mandoc.h,v retrieving revision 1.214 retrieving revision 1.215 diff -Lmandoc.h -Lmandoc.h -u -p -r1.214 -r1.215 --- mandoc.h +++ mandoc.h @@ -71,6 +71,7 @@ enum mandocerr { MANDOCERR_NAMESEC_BAD, /* bad NAME section content: macro */ MANDOCERR_NAMESEC_PUNCT, /* missing comma before name: Nm name */ MANDOCERR_ND_EMPTY, /* missing description line, using "" */ + MANDOCERR_ND_LATE, /* description line outside NAME section */ MANDOCERR_SEC_ORDER, /* sections out of conventional order: Sh title */ MANDOCERR_SEC_REP, /* duplicate section title: Sh title */ MANDOCERR_SEC_MSEC, /* unexpected section: Sh title for ... only */ Index: mdoc_validate.c =================================================================== RCS file: /home/cvs/mdocml/mdocml/mdoc_validate.c,v retrieving revision 1.318 retrieving revision 1.319 diff -Lmdoc_validate.c -Lmdoc_validate.c -u -p -r1.318 -r1.319 --- mdoc_validate.c +++ mdoc_validate.c @@ -1035,6 +1035,10 @@ post_nd(POST_ARGS) if (n->type != ROFFT_BODY) return; + if (n->sec != SEC_NAME) + mandoc_msg(MANDOCERR_ND_LATE, mdoc->parse, + n->line, n->pos, "Nd"); + if (n->child == NULL) mandoc_msg(MANDOCERR_ND_EMPTY, mdoc->parse, n->line, n->pos, "Nd"); Index: broken.out_lint =================================================================== RCS file: /home/cvs/mdocml/mdocml/regress/mdoc/Nd/broken.out_lint,v retrieving revision 1.2 retrieving revision 1.3 diff -Lregress/mdoc/Nd/broken.out_lint -Lregress/mdoc/Nd/broken.out_lint -u -p -r1.2 -r1.3 --- regress/mdoc/Nd/broken.out_lint +++ regress/mdoc/Nd/broken.out_lint @@ -3,5 +3,7 @@ mandoc: broken.in:5:2: WARNING: bad NAME mandoc: broken.in:9:1: WARNING: bad NAME section content: text mandoc: broken.in:4:2: WARNING: NAME section without Nm before Nd mandoc: broken.in:4:2: WARNING: NAME section without description +mandoc: broken.in:16:2: WARNING: description line outside NAME section: Nd mandoc: broken.in:13:2: WARNING: moving content out of list: Bl mandoc: broken.in:18:1: WARNING: moving content out of list: text +mandoc: broken.in:27:2: WARNING: description line outside NAME section: Nd -- To unsubscribe send an email to discuss+unsubscribe@mdocml.bsd.lv