diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2010-06-27 17:53:27 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2010-06-27 17:53:27 +0000 |
commit | f4c4484c34c9d8eb90438b89791384876bf8efde (patch) | |
tree | 8a46a500d71d41c1f76ee8122945853cbdd1fbb0 | |
parent | 813526936b156ae4cb58886a8969886153ed6139 (diff) | |
download | mandoc-f4c4484c34c9d8eb90438b89791384876bf8efde.tar.gz |
minor .Bk fixes:
* do not print invalid arguments verbatim (no groffs prints them, either)
* do not trigger TERMP_PREKEEP twice
* do not die from invlid arguments (groff won't die, either)
* continue to ignore even valid arguments (just like groff)
ok kristaps@ on the previous version, before removing my last bug ;)
-rw-r--r-- | mdoc_term.c | 16 | ||||
-rw-r--r-- | mdoc_validate.c | 6 |
2 files changed, 16 insertions, 6 deletions
diff --git a/mdoc_term.c b/mdoc_term.c index 3352bf77..cae18fa3 100644 --- a/mdoc_term.c +++ b/mdoc_term.c @@ -2109,8 +2109,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(); + } } @@ -2119,7 +2128,8 @@ static void termp_bk_post(DECL_ARGS) { - p->flags &= ~(TERMP_KEEP | TERMP_PREKEEP); + if (MDOC_BODY == n->type) + p->flags &= ~(TERMP_KEEP | TERMP_PREKEEP); } /* ARGSUSED */ diff --git a/mdoc_validate.c b/mdoc_validate.c index 99c2e359..81fd7906 100644 --- a/mdoc_validate.c +++ b/mdoc_validate.c @@ -107,7 +107,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 }; @@ -154,7 +154,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 */ @@ -245,7 +245,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 */ |