diff options
author | 2010-07-02 12:54:33 +0000 | |
---|---|---|
committer | 2010-07-02 12:54:33 +0000 | |
commit | 93a6626101a75d16172b09ad5201078daf1c61b3 (patch) | |
tree | 85382023409b33ff7c59b10f3eb8e2545165ef84 /mdoc_html.c | |
parent | 966c1bc6fc8cf98168d9d17b82cc2e7b414d2e15 (diff) | |
download | mandoc-93a6626101a75d16172b09ad5201078daf1c61b3.tar.gz mandoc-93a6626101a75d16172b09ad5201078daf1c61b3.tar.zst mandoc-93a6626101a75d16172b09ad5201078daf1c61b3.zip |
Stash `Bf' parameters into struct mdoc_bf.
Diffstat (limited to 'mdoc_html.c')
-rw-r--r-- | mdoc_html.c | 47 |
1 files changed, 17 insertions, 30 deletions
diff --git a/mdoc_html.c b/mdoc_html.c index b3839870..9f63019d 100644 --- a/mdoc_html.c +++ b/mdoc_html.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_html.c,v 1.91 2010/07/02 10:42:46 kristaps Exp $ */ +/* $Id: mdoc_html.c,v 1.92 2010/07/02 12:54:33 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -2015,46 +2015,33 @@ mdoc_ap_pre(MDOC_ARGS) static int mdoc_bf_pre(MDOC_ARGS) { - int i; struct htmlpair tag[2]; struct roffsu su; if (MDOC_HEAD == n->type) return(0); - else if (MDOC_BLOCK != n->type) + else if (MDOC_BODY != n->type) return(1); - PAIR_CLASS_INIT(&tag[0], "lit"); - - if (n->head->child) { - if ( ! strcmp("Em", n->head->child->string)) - PAIR_CLASS_INIT(&tag[0], "emph"); - else if ( ! strcmp("Sy", n->head->child->string)) - PAIR_CLASS_INIT(&tag[0], "symb"); - else if ( ! strcmp("Li", n->head->child->string)) - PAIR_CLASS_INIT(&tag[0], "lit"); - } else { - for (i = 0; n->args && i < (int)n->args->argc; i++) - switch (n->args->argv[i].arg) { - case (MDOC_Symbolic): - PAIR_CLASS_INIT(&tag[0], "symb"); - break; - case (MDOC_Literal): - PAIR_CLASS_INIT(&tag[0], "lit"); - break; - case (MDOC_Emphasis): - PAIR_CLASS_INIT(&tag[0], "emph"); - break; - default: - break; - } - } + assert(n->data.Bf); - /* FIXME: div's have spaces stripped--we want them. */ + if (FONT_Em == n->data.Bf->font) + PAIR_CLASS_INIT(&tag[0], "emph"); + else if (FONT_Sy == n->data.Bf->font) + PAIR_CLASS_INIT(&tag[0], "symb"); + else if (FONT_Li == n->data.Bf->font) + PAIR_CLASS_INIT(&tag[0], "lit"); + else + PAIR_CLASS_INIT(&tag[0], "none"); + /* + * We want this to be inline-formatted, but needs to be div to + * accept block children. + */ bufcat_style(h, "display", "inline"); SCALE_HS_INIT(&su, 1); - bufcat_su(h, "margin-right", &su); + /* Needs a left-margin for spacing. */ + bufcat_su(h, "margin-left", &su); PAIR_STYLE_INIT(&tag[1], h); print_otag(h, TAG_DIV, 2, tag); return(1); |