summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-11-15 06:45:31 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-11-15 06:45:31 +0000
commit9ccb94640e7d013c2433b151dd1bafdf57538ecb (patch)
tree9a592dc5c8db75a54cbd13fc139f867b0cba09ca
parenta067fc75956a25725c91bbfc0130ab038867c888 (diff)
downloadmandoc-9ccb94640e7d013c2433b151dd1bafdf57538ecb.tar.gz
mandoc-9ccb94640e7d013c2433b151dd1bafdf57538ecb.tar.zst
mandoc-9ccb94640e7d013c2433b151dd1bafdf57538ecb.zip
\f escapes appear to work properly for -Thtml -man. Needs more testing.
-rw-r--r--example.style.css1
-rw-r--r--html.c8
-rw-r--r--man.77
-rw-r--r--man_html.c31
4 files changed, 29 insertions, 18 deletions
diff --git a/example.style.css b/example.style.css
index f7fea190..469b1feb 100644
--- a/example.style.css
+++ b/example.style.css
@@ -47,6 +47,7 @@ span.ref-corp { } /* Reference corporate/foreign author (%Q). */
span.ref-rep { } /* Reference report (%R). */
span.ref-title { } /* Reference title (%T). */
span.ref-vol { } /* Reference volume (%V). */
+span.roman { font-style: normal; font-weight: normal; } /* Generic font. */
span.small { font-size: smaller; } /* Generically small (SB, SM). */
span.symb { font-weight: bold; font-style: normal; } /* Symbols. */
span.type { font-style: italic; font-weight: normal; } /* Variable types (Vt). */
diff --git a/html.c b/html.c
index 33345731..ddc8c5a4 100644
--- a/html.c
+++ b/html.c
@@ -1,4 +1,4 @@
-/* $Id: html.c,v 1.88 2009/11/14 19:23:58 kristaps Exp $ */
+/* $Id: html.c,v 1.89 2009/11/15 06:45:31 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -247,7 +247,7 @@ print_metaf(struct html *h, enum roffdeco deco)
assert(h->metaf == h->tags.head);
print_tagq(h, h->metaf);
}
-
+
PAIR_CLASS_INIT(&tag, class);
h->metaf = print_otag(h, TAG_SPAN, 1, &tag);
}
@@ -432,6 +432,8 @@ print_tagq(struct html *h, const struct tag *until)
struct tag *tag;
while ((tag = h->tags.head) != NULL) {
+ if (tag == h->metaf)
+ h->metaf = NULL;
print_ctag(h, tag->tag);
h->tags.head = tag->next;
free(tag);
@@ -449,6 +451,8 @@ print_stagq(struct html *h, const struct tag *suntil)
while ((tag = h->tags.head) != NULL) {
if (suntil && tag == suntil)
return;
+ if (tag == h->metaf)
+ h->metaf = NULL;
print_ctag(h, tag->tag);
h->tags.head = tag->next;
free(tag);
diff --git a/man.7 b/man.7
index 92a1dc3b..b2c8558b 100644
--- a/man.7
+++ b/man.7
@@ -1,4 +1,4 @@
-.\" $Id: man.7,v 1.52 2009/11/12 08:21:05 kristaps Exp $
+.\" $Id: man.7,v 1.53 2009/11/15 06:45:31 kristaps Exp $
.\"
.\" Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se>
.\"
@@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: November 12 2009 $
+.Dd $Mdocdate: November 15 2009 $
.Dt MAN 7
.Os
.
@@ -136,8 +136,7 @@ Both
.Sq \es
and
.Sq \ef
-attributes are forgotten when exiting a subsequent (or current) macro
-invocation.
+attributes are forgotten when entering or exiting a macro block.
.
.
.Ss Whitespace
diff --git a/man_html.c b/man_html.c
index 47726a32..07806bf7 100644
--- a/man_html.c
+++ b/man_html.c
@@ -1,4 +1,4 @@
-/* $Id: man_html.c,v 1.20 2009/11/14 19:23:58 kristaps Exp $ */
+/* $Id: man_html.c,v 1.21 2009/11/15 06:45:31 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -190,9 +190,15 @@ print_man_node(MAN_ARGS)
print_text(h, n->string);
return;
default:
+ /*
+ * Close out scope of font prior to opening a macro
+ * scope. Assert that the metafont is on the top of the
+ * stack (it's never nested).
+ */
if (h->metaf) {
assert(h->metaf == t);
print_tagq(h, h->metaf);
+ assert(NULL == h->metaf);
t = h->tags.head;
}
if (mans[n->tok].pre)
@@ -200,6 +206,9 @@ print_man_node(MAN_ARGS)
break;
}
+ if (child && n->child)
+ print_man_nodelist(m, n->child, h);
+
print_stagq(h, t);
bufinit(h);
@@ -386,10 +395,11 @@ man_alt_pre(MAN_ARGS)
const struct man_node *nn;
struct tag *t;
int i;
- struct htmlpair tagi, tagb, *tagp;
+ struct htmlpair tagi, tagb, tagr, *tagp;
PAIR_CLASS_INIT(&tagi, "italic");
PAIR_CLASS_INIT(&tagb, "bold");
+ PAIR_CLASS_INIT(&tagr, "roman");
for (i = 0, nn = n->child; nn; nn = nn->next, i++) {
switch (n->tok) {
@@ -400,16 +410,16 @@ man_alt_pre(MAN_ARGS)
tagp = i % 2 ? &tagb : &tagi;
break;
case (MAN_RI):
- tagp = i % 2 ? &tagi : NULL;
+ tagp = i % 2 ? &tagi : &tagr;
break;
case (MAN_IR):
- tagp = i % 2 ? NULL : &tagi;
+ tagp = i % 2 ? &tagr : &tagi;
break;
case (MAN_BR):
- tagp = i % 2 ? NULL : &tagb;
+ tagp = i % 2 ? &tagr : &tagb;
break;
case (MAN_RB):
- tagp = i % 2 ? &tagb : NULL;
+ tagp = i % 2 ? &tagb : &tagr;
break;
default:
abort();
@@ -419,12 +429,9 @@ man_alt_pre(MAN_ARGS)
if (i)
h->flags |= HTML_NOSPACE;
- if (tagp) {
- t = print_otag(h, TAG_SPAN, 1, tagp);
- print_man_node(m, nn, h);
- print_tagq(h, t);
- } else
- print_man_node(m, nn, h);
+ t = print_otag(h, TAG_SPAN, 1, tagp);
+ print_man_node(m, nn, h);
+ print_tagq(h, t);
}
return(0);