source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: minor .Bk fixes: * do not print invalid arguments verbatim (no
@ 2010-06-27 17:53 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2010-06-27 17:53 UTC (permalink / raw)
  To: source

Log Message:
-----------
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 ;)

Modified Files:
--------------
    mdocml:
        mdoc_term.c
        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.100
retrieving revision 1.101
diff -Lmdoc_validate.c -Lmdoc_validate.c -u -p -r1.100 -r1.101
--- mdoc_validate.c
+++ 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 */
Index: mdoc_term.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_term.c,v
retrieving revision 1.160
retrieving revision 1.161
diff -Lmdoc_term.c -Lmdoc_term.c -u -p -r1.160 -r1.161
--- mdoc_term.c
+++ 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 */
--
 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-06-27 17:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-27 17:53 mdocml: minor .Bk fixes: * do not print invalid arguments verbatim (no schwarze

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).