source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: Remove <p> in favour of <div class="spacer">.
@ 2014-09-27 10:56 kristaps
  0 siblings, 0 replies; only message in thread
From: kristaps @ 2014-09-27 10:56 UTC (permalink / raw)
  To: source

Log Message:
-----------
Remove <p> in favour of <div class="spacer">.  
This is good because <p> is brittle: it can't appear within other block
macros.
This fixes a regression of the original HTML5 patch as noted by schwarze@
on the tech@ list, 14/8/2014.

Modified Files:
--------------
    mdocml:
        html.c
        html.h
        man_html.c
        mdoc_html.c

Revision Data
-------------
Index: html.h
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/html.h,v
retrieving revision 1.60
retrieving revision 1.61
diff -Lhtml.h -Lhtml.h -u -p -r1.60 -r1.61
--- html.h
+++ html.h
@@ -44,7 +44,6 @@ enum	htmltag {
 	TAG_DT,
 	TAG_DD,
 	TAG_BLOCKQUOTE,
-	TAG_P,
 	TAG_PRE,
 	TAG_B,
 	TAG_I,
@@ -144,6 +143,7 @@ void		  print_text(struct html *, const 
 void		  print_tblclose(struct html *);
 void		  print_tbl(struct html *, const struct tbl_span *);
 void		  print_eqn(struct html *, const struct eqn *);
+void		  print_paragraph(struct html *);
 
 #if __GNUC__ - 0 >= 4
 __attribute__((__format__ (__printf__, 2, 3)))
Index: man_html.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man_html.c,v
retrieving revision 1.102
retrieving revision 1.103
diff -Lman_html.c -Lman_html.c -u -p -r1.102 -r1.103
--- man_html.c
+++ man_html.c
@@ -142,7 +142,7 @@ print_bvspace(struct html *h, const stru
 		if (NULL == n->prev)
 			return;
 
-	print_otag(h, TAG_P, 0, NULL);
+	print_paragraph(h);
 }
 
 void
@@ -219,7 +219,7 @@ print_man_node(MAN_ARGS)
 		 * before printing the line's data.
 		 */
 		if ('\0' == *n->string) {
-			print_otag(h, TAG_P, 0, NULL);
+			print_paragraph(h);
 			return;
 		}
 
@@ -538,7 +538,7 @@ man_IP_pre(MAN_ARGS)
 static int
 man_HP_pre(MAN_ARGS)
 {
-	struct htmlpair	 tag;
+	struct htmlpair	 tag[2];
 	struct roffsu	 su;
 	const struct man_node *np;
 
@@ -558,8 +558,9 @@ man_HP_pre(MAN_ARGS)
 	bufcat_su(h, "margin-left", &su);
 	su.scale = -su.scale;
 	bufcat_su(h, "text-indent", &su);
-	PAIR_STYLE_INIT(&tag, h);
-	print_otag(h, TAG_P, 1, &tag);
+	PAIR_STYLE_INIT(&tag[0], h);
+	PAIR_CLASS_INIT(&tag[1], "spacer");
+	print_otag(h, TAG_DIV, 2, tag);
 	return(1);
 }
 
Index: html.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/html.c,v
retrieving revision 1.170
retrieving revision 1.171
diff -Lhtml.c -Lhtml.c -u -p -r1.170 -r1.171
--- html.c
+++ html.c
@@ -68,7 +68,6 @@ static	const struct htmldata htmltags[TA
 	{"dt",		HTML_CLRLINE}, /* TAG_DT */
 	{"dd",		HTML_CLRLINE}, /* TAG_DD */
 	{"blockquote",	HTML_CLRLINE}, /* TAG_BLOCKQUOTE */
-	{"p",		HTML_CLRLINE | HTML_NOSTACK | HTML_AUTOCLOSE}, /* TAG_P */
 	{"pre",		HTML_CLRLINE }, /* TAG_PRE */
 	{"b",		0 }, /* TAG_B */
 	{"i",		0 }, /* TAG_I */
@@ -203,7 +202,8 @@ print_gen_head(struct html *h)
 	      "td.head-rtitle, td.foot-os { text-align: right; }\n"
 	      "td.head-vol { text-align: center; }\n"
 	      "table.foot td { width: 50%; }\n"
-	      "table.head td { width: 33%; }\n");
+	      "table.head td { width: 33%; }\n"
+	      "div.spacer { margin: 1em 0; }\n");
 	print_tagq(h, t);
 
 	if (h->style) {
@@ -621,6 +621,18 @@ print_stagq(struct html *h, const struct
 		free(tag);
 	}
 }
+
+void
+print_paragraph(struct html *h)
+{
+	struct tag	*t;
+	struct htmlpair	 tag;
+
+	PAIR_CLASS_INIT(&tag, "spacer");
+	t = print_otag(h, TAG_DIV, 1, &tag);
+	print_tagq(h, t);
+}
+
 
 void
 bufinit(struct html *h)
Index: mdoc_html.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_html.c,v
retrieving revision 1.205
retrieving revision 1.206
diff -Lmdoc_html.c -Lmdoc_html.c -u -p -r1.205 -r1.206
--- mdoc_html.c
+++ mdoc_html.c
@@ -314,11 +314,11 @@ synopsis_pre(struct html *h, const struc
 	case MDOC_In:
 		/* FALLTHROUGH */
 	case MDOC_Vt:
-		print_otag(h, TAG_P, 0, NULL);
+		print_paragraph(h);
 		break;
 	case MDOC_Ft:
 		if (MDOC_Fn != n->tok && MDOC_Fo != n->tok) {
-			print_otag(h, TAG_P, 0, NULL);
+			print_paragraph(h);
 			break;
 		}
 		/* FALLTHROUGH */
@@ -1156,7 +1156,7 @@ mdoc_bd_pre(MDOC_ARGS)
 				break;
 		}
 		if ( ! comp)
-			print_otag(h, TAG_P, 0, NULL);
+			print_paragraph(h);
 		return(1);
 	}
 
@@ -1562,7 +1562,7 @@ static int
 mdoc_pp_pre(MDOC_ARGS)
 {
 
-	print_otag(h, TAG_P, 0, NULL);
+	print_paragraph(h);
 	return(0);
 }
 
@@ -1890,7 +1890,7 @@ mdoc_rs_pre(MDOC_ARGS)
 		return(1);
 
 	if (n->prev && SEC_SEE_ALSO == n->sec)
-		print_otag(h, TAG_P, 0, NULL);
+		print_paragraph(h);
 
 	PAIR_CLASS_INIT(&tag, "ref");
 	print_otag(h, TAG_SPAN, 1, &tag);
--
 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:[~2014-09-27 10:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-27 10:56 mdocml: Remove <p> in favour of <div class="spacer"> 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).