diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2010-09-27 09:26:27 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2010-09-27 09:26:27 +0000 |
commit | 5e146dc806363b4ffaa3ee4856b6564254b5299a (patch) | |
tree | 5b894f7c481f45415b4faa09eaa7ff002f9bb87a /mdoc_validate.c | |
parent | 56b8aa498cd01ec108cbf961007a5fb70b85996a (diff) | |
download | mandoc-5e146dc806363b4ffaa3ee4856b6564254b5299a.tar.gz |
Ignore double-`Pp' and `Pp' before `Bd' and `Bl' (unless -compact is
specified).
Diffstat (limited to 'mdoc_validate.c')
-rw-r--r-- | mdoc_validate.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/mdoc_validate.c b/mdoc_validate.c index a9f4e56c..0f1d8a1d 100644 --- a/mdoc_validate.c +++ b/mdoc_validate.c @@ -100,6 +100,7 @@ static int pre_display(PRE_ARGS); static int pre_dt(PRE_ARGS); static int pre_it(PRE_ARGS); static int pre_os(PRE_ARGS); +static int pre_pp(PRE_ARGS); static int pre_rv(PRE_ARGS); static int pre_sh(PRE_ARGS); static int pre_ss(PRE_ARGS); @@ -129,8 +130,8 @@ static v_post posts_vt[] = { post_vt, NULL }; static v_post posts_wline[] = { bwarn_ge1, herr_eq0, NULL }; static v_post posts_wtext[] = { ewarn_ge1, NULL }; static v_pre pres_an[] = { pre_an, NULL }; -static v_pre pres_bd[] = { pre_display, pre_bd, NULL }; -static v_pre pres_bl[] = { pre_bl, NULL }; +static v_pre pres_bd[] = { pre_display, pre_bd, pre_pp, NULL }; +static v_pre pres_bl[] = { pre_bl, pre_pp, NULL }; static v_pre pres_d1[] = { pre_display, NULL }; static v_pre pres_dd[] = { pre_dd, NULL }; static v_pre pres_dt[] = { pre_dt, NULL }; @@ -139,6 +140,7 @@ static v_pre pres_ex[] = { NULL, NULL }; static v_pre pres_fd[] = { NULL, NULL }; static v_pre pres_it[] = { pre_it, NULL }; static v_pre pres_os[] = { pre_os, NULL }; +static v_pre pres_pp[] = { pre_pp, NULL }; static v_pre pres_rv[] = { pre_rv, NULL }; static v_pre pres_sh[] = { pre_sh, NULL }; static v_pre pres_ss[] = { pre_ss, NULL }; @@ -150,7 +152,7 @@ const struct valids mdoc_valids[MDOC_MAX] = { { pres_os, NULL }, /* Os */ { pres_sh, posts_sh }, /* Sh */ { pres_ss, posts_ss }, /* Ss */ - { NULL, posts_notext }, /* Pp */ + { pres_pp, posts_notext }, /* Pp */ { pres_d1, posts_wline }, /* D1 */ { pres_d1, posts_wline }, /* Dl */ { pres_bd, posts_bd_bk }, /* Bd */ @@ -1465,3 +1467,21 @@ post_sh_head(POST_ARGS) return(1); } + + +static int +pre_pp(PRE_ARGS) +{ + + if (NULL == mdoc->last || MDOC_Pp != mdoc->last->tok) + return(1); + + if (MDOC_Bl == n->tok && n->data.Bl->comp) + return(1); + if (MDOC_Bd == n->tok && n->data.Bd->comp) + return(1); + + mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_IGNPAR); + mdoc_node_delete(mdoc, mdoc->last); + return(1); +} |