From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp1.rz.uni-karlsruhe.de (Debian-exim@smtp1.rz.uni-karlsruhe.de [129.13.185.217]) by krisdoz.my.domain (8.14.3/8.14.3) with ESMTP id o5REY4CM006923 for ; Sun, 27 Jun 2010 10:34:05 -0400 (EDT) Received: from hekate.usta.de (asta-nat.asta.uni-karlsruhe.de [172.22.63.82]) by smtp1.rz.uni-karlsruhe.de with esmtp (Exim 4.63 #1) id 1OSsvp-00054m-NT; Sun, 27 Jun 2010 16:34:01 +0200 Received: from donnerwolke.usta.de ([172.24.96.3]) by hekate.usta.de with esmtp (Exim 4.71) (envelope-from ) id 1OSsvp-000666-MO; Sun, 27 Jun 2010 16:34:01 +0200 Received: from iris.usta.de ([172.24.96.5] helo=usta.de) by donnerwolke.usta.de with esmtp (Exim 4.69) (envelope-from ) id 1OSsvp-0001aU-Lg; Sun, 27 Jun 2010 16:34:01 +0200 Received: from schwarze by usta.de with local (Exim 4.71) (envelope-from ) id 1OSsvp-0007Me-Kw; Sun, 27 Jun 2010 16:34:01 +0200 Date: Sun, 27 Jun 2010 16:34:01 +0200 From: Ingo Schwarze To: tech@mdocml.bsd.lv Cc: jmc@openbsd.org Subject: Re: mdocml: Basic implementation of .Bk/.Ek; from OpenBSD. Message-ID: <20100627143401.GB19398@iris.usta.de> References: <201006270126.o5R1QL1S015718@krisdoz.my.domain> <4C271923.6070407@bsd.lv> X-Mailinglist: mdocml-tech Reply-To: tech@mdocml.bsd.lv MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4C271923.6070407@bsd.lv> User-Agent: Mutt/1.5.20 (2009-06-14) Hi Kristaps, > Remember the mdoc.7 entries! Sorry for forgetting; this is now done. > All usages of `Bk' seem to use `-words'. Right, and it is documented accordingly: More work needs to be done with the keep macros; a -line option needs to be added. -- from mdoc.samples This is correct except that "-line" ought to read "-lines". > Does not using this flag change the macros behaviour? Here is old groff's behaviour: no arg: Usage: .Bk [-lines | -words] (#13) and ignoring .Bk -lines: Not implemented yet. (#47) and ignoring .Bk -line: No error message and ignoring .Bk Here is new groff's behavious: no arg: no error message, and assuming -words -lines: Not implemented yet. (#21) and assuming -words -line: no error message, and assuming -words Great, isn't it? So, here is a patch to * not print invalid arguments verbatim (no groffs prints them, either) * not trigger TERMP_PREKEEP twice * not die from invlid arguments (groff won't die, either) * continue to ignore even valid arguments (just like groff) OK? Index: mdoc_term.c =================================================================== RCS file: /cvs/src/usr.bin/mandoc/mdoc_term.c,v retrieving revision 1.90 diff -u -p -r1.90 mdoc_term.c --- mdoc_term.c 27 Jun 2010 01:24:02 -0000 1.90 +++ mdoc_term.c 27 Jun 2010 14:15:31 -0000 @@ -2104,8 +2104,17 @@ static int termp_bk_pre(DECL_ARGS) { - p->flags |= TERMP_PREKEEP; - return(1); + switch (n->type) { + case (MDOC_BLOCK): + return(1); + case (MDOC_HEAD): + return(0); + case (MDOC_BODY): + p->flags |= TERMP_PREKEEP; + return(1); + default: + abort(); + } } @@ -2114,7 +2123,8 @@ static void termp_bk_post(DECL_ARGS) { - p->flags &= ~(TERMP_KEEP | TERMP_PREKEEP); + if (MDOC_HEAD == n->type) + p->flags &= ~(TERMP_KEEP | TERMP_PREKEEP); } /* ARGSUSED */ Index: mdoc_validate.c =================================================================== RCS file: /cvs/src/usr.bin/mandoc/mdoc_validate.c,v retrieving revision 1.61 diff -u -p -r1.61 mdoc_validate.c --- mdoc_validate.c 26 Jun 2010 17:56:43 -0000 1.61 +++ mdoc_validate.c 27 Jun 2010 14:15:32 -0000 @@ -103,7 +103,7 @@ static int pre_ss(PRE_ARGS); static v_post posts_an[] = { post_an, NULL }; static v_post posts_at[] = { post_at, NULL }; -static v_post posts_bd[] = { hwarn_eq0, bwarn_ge1, NULL }; +static v_post posts_bd_bk[] = { hwarn_eq0, bwarn_ge1, NULL }; static v_post posts_bf[] = { hwarn_le1, post_bf, NULL }; static v_post posts_bl[] = { bwarn_ge1, post_bl, NULL }; static v_post posts_bool[] = { eerr_eq1, ebool, NULL }; @@ -150,7 +150,7 @@ const struct valids mdoc_valids[MDOC_MAX { NULL, posts_notext }, /* Pp */ { pres_d1, posts_wline }, /* D1 */ { pres_d1, posts_wline }, /* Dl */ - { pres_bd, posts_bd }, /* Bd */ + { pres_bd, posts_bd_bk }, /* Bd */ { NULL, NULL }, /* Ed */ { pres_bl, posts_bl }, /* Bl */ { NULL, NULL }, /* El */ @@ -241,7 +241,7 @@ const struct valids mdoc_valids[MDOC_MAX { NULL, NULL }, /* Fc */ { NULL, NULL }, /* Oo */ { NULL, NULL }, /* Oc */ - { NULL, posts_wline }, /* Bk */ + { NULL, posts_bd_bk }, /* Bk */ { NULL, NULL }, /* Ek */ { NULL, posts_eoln }, /* Bt */ { NULL, NULL }, /* Hf */ -- To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv