=================================================================== RCS file: /cvs/mandoc/mdoc_html.c,v retrieving revision 1.146 retrieving revision 1.151 diff -u -p -r1.146 -r1.151 --- mandoc/mdoc_html.c 2011/01/25 15:28:56 1.146 +++ mandoc/mdoc_html.c 2011/02/06 21:44:36 1.151 @@ -1,4 +1,4 @@ -/* $Id: mdoc_html.c,v 1.146 2011/01/25 15:28:56 kristaps Exp $ */ +/* $Id: mdoc_html.c,v 1.151 2011/02/06 21:44:36 kristaps Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons * @@ -422,10 +422,18 @@ print_mdoc_node(MDOC_ARGS) case (MDOC_TEXT): /* No tables in this mode... */ assert(NULL == h->tblt); + + /* + * Make sure that if we're in a literal mode already + * (i.e., within a
) don't print the newline.
+		 */
 		if (' ' == *n->string && MDOC_LINE & n->flags)
-			print_otag(h, TAG_BR, 0, NULL);
+			if ( ! (HTML_LITERAL & h->flags))
+				print_otag(h, TAG_BR, 0, NULL);
 		print_text(h, n->string);
 		return;
+	case (MDOC_EQN):
+		return;
 	case (MDOC_TBL):
 		/*
 		 * This will take care of initialising all of the table
@@ -774,7 +782,8 @@ static int
 mdoc_ns_pre(MDOC_ARGS)
 {
 
-	h->flags |= HTML_NOSPACE;
+	if ( ! (MDOC_LINE & n->flags))
+		h->flags |= HTML_NOSPACE;
 	return(1);
 }
 
@@ -823,8 +832,14 @@ mdoc_xx_pre(MDOC_ARGS)
 
 	PAIR_CLASS_INIT(&tag, "unix");
 	print_otag(h, TAG_SPAN, 1, &tag);
+
 	print_text(h, pp);
-	return(1);
+	if (n->child) {
+		h->flags |= HTML_KEEP;
+		print_text(h, n->child->string);
+		h->flags &= ~HTML_KEEP;
+	}
+	return(0);
 }
 
 
@@ -833,7 +848,6 @@ static int
 mdoc_bx_pre(MDOC_ARGS)
 {
 	struct htmlpair	 tag;
-	char		 buf[3];
 
 	PAIR_CLASS_INIT(&tag, "unix");
 	print_otag(h, TAG_SPAN, 1, &tag);
@@ -848,14 +862,10 @@ mdoc_bx_pre(MDOC_ARGS)
 	}
 
 	if (NULL != (n = n->next)) {
-		buf[0] = '-';
-		buf[1] = toupper((unsigned char)*n->string);
-		buf[2] = '\0';
-
 		h->flags |= HTML_NOSPACE;
-		print_text(h, buf);
+		print_text(h, "-");
 		h->flags |= HTML_NOSPACE;
-		print_text(h, n->string + 1);
+		print_text(h, n->string);
 	}
 
 	return(0);
@@ -1174,7 +1184,7 @@ static int
 mdoc_bd_pre(MDOC_ARGS)
 {
 	struct htmlpair	 	 tag[2];
-	int		 	 comp;
+	int		 	 comp, sv;
 	const struct mdoc_node	*nn;
 	struct roffsu		 su;
 
@@ -1213,6 +1223,11 @@ mdoc_bd_pre(MDOC_ARGS)
 	PAIR_CLASS_INIT(&tag[1], "lit display");
 	print_otag(h, TAG_PRE, 2, tag);
 
+	/* This can be recursive: save & set our literal state. */
+
+	sv = h->flags & HTML_LITERAL;
+	h->flags |= HTML_LITERAL;
+
 	for (nn = n->child; nn; nn = nn->next) {
 		print_mdoc_node(m, nn, h);
 		/*
@@ -1248,6 +1263,9 @@ mdoc_bd_pre(MDOC_ARGS)
 
 		h->flags |= HTML_NOSPACE;
 	}
+
+	if (0 == sv)
+		h->flags &= ~HTML_LITERAL;
 
 	return(0);
 }