From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from krisdoz.my.domain (schwarze@localhost [127.0.0.1]) by krisdoz.my.domain (8.14.3/8.14.3) with ESMTP id pA71OeSZ027496 for ; Sun, 6 Nov 2011 20:24:40 -0500 (EST) Received: (from schwarze@localhost) by krisdoz.my.domain (8.14.3/8.14.3/Submit) id pA71Oeov007475; Sun, 6 Nov 2011 20:24:40 -0500 (EST) Date: Sun, 6 Nov 2011 20:24:40 -0500 (EST) Message-Id: <201111070124.pA71Oeov007475@krisdoz.my.domain> X-Mailinglist: mdocml-source Reply-To: source@mdocml.bsd.lv MIME-Version: 1.0 From: schwarze@mdocml.bsd.lv To: source@mdocml.bsd.lv Subject: mdocml: When the HEAD scope of .TP is broken by another block macro, do X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Log Message: ----------- When the HEAD scope of .TP is broken by another block macro, do not abort with a FATAL error, but report a report a WARNING, remove the broken .TP from the syntax tree, and prod on. Reported repeatedly by ports people, at least by brad@ and jeremy@. Also fixes rendition(4) in Xenocara. ok kristaps@ Modified Files: -------------- mdocml: TODO libman.h man.c man_macro.c man_validate.c mandoc.h read.c Revision Data ------------- Index: TODO =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/TODO,v retrieving revision 1.122 retrieving revision 1.123 diff -LTODO -LTODO -u -p -r1.122 -r1.123 --- TODO +++ TODO @@ -12,11 +12,6 @@ and then triggers an unknown macro error reported by naddy@ Sun, 3 Jul 2011 21:52:24 +0200 -- .TP before .SH is still FATAL in man(7) - reported by brad@ Sat, 15 Jan 2011 15:54:54 -0500 - also occurs in emulators/pcsxr/patches/patch-doc_pcsx_1 - jeremy@ commit Wed, 7 Sep 2011 10:00:19 -0600 (MDT) - ************************************************************************ * formatter bugs ************************************************************************ @@ -192,6 +187,7 @@ .It Em AuthenticationKey Length ought to render "Key Length" with emphasis, too, see OpenBSD iked.conf(5). + reported again Nicolas Joly via wiz@ Wed, 12 Oct 2011 00:20:00 +0200 - empty phrases in .Bl column produce too few blanks try e.g. .Bl -column It Ta Ta Index: man.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man.c,v retrieving revision 1.112 retrieving revision 1.113 diff -Lman.c -Lman.c -u -p -r1.112 -r1.113 --- man.c +++ man.c @@ -543,10 +543,37 @@ man_pmacro(struct man *m, int ln, char * n = n->parent; mandoc_vmsg(MANDOCERR_LINESCOPE, m->parse, n->line, - n->pos, "%s", man_macronames[n->tok]); + n->pos, "%s breaks %s", man_macronames[tok], + man_macronames[n->tok]); man_node_delete(m, n); m->flags &= ~MAN_ELINE; + } + + /* + * Remove prior BLINE macro that is being clobbered. + */ + if ((m->flags & MAN_BLINE) && + (MAN_BSCOPE & man_macros[tok].flags)) { + n = m->last; + assert(MAN_TEXT != n->type); + + /* Remove element that didn't end BLINE, if any. */ + + if ( ! (MAN_BSCOPE & man_macros[n->tok].flags)) + n = n->parent; + + assert(MAN_HEAD == n->type); + n = n->parent; + assert(MAN_BLOCK == n->type); + assert(MAN_SCOPED & man_macros[n->tok].flags); + + mandoc_vmsg(MANDOCERR_LINESCOPE, m->parse, n->line, + n->pos, "%s breaks %s", man_macronames[tok], + man_macronames[n->tok]); + + man_node_delete(m, n); + m->flags &= ~MAN_BLINE; } /* Index: mandoc.h =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mandoc.h,v retrieving revision 1.96 retrieving revision 1.97 diff -Lmandoc.h -Lmandoc.h -u -p -r1.96 -r1.97 --- mandoc.h +++ mandoc.h @@ -150,7 +150,6 @@ enum mandocerr { MANDOCERR_NOTMANUAL, /* manual isn't really a manual */ MANDOCERR_COLUMNS, /* column syntax is inconsistent */ MANDOCERR_BADDISP, /* NOT IMPLEMENTED: .Bd -file */ - MANDOCERR_SYNTLINESCOPE, /* line scope broken, syntax violated */ MANDOCERR_SYNTARGVCOUNT, /* argument count wrong, violates syntax */ MANDOCERR_SYNTCHILD, /* child violates parent syntax */ MANDOCERR_SYNTARGCOUNT, /* argument count wrong, violates syntax */ Index: libman.h =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/libman.h,v retrieving revision 1.54 retrieving revision 1.55 diff -Llibman.h -Llibman.h -u -p -r1.54 -r1.55 --- libman.h +++ libman.h @@ -54,6 +54,7 @@ struct man_macro { #define MAN_FSCOPED (1 << 2) /* See blk_imp(). */ #define MAN_NSCOPED (1 << 3) /* See in_line_eoln(). */ #define MAN_NOCLOSE (1 << 4) /* See blk_exp(). */ +#define MAN_BSCOPE (1 << 5) /* Break BLINE scope. */ }; extern const struct man_macro *const man_macros; Index: read.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/read.c,v retrieving revision 1.25 retrieving revision 1.26 diff -Lread.c -Lread.c -u -p -r1.25 -r1.26 --- read.c +++ read.c @@ -192,7 +192,6 @@ static const char * const mandocerrs[MAN "not a manual", "column syntax is inconsistent", "NOT IMPLEMENTED: .Bd -file", - "line scope broken, syntax violated", "argument count wrong, violates syntax", "child violates parent syntax", "argument count wrong, violates syntax", Index: man_validate.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man_validate.c,v retrieving revision 1.77 retrieving revision 1.78 diff -Lman_validate.c -Lman_validate.c -u -p -r1.77 -r1.78 --- man_validate.c +++ man_validate.c @@ -44,7 +44,6 @@ struct man_valid { v_check *posts; }; -static int check_bline(CHKARGS); static int check_eq0(CHKARGS); static int check_le1(CHKARGS); static int check_ge2(CHKARGS); @@ -76,20 +75,19 @@ static v_check posts_sec[] = { post_se static v_check posts_sp[] = { post_vs, check_le1, NULL }; static v_check posts_th[] = { check_ge2, check_le5, post_TH, NULL }; static v_check posts_uc[] = { post_UC, NULL }; -static v_check pres_bline[] = { check_bline, NULL }; -static v_check pres_sec[] = { check_bline, pre_sec, NULL}; +static v_check pres_sec[] = { pre_sec, NULL }; static const struct man_valid man_valids[MAN_MAX] = { { NULL, posts_br }, /* br */ - { pres_bline, posts_th }, /* TH */ + { NULL, posts_th }, /* TH */ { pres_sec, posts_sec }, /* SH */ { pres_sec, posts_sec }, /* SS */ - { pres_bline, NULL }, /* TP */ - { pres_bline, posts_par }, /* LP */ - { pres_bline, posts_par }, /* PP */ - { pres_bline, posts_par }, /* P */ - { pres_bline, NULL }, /* IP */ - { pres_bline, NULL }, /* HP */ + { NULL, NULL }, /* TP */ + { NULL, posts_par }, /* LP */ + { NULL, posts_par }, /* PP */ + { NULL, posts_par }, /* P */ + { NULL, NULL }, /* IP */ + { NULL, NULL }, /* HP */ { NULL, NULL }, /* SM */ { NULL, NULL }, /* SB */ { NULL, NULL }, /* BI */ @@ -103,8 +101,8 @@ static const struct man_valid man_valids { NULL, NULL }, /* RI */ { NULL, posts_eq0 }, /* na */ /* FIXME: should warn only. */ { NULL, posts_sp }, /* sp */ /* FIXME: should warn only. */ - { pres_bline, posts_nf }, /* nf */ - { pres_bline, posts_fi }, /* fi */ + { NULL, posts_nf }, /* nf */ + { NULL, posts_fi }, /* fi */ { NULL, NULL }, /* RE */ { NULL, posts_part }, /* RS */ { NULL, NULL }, /* DT */ @@ -350,19 +348,6 @@ check_par(CHKARGS) return(1); } - -static int -check_bline(CHKARGS) -{ - - assert( ! (MAN_ELINE & m->flags)); - if (MAN_BLINE & m->flags) { - man_nmsg(m, n, MANDOCERR_SYNTLINESCOPE); - return(0); - } - - return(1); -} static int post_TH(CHKARGS) Index: man_macro.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man_macro.c,v retrieving revision 1.65 retrieving revision 1.66 diff -Lman_macro.c -Lman_macro.c -u -p -r1.65 -r1.66 --- man_macro.c +++ man_macro.c @@ -52,15 +52,15 @@ static void rew_warn(struct man *, const struct man_macro __man_macros[MAN_MAX] = { { in_line_eoln, MAN_NSCOPED }, /* br */ - { in_line_eoln, 0 }, /* TH */ - { blk_imp, MAN_SCOPED }, /* SH */ - { blk_imp, MAN_SCOPED }, /* SS */ - { blk_imp, MAN_SCOPED | MAN_FSCOPED }, /* TP */ - { blk_imp, 0 }, /* LP */ - { blk_imp, 0 }, /* PP */ - { blk_imp, 0 }, /* P */ - { blk_imp, 0 }, /* IP */ - { blk_imp, 0 }, /* HP */ + { in_line_eoln, MAN_BSCOPE }, /* TH */ + { blk_imp, MAN_BSCOPE | MAN_SCOPED }, /* SH */ + { blk_imp, MAN_BSCOPE | MAN_SCOPED }, /* SS */ + { blk_imp, MAN_BSCOPE | MAN_SCOPED | MAN_FSCOPED }, /* TP */ + { blk_imp, MAN_BSCOPE }, /* LP */ + { blk_imp, MAN_BSCOPE }, /* PP */ + { blk_imp, MAN_BSCOPE }, /* P */ + { blk_imp, MAN_BSCOPE }, /* IP */ + { blk_imp, MAN_BSCOPE }, /* HP */ { in_line_eoln, MAN_SCOPED }, /* SM */ { in_line_eoln, MAN_SCOPED }, /* SB */ { in_line_eoln, 0 }, /* BI */ @@ -74,8 +74,8 @@ const struct man_macro __man_macros[MAN_ { in_line_eoln, 0 }, /* RI */ { in_line_eoln, MAN_NSCOPED }, /* na */ { in_line_eoln, MAN_NSCOPED }, /* sp */ - { in_line_eoln, 0 }, /* nf */ - { in_line_eoln, 0 }, /* fi */ + { in_line_eoln, MAN_BSCOPE }, /* nf */ + { in_line_eoln, MAN_BSCOPE }, /* fi */ { blk_close, 0 }, /* RE */ { blk_exp, MAN_EXPLICIT }, /* RS */ { in_line_eoln, 0 }, /* DT */ -- To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv