source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: Ignore double-`Pp' and `Pp' before `Bd' and `Bl' (unless
@ 2010-09-27  9:26 kristaps
  0 siblings, 0 replies; only message in thread
From: kristaps @ 2010-09-27  9:26 UTC (permalink / raw)
  To: source

Log Message:
-----------
Ignore double-`Pp' and `Pp' before `Bd' and `Bl' (unless -compact is
specified).

Modified Files:
--------------
    mdocml:
        TODO
        main.c
        mandoc.h
        mdoc_validate.c

Revision Data
-------------
Index: mdoc_validate.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_validate.c,v
retrieving revision 1.116
retrieving revision 1.117
diff -Lmdoc_validate.c -Lmdoc_validate.c -u -p -r1.116 -r1.117
--- mdoc_validate.c
+++ 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, N
 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 */
@@ -1463,5 +1465,23 @@ post_sh_head(POST_ARGS)
 		break;
 	}
 
+	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);
 }
Index: TODO
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/TODO,v
retrieving revision 1.52
retrieving revision 1.53
diff -LTODO -LTODO -u -p -r1.52 -r1.53
--- TODO
+++ TODO
@@ -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
 ************************************************************************
Index: mandoc.h
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mandoc.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -Lmandoc.h -Lmandoc.h -u -p -r1.19 -r1.20
--- mandoc.h
+++ mandoc.h
@@ -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 ===== */
 
Index: main.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/main.c,v
retrieving revision 1.106
retrieving revision 1.107
diff -Lmain.c -Lmain.c -u -p -r1.106 -r1.107
--- main.c
+++ main.c
@@ -174,6 +174,7 @@ static	const char * const	mandocerrs[MAN
 	"missing font type",
 	"line argument(s) will be lost",
 	"body argument(s) will be lost",
+	"paragraph macro ignored",
 
 	"generic fatal error",
 
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-09-27  9:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-27  9:26 mdocml: Ignore double-`Pp' and `Pp' before `Bd' and `Bl' (unless kristaps

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).