summaryrefslogtreecommitdiffstats
path: root/mdoc_html.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-12-22 11:15:16 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-12-22 11:15:16 +0000
commit544a766eb06bf03fc9ae275a02575c4dc54c8d32 (patch)
tree5094d1a10b9a3243e5713b32cd76f383eb2dd04d /mdoc_html.c
parent89a32203ddc128f3448f944bcb1a47eac62514d9 (diff)
downloadmandoc-544a766eb06bf03fc9ae275a02575c4dc54c8d32.tar.gz
Implement reference-counted version of original union mdoc_data. This
simplifies clean-up and allows for more types without extra hassle. Also made in-line literal types in -T[x]html use CODE instead of SPAN to match how literal blocks use PRE.
Diffstat (limited to 'mdoc_html.c')
-rw-r--r--mdoc_html.c62
1 files changed, 31 insertions, 31 deletions
diff --git a/mdoc_html.c b/mdoc_html.c
index fbfcf002..1d57958a 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -470,8 +470,8 @@ mdoc_root_post(MDOC_ARGS)
PAIR_SUMMARY_INIT(&tag[0], "Document Footer");
PAIR_CLASS_INIT(&tag[1], "foot");
if (NULL == h->style) {
- PAIR_INIT(&tag[1], ATTR_WIDTH, "100%");
- t = print_otag(h, TAG_TABLE, 2, tag);
+ PAIR_INIT(&tag[2], ATTR_WIDTH, "100%");
+ t = print_otag(h, TAG_TABLE, 3, tag);
PAIR_INIT(&tag[0], ATTR_WIDTH, "50%");
print_otag(h, TAG_COL, 1, tag);
print_otag(h, TAG_COL, 1, tag);
@@ -839,7 +839,7 @@ mdoc_it_pre(MDOC_ARGS)
assert(bl);
- type = bl->data.Bl->type;
+ type = bl->norm->d.Bl.type;
assert(lists[type]);
PAIR_CLASS_INIT(&tag[0], lists[type]);
@@ -865,7 +865,7 @@ mdoc_it_pre(MDOC_ARGS)
case(LIST_ohang):
/* FALLTHROUGH */
case(LIST_tag):
- SCALE_VS_INIT(&su, ! bl->data.Bl->comp);
+ SCALE_VS_INIT(&su, ! bl->norm->d.Bl.comp);
bufcat_su(h, "margin-top", &su);
PAIR_STYLE_INIT(&tag[1], h);
print_otag(h, TAG_DT, 2, tag);
@@ -890,7 +890,7 @@ mdoc_it_pre(MDOC_ARGS)
case(LIST_enum):
/* FALLTHROUGH */
case(LIST_item):
- SCALE_VS_INIT(&su, ! bl->data.Bl->comp);
+ SCALE_VS_INIT(&su, ! bl->norm->d.Bl.comp);
bufcat_su(h, "margin-top", &su);
PAIR_STYLE_INIT(&tag[1], h);
print_otag(h, TAG_LI, 2, tag);
@@ -904,17 +904,17 @@ mdoc_it_pre(MDOC_ARGS)
case(LIST_ohang):
/* FALLTHROUGH */
case(LIST_tag):
- if (NULL == bl->data.Bl->width) {
+ if (NULL == bl->norm->d.Bl.width) {
print_otag(h, TAG_DD, 1, tag);
break;
}
- a2width(bl->data.Bl->width, &su);
+ a2width(bl->norm->d.Bl.width, &su);
bufcat_su(h, "margin-left", &su);
PAIR_STYLE_INIT(&tag[1], h);
print_otag(h, TAG_DD, 2, tag);
break;
case(LIST_column):
- SCALE_VS_INIT(&su, ! bl->data.Bl->comp);
+ SCALE_VS_INIT(&su, ! bl->norm->d.Bl.comp);
bufcat_su(h, "margin-top", &su);
PAIR_STYLE_INIT(&tag[1], h);
print_otag(h, TAG_TD, 2, tag);
@@ -945,13 +945,13 @@ mdoc_bl_pre(MDOC_ARGS)
char buf[BUFSIZ];
if (MDOC_BODY == n->type) {
- if (LIST_column == n->data.Bl->type)
+ if (LIST_column == n->norm->d.Bl.type)
print_otag(h, TAG_TBODY, 0, NULL);
return(1);
}
if (MDOC_HEAD == n->type) {
- if (LIST_column != n->data.Bl->type)
+ if (LIST_column != n->norm->d.Bl.type)
return(0);
/*
@@ -961,10 +961,10 @@ mdoc_bl_pre(MDOC_ARGS)
* screen and we want to preserve that behaviour.
*/
- for (i = 0; i < n->data.Bl->ncols; i++) {
- a2width(n->data.Bl->cols[i], &su);
+ for (i = 0; i < n->norm->d.Bl.ncols; i++) {
+ a2width(n->norm->d.Bl.cols[i], &su);
bufinit(h);
- if (i < n->data.Bl->ncols - 1)
+ if (i < n->norm->d.Bl.ncols - 1)
bufcat_su(h, "width", &su);
else
bufcat_su(h, "min-width", &su);
@@ -980,19 +980,19 @@ mdoc_bl_pre(MDOC_ARGS)
bufcat_su(h, "margin-bottom", &su);
PAIR_STYLE_INIT(&tag[0], h);
- assert(lists[n->data.Bl->type]);
+ assert(lists[n->norm->d.Bl.type]);
strlcpy(buf, "list ", BUFSIZ);
- strlcat(buf, lists[n->data.Bl->type], BUFSIZ);
+ strlcat(buf, lists[n->norm->d.Bl.type], BUFSIZ);
PAIR_INIT(&tag[1], ATTR_CLASS, buf);
/* Set the block's left-hand margin. */
- if (n->data.Bl->offs) {
- a2offs(n->data.Bl->offs, &su);
+ if (n->norm->d.Bl.offs) {
+ a2offs(n->norm->d.Bl.offs, &su);
bufcat_su(h, "margin-left", &su);
}
- switch (n->data.Bl->type) {
+ switch (n->norm->d.Bl.type) {
case(LIST_bullet):
/* FALLTHROUGH */
case(LIST_dash):
@@ -1096,12 +1096,14 @@ mdoc_d1_pre(MDOC_ARGS)
/* BLOCKQUOTE needs a block body. */
- if (MDOC_Dl == n->tok)
+ if (MDOC_Dl == n->tok) {
PAIR_CLASS_INIT(&tag[0], "lit display");
- else
+ print_otag(h, TAG_CODE, 1, tag);
+ } else {
PAIR_CLASS_INIT(&tag[0], "display");
+ print_otag(h, TAG_DIV, 1, tag);
+ }
- print_otag(h, TAG_DIV, 1, tag);
return(1);
}
@@ -1143,7 +1145,7 @@ mdoc_bd_pre(MDOC_ARGS)
return(0);
if (MDOC_BLOCK == n->type) {
- comp = n->data.Bd->comp;
+ comp = n->norm->d.Bd.comp;
for (nn = n; nn && ! comp; nn = nn->parent) {
if (MDOC_BLOCK != nn->type)
continue;
@@ -1158,14 +1160,14 @@ mdoc_bd_pre(MDOC_ARGS)
}
SCALE_HS_INIT(&su, 0);
- if (n->data.Bd->offs)
- a2offs(n->data.Bd->offs, &su);
+ if (n->norm->d.Bd.offs)
+ a2offs(n->norm->d.Bd.offs, &su);
bufcat_su(h, "margin-left", &su);
PAIR_STYLE_INIT(&tag[0], h);
- if (DISP_unfilled != n->data.Bd->type &&
- DISP_literal != n->data.Bd->type) {
+ if (DISP_unfilled != n->norm->d.Bd.type &&
+ DISP_literal != n->norm->d.Bd.type) {
PAIR_CLASS_INIT(&tag[1], "display");
print_otag(h, TAG_DIV, 2, tag);
return(1);
@@ -1748,13 +1750,11 @@ mdoc_bf_pre(MDOC_ARGS)
else if (MDOC_BODY != n->type)
return(1);
- assert(n->data.Bf);
-
- if (FONT_Em == n->data.Bf->font)
+ if (FONT_Em == n->norm->d.Bf.font)
PAIR_CLASS_INIT(&tag[0], "emph");
- else if (FONT_Sy == n->data.Bf->font)
+ else if (FONT_Sy == n->norm->d.Bf.font)
PAIR_CLASS_INIT(&tag[0], "symb");
- else if (FONT_Li == n->data.Bf->font)
+ else if (FONT_Li == n->norm->d.Bf.font)
PAIR_CLASS_INIT(&tag[0], "lit");
else
PAIR_CLASS_INIT(&tag[0], "none");