aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-09-27 09:26:27 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-09-27 09:26:27 +0000
commit2da6c4a2249e27899c00839a6d4bc3c71011e718 (patch)
tree3f16a094d15fca487c4eae3e8cd4599031bab4b7
parent56c1c592a8f53caa77000740b73deeead6497253 (diff)
downloadmandoc-2da6c4a2249e27899c00839a6d4bc3c71011e718.tar.gz
mandoc-2da6c4a2249e27899c00839a6d4bc3c71011e718.tar.zst
mandoc-2da6c4a2249e27899c00839a6d4bc3c71011e718.zip
Ignore double-`Pp' and `Pp' before `Bd' and `Bl' (unless -compact is
specified).
-rw-r--r--TODO6
-rw-r--r--main.c3
-rw-r--r--mandoc.h3
-rw-r--r--mdoc_validate.c28
4 files changed, 29 insertions, 11 deletions
diff --git a/TODO b/TODO
index 9b549ebc..be89eb69 100644
--- a/TODO
+++ b/TODO
@@ -1,6 +1,6 @@
************************************************************************
* Official mandoc TODO.
-* $Id: TODO,v 1.52 2010/09/25 16:52:15 kristaps Exp $
+* $Id: TODO,v 1.53 2010/09/27 09:26:27 kristaps Exp $
************************************************************************
************************************************************************
@@ -145,10 +145,6 @@
on the next line, it must be indented by -width, not width+1;
see "rule block|pass" in OpenBSD ifconfig(8).
-- Bogus .Pp before .Bl should not cause a double blank line,
- see "The route utility provides the following simple commands:"
- in OpenBSD route(8).
-
************************************************************************
* performance issues
************************************************************************
diff --git a/main.c b/main.c
index f1d64062..97c3390b 100644
--- a/main.c
+++ b/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.106 2010/09/26 20:22:28 schwarze Exp $ */
+/* $Id: main.c,v 1.107 2010/09/27 09:26:27 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org>
@@ -174,6 +174,7 @@ static const char * const mandocerrs[MANDOCERR_MAX] = {
"missing font type",
"line argument(s) will be lost",
"body argument(s) will be lost",
+ "paragraph macro ignored",
"generic fatal error",
diff --git a/mandoc.h b/mandoc.h
index ec603ace..aeda6494 100644
--- a/mandoc.h
+++ b/mandoc.h
@@ -1,4 +1,4 @@
-/* $Id: mandoc.h,v 1.19 2010/09/26 20:22:28 schwarze Exp $ */
+/* $Id: mandoc.h,v 1.20 2010/09/27 09:26:27 kristaps Exp $ */
/*
* Copyright (c) 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -99,6 +99,7 @@ enum mandocerr {
MANDOCERR_FONTTYPE, /* missing font type */
MANDOCERR_ARGSLOST, /* line argument(s) will be lost */
MANDOCERR_BODYLOST, /* body argument(s) will be lost */
+ MANDOCERR_IGNPAR, /* paragraph macro ignored */
MANDOCERR_FATAL, /* ===== end of fatal errors ===== */
diff --git a/mdoc_validate.c b/mdoc_validate.c
index 617ee6e8..783f2c78 100644
--- a/mdoc_validate.c
+++ b/mdoc_validate.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_validate.c,v 1.116 2010/08/29 10:30:58 kristaps Exp $ */
+/* $Id: mdoc_validate.c,v 1.117 2010/09/27 09:26:27 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -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);
+}