summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc/man_html.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2011-05-29 21:22:19 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2011-05-29 21:22:19 +0000
commitd49b1d8e996d3b7d5b11ff7f6fec1308da0f4d19 (patch)
tree1b65c2913c52e78683a870fa30aacb6d0da621ec /usr.bin/mandoc/man_html.c
parent34e3b2211040149f713e27fa1d0e45aa08dcaa93 (diff)
Merge release 1.11.3, almost all code by kristaps@:
* Unicode output support (no Unicode input yet, though). * Refactoring: completely handle predefined strings in roff.c. - New function mandoc_escape() replaces a2roffdeco() and mandoc_special(). - Start using mandoc_getarg() in mdoc_argv.c. - Clean up parsing of delimiters in mdoc(7). * And many minor fixes and lots of cleanup.
Diffstat (limited to 'usr.bin/mandoc/man_html.c')
-rw-r--r--usr.bin/mandoc/man_html.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/usr.bin/mandoc/man_html.c b/usr.bin/mandoc/man_html.c
index d805cce275e..5437cb1557f 100644
--- a/usr.bin/mandoc/man_html.c
+++ b/usr.bin/mandoc/man_html.c
@@ -1,4 +1,4 @@
-/* $Id: man_html.c,v 1.37 2011/04/21 22:59:54 schwarze Exp $ */
+/* $Id: man_html.c,v 1.38 2011/05/29 21:22:18 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -63,7 +63,7 @@ static int man_ign_pre(MAN_ARGS);
static int man_in_pre(MAN_ARGS);
static int man_literal_pre(MAN_ARGS);
static void man_root_post(MAN_ARGS);
-static int man_root_pre(MAN_ARGS);
+static void man_root_pre(MAN_ARGS);
static int man_B_pre(MAN_ARGS);
static int man_HP_pre(MAN_ARGS);
static int man_I_pre(MAN_ARGS);
@@ -153,9 +153,7 @@ print_man_head(MAN_ARGS)
{
print_gen_head(h);
- bufinit(h);
- buffmt(h, "%s(%s)", m->title, m->msec);
-
+ bufcat_fmt(h, "%s(%s)", m->title, m->msec);
print_otag(h, TAG_TITLE, 0, NULL);
print_text(h, h->buf);
}
@@ -181,13 +179,16 @@ print_man_node(MAN_ARGS)
child = 1;
t = h->tags.head;
- bufinit(h);
-
switch (n->type) {
case (MAN_ROOT):
- child = man_root_pre(m, n, mh, h);
+ man_root_pre(m, n, mh, h);
break;
case (MAN_TEXT):
+ /*
+ * If we have a blank line, output a vertical space.
+ * If we have a space as the first character, break
+ * before printing the line's data.
+ */
if ('\0' == *n->string) {
print_otag(h, TAG_P, 0, NULL);
return;
@@ -196,6 +197,13 @@ print_man_node(MAN_ARGS)
print_text(h, n->string);
+ /*
+ * If we're in a literal context, make sure that words
+ * togehter on the same line stay together. This is a
+ * POST-printing call, so we check the NEXT word. Since
+ * -man doesn't have nested macros, we don't need to be
+ * more specific than this.
+ */
if (MANH_LITERAL & mh->fl &&
(NULL == n->next ||
n->next->line > n->line))
@@ -244,8 +252,6 @@ print_man_node(MAN_ARGS)
/* This will automatically close out any font scope. */
print_stagq(h, t);
- bufinit(h);
-
switch (n->type) {
case (MAN_ROOT):
man_root_post(m, n, mh, h);
@@ -274,7 +280,7 @@ a2width(const struct man_node *n, struct roffsu *su)
/* ARGSUSED */
-static int
+static void
man_root_pre(MAN_ARGS)
{
struct htmlpair tag[3];
@@ -328,7 +334,6 @@ man_root_pre(MAN_ARGS)
print_text(h, title);
print_tagq(h, t);
- return(1);
}
@@ -387,6 +392,7 @@ man_br_pre(MAN_ARGS)
} else
su.scale = 0;
+ bufinit(h);
bufcat_su(h, "height", &su);
PAIR_STYLE_INIT(&tag, h);
print_otag(h, TAG_DIV, 1, &tag);
@@ -555,6 +561,7 @@ man_IP_pre(MAN_ARGS)
if (MAN_BLOCK == n->type) {
print_otag(h, TAG_P, 0, NULL);
print_otag(h, TAG_TABLE, 0, NULL);
+ bufinit(h);
bufcat_su(h, "width", &su);
PAIR_STYLE_INIT(&tag, h);
print_otag(h, TAG_COL, 1, &tag);
@@ -590,6 +597,8 @@ man_HP_pre(MAN_ARGS)
struct roffsu su;
const struct man_node *np;
+ bufinit(h);
+
np = MAN_BLOCK == n->type ?
n->head->child :
n->parent->head->child;
@@ -690,6 +699,7 @@ man_RS_pre(MAN_ARGS)
if (n->head->child)
a2width(n->head->child, &su);
+ bufinit(h);
bufcat_su(h, "margin-left", &su);
PAIR_STYLE_INIT(&tag, h);
print_otag(h, TAG_DIV, 1, &tag);