summaryrefslogtreecommitdiffstats
path: root/html.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-12-24 00:46:49 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-12-24 00:46:49 +0000
commit390e9bb2eebe070ac0a97222e307f0c172517e47 (patch)
tree8a2bf919af52abcffd3d47248830cdb0898357bc /html.c
parentb33bf33f98a8a9b9bbdfadef137c7dcf838939b0 (diff)
downloadmandoc-390e9bb2eebe070ac0a97222e307f0c172517e47.tar.gz
Drastically fix -T[x]html's handling of font-escape mode changes (i.e.,
using \fI or \fP). Now, using these modes will cause a font to be rendered for each word; furthermore, setting mode within a word will do the correct thing. Second, make -man use real font tags (B, I, SMALL) to set its font instead of using font modes and fix up the pre-macro unsetting of the current mode. This fixes how roff.7 wasn't validating (<P> closing out a font mode) and has been checked against gcc.1 (more will come). I considered failure to validate OUR manual to be a show-stopper for the up-coming release.
Diffstat (limited to 'html.c')
-rw-r--r--html.c50
1 files changed, 24 insertions, 26 deletions
diff --git a/html.c b/html.c
index d8fddc81..75b66f4c 100644
--- a/html.c
+++ b/html.c
@@ -74,12 +74,7 @@ static const struct htmldata htmltags[TAG_MAX] = {
{"i", 0 }, /* TAG_I */
{"u", 0 }, /* TAG_U */
{"code", 0 }, /* TAG_CODE */
-};
-
-static const char *const htmlfonts[HTMLFONT_MAX] = {
- "roman",
- "bold",
- "italic"
+ {"small", 0 }, /* TAG_SMALL */
};
static const char *const htmlattrs[ATTR_MAX] = {
@@ -257,25 +252,6 @@ print_res(struct html *h, const char *p, size_t len)
}
-struct tag *
-print_ofont(struct html *h, enum htmlfont font)
-{
- struct htmlpair tag;
-
- h->metal = h->metac;
- h->metac = font;
-
- /* FIXME: DECO_ROMAN should just close out preexisting. */
-
- if (h->metaf && h->tags.head == h->metaf)
- print_tagq(h, h->metaf);
-
- PAIR_CLASS_INIT(&tag, htmlfonts[font]);
- h->metaf = print_otag(h, TAG_SPAN, 1, &tag);
- return(h->metaf);
-}
-
-
static void
print_metaf(struct html *h, enum roffdeco deco)
{
@@ -299,7 +275,18 @@ print_metaf(struct html *h, enum roffdeco deco)
/* NOTREACHED */
}
- (void)print_ofont(h, font);
+ if (h->metaf) {
+ print_tagq(h, h->metaf);
+ h->metaf = NULL;
+ }
+
+ h->metal = h->metac;
+ h->metac = font;
+
+ if (HTMLFONT_NONE != font)
+ h->metaf = HTMLFONT_BOLD == font ?
+ print_otag(h, TAG_B, 0, NULL) :
+ print_otag(h, TAG_I, 0, NULL);
}
@@ -554,11 +541,22 @@ print_text(struct html *h, const char *word)
printf("&#160;");
}
+ assert(NULL == h->metaf);
+ if (HTMLFONT_NONE != h->metac)
+ h->metaf = HTMLFONT_BOLD == h->metac ?
+ print_otag(h, TAG_B, 0, NULL) :
+ print_otag(h, TAG_I, 0, NULL);
+
assert(word);
if ( ! print_encode(h, word, 0))
if ( ! (h->flags & HTML_NONOSPACE))
h->flags &= ~HTML_NOSPACE;
+ if (h->metaf) {
+ print_tagq(h, h->metaf);
+ h->metaf = NULL;
+ }
+
h->flags &= ~HTML_IGNDELIM;
/*