summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--example.style.css6
-rw-r--r--html.c3
-rw-r--r--html.h3
-rw-r--r--mdoc_html.c52
4 files changed, 31 insertions, 33 deletions
diff --git a/example.style.css b/example.style.css
index 83153ecf..ca30722c 100644
--- a/example.style.css
+++ b/example.style.css
@@ -1,4 +1,4 @@
-/* $Id: example.style.css,v 1.31 2010/12/17 08:26:42 kristaps Exp $ */
+/* $Id: example.style.css,v 1.32 2010/12/17 10:37:26 kristaps Exp $ */
html { min-width: 580px; width: 580px; }
body { font-family: monospace; }
@@ -38,6 +38,10 @@ table { margin-top: 0px; margin-bottom: 0px; }
.roman { font-style: normal; font-weight: normal; } /* Roman: (implicit). */
.small { font-style: normal; font-weight: normal; font-size: smaller; } /* Small: SB, SM. */
+/* Block modes. */
+
+.display { }
+
/* Context-specific modes. */
span.addr { font-style: italic; font-weight: normal; } /* Address (Ad). */
diff --git a/html.c b/html.c
index 8d5d4793..b6a310c0 100644
--- a/html.c
+++ b/html.c
@@ -1,4 +1,4 @@
-/* $Id: html.c,v 1.117 2010/12/17 08:17:40 kristaps Exp $ */
+/* $Id: html.c,v 1.118 2010/12/17 10:37:26 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -69,6 +69,7 @@ static const struct htmldata htmltags[TAG_MAX] = {
{"dd", HTML_CLRLINE}, /* TAG_DD */
{"blockquote", HTML_CLRLINE}, /* TAG_BLOCKQUOTE */
{"p", HTML_CLRLINE | HTML_NOSTACK | HTML_AUTOCLOSE}, /* TAG_P */
+ {"pre", HTML_CLRLINE }, /* TAG_PRE */
};
static const char *const htmlfonts[HTMLFONT_MAX] = {
diff --git a/html.h b/html.h
index 2f35b24a..46230360 100644
--- a/html.h
+++ b/html.h
@@ -1,4 +1,4 @@
-/* $Id: html.h,v 1.30 2010/12/15 17:19:41 kristaps Exp $ */
+/* $Id: html.h,v 1.31 2010/12/17 10:37:26 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -45,6 +45,7 @@ enum htmltag {
TAG_DD,
TAG_BLOCKQUOTE,
TAG_P,
+ TAG_PRE,
TAG_MAX
};
diff --git a/mdoc_html.c b/mdoc_html.c
index 8d5c00c7..4f1ee482 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_html.c,v 1.125 2010/12/17 08:17:40 kristaps Exp $ */
+/* $Id: mdoc_html.c,v 1.126 2010/12/17 10:37:26 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -1059,10 +1059,11 @@ mdoc_d1_pre(MDOC_ARGS)
/* BLOCKQUOTE needs a block body. */
if (MDOC_Dl == n->tok) {
- PAIR_CLASS_INIT(&tag[1], "lit");
+ PAIR_CLASS_INIT(&tag[0], "lit display");
print_otag(h, TAG_DIV, 1, tag);
} else
- print_otag(h, TAG_DIV, 0, tag);
+ PAIR_CLASS_INIT(&tag[0], "display");
+ print_otag(h, TAG_DIV, 1, tag);
return(1);
}
@@ -1103,19 +1104,8 @@ mdoc_bd_pre(MDOC_ARGS)
if (MDOC_HEAD == n->type)
return(0);
- SCALE_VS_INIT(&su, 0);
-
- assert(n->data.Bd);
- if (n->data.Bd->offs)
- a2offs(n->data.Bd->offs, &su);
-
- comp = n->data.Bd->comp;
-
- /* FIXME: -centered, etc. formatting. */
- /* FIXME: does not respect -offset ??? */
-
if (MDOC_BLOCK == n->type) {
- bufcat_su(h, "margin-left", &su);
+ comp = n->data.Bd->comp;
for (nn = n; nn && ! comp; nn = nn->parent) {
if (MDOC_BLOCK != nn->type)
continue;
@@ -1124,26 +1114,27 @@ mdoc_bd_pre(MDOC_ARGS)
if (nn->prev)
break;
}
- if (comp) {
- PAIR_STYLE_INIT(&tag[0], h);
- print_otag(h, TAG_DIV, 1, tag);
- return(1);
- }
- SCALE_VS_INIT(&su, 1);
- bufcat_su(h, "margin-top", &su);
- PAIR_STYLE_INIT(&tag[0], h);
- print_otag(h, TAG_DIV, 1, tag);
+ if ( ! comp)
+ print_otag(h, TAG_P, 0, NULL);
return(1);
}
+ SCALE_HS_INIT(&su, 0);
+ if (n->data.Bd->offs)
+ a2offs(n->data.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)
+ DISP_literal != n->data.Bd->type) {
+ PAIR_CLASS_INIT(&tag[1], "display");
+ print_otag(h, TAG_DIV, 2, tag);
return(1);
+ }
- PAIR_CLASS_INIT(&tag[0], "lit");
- bufcat_style(h, "white-space", "pre");
- PAIR_STYLE_INIT(&tag[1], h);
- print_otag(h, TAG_DIV, 2, tag);
+ PAIR_CLASS_INIT(&tag[1], "lit display");
+ print_otag(h, TAG_PRE, 2, tag);
for (nn = n->child; nn; nn = nn->next) {
print_mdoc_node(m, nn, h);
@@ -1175,8 +1166,9 @@ mdoc_bd_pre(MDOC_ARGS)
}
if (nn->next && nn->next->line == nn->line)
continue;
+ else if (nn->next)
+ print_text(h, "\n");
- print_text(h, "\n");
h->flags |= HTML_NOSPACE;
}