From 0371d94639d271317d0697e7eefe5cb79df85fb7 Mon Sep 17 00:00:00 2001 From: Kristaps Dzonsons Date: Thu, 24 Sep 2009 11:55:28 +0000 Subject: Fix in -Tascii where `Lb' causes line-break in any section (should only happen in LIBRARY). `Fn' first parameter is broken apart into ftype and fname in -Thtml (for correct style application). Fixed \0 special character. --- chars.in | 2 +- example.style.css | 17 +++++++++-------- mdoc_html.c | 32 ++++++++++++++++++++++++++++---- mdoc_term.c | 4 ---- 4 files changed, 38 insertions(+), 17 deletions(-) diff --git a/chars.in b/chars.in index 20c83274..282cb598 100644 --- a/chars.in +++ b/chars.in @@ -32,7 +32,7 @@ /* Spacing. */ CHAR("c", 1, "", 0, "", 0) -CHAR("0", 1, " ", 1, " ", 6) +CHAR("0", 1, " ", 1, " ", 7) CHAR(" ", 1, " ", 1, " ", 7) CHAR("~", 1, " ", 1, " ", 6) CHAR("%", 1, "", 0, "", 0) diff --git a/example.style.css b/example.style.css index 03e4360c..99441efa 100644 --- a/example.style.css +++ b/example.style.css @@ -1,4 +1,5 @@ -div.body { font-family: monospace; min-width: 580px; width: 580px; } /* Top-most div tag. */ +div.body { font-family: monospace; + min-width: 580px; width: 580px; } /* Top-most div tag. */ span.sec-head { font-weight: bold; } /* Sections (Sh). */ div.sec-head { } @@ -22,9 +23,10 @@ span.emph { font-style: italic; } /* Emphasis (Em). */ span.env { } /* Environment variables (Ev). */ span.errno { } /* Error string (Er). */ span.farg { font-style: italic; } /* Function argument (Fa, Fn). */ -span.fname { font-style: italic; } /* Function name (Fa, Fn, Rv). */ span.file { font-style: italic; } /* File (Pa). */ span.flag { font-weight: bold; } /* Flag (Fl, Cm). */ +span.fname { font-weight: bold; } /* Function name (Fa, Fn, Rv). */ +span.ftype { font-style: italic; } /* Function types (Ft, Fn). */ span.includes { font-weight: bold; } /* Header includes (In). */ span.lib { } /* Library (Lb). */ span.lit { font-family: monospace; } /* Literals (Bf -literal). */ @@ -32,20 +34,19 @@ span.macro { font-weight: bold; } /* Macro-ish thing (Fd). */ span.name { font-weight: bold; } /* Name of utility (Nm). */ span.opt { } /* Options (Op, Oo/Oc). */ span.symb { font-weight: bold; } /* Symbols. */ -span.type { font-style: italic; } /* Variable types (Vt, Ft, Fn). */ +span.type { font-style: italic; } /* Variable types (Vt). */ span.unix { } /* Unices (Ux, Ox, Nx, Fx, Bx, Bsx, Dx). */ span.utility { font-weight: bold; } /* Name of utility (Ex). */ span.var { font-weight: bold; } /* Variables (Rv). */ +a.link-ext { } /* Off-site link (Lk). */ +a.link-mail { } /* Mailto links (Mt). */ a.link-man { } /* Manual links (Xr). */ a.link-sec { } /* Section links (Sx). */ -a.link-mail { } /* Mailto links (Mt). */ -a.link-ext { } /* Off-site link (Lk). */ -div.lit { } /* Literal (D1, Bd -literal, Dl, Bd -literal). */ div.emph { font-style: italic; } /* Emphasis (Bl -emphasis). */ +div.lit { } /* Literal (D1, Bd -literal, Dl, Bd -literal). */ div.symb { font-weight: bold; } /* Symbols (Bl -symbolic). */ -table.header { } /* Document header. */ table.footer { } /* Document footer. */ - +table.header { } /* Document header. */ diff --git a/mdoc_html.c b/mdoc_html.c index e7f1abe2..2d93cca1 100644 --- a/mdoc_html.c +++ b/mdoc_html.c @@ -15,6 +15,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include +#include #include #include @@ -1560,7 +1561,7 @@ mdoc_ft_pre(MDOC_ARGS) } tag.key = ATTR_CLASS; - tag.val = "type"; + tag.val = "ftype"; print_otag(h, TAG_SPAN, 1, &tag); return(1); } @@ -1573,6 +1574,9 @@ mdoc_fn_pre(MDOC_ARGS) struct tag *t; struct htmlpair tag; const struct mdoc_node *nn; + char nbuf[BUFSIZ]; + const char *sp, *ep; + int sz; if (SEC_SYNOPSIS == n->sec) { if (n->next) { @@ -1583,13 +1587,33 @@ mdoc_fn_pre(MDOC_ARGS) print_otag(h, TAG_DIV, 0, NULL); } + /* Split apart into type and name. */ + tag.key = ATTR_CLASS; - tag.val = "type"; + tag.val = "ftype"; + t = print_otag(h, TAG_SPAN, 1, &tag); + + assert(n->child->string); + sp = n->child->string; + while ((ep = strchr(sp, ' '))) { + sz = MIN(ep - sp, BUFSIZ - 1); + (void)memcpy(nbuf, sp, sz); + nbuf[sz] = '\0'; + print_text(h, nbuf); + sp = ++ep; + } - /* FIXME: can be "type funcname" "type varname"... */ + print_tagq(h, t); + tag.key = ATTR_CLASS; + tag.val = "fname"; t = print_otag(h, TAG_SPAN, 1, &tag); - print_text(h, n->child->string); + + if (sp) { + (void)strlcpy(nbuf, sp, BUFSIZ); + print_text(h, nbuf); + } + print_tagq(h, t); h->flags |= HTML_NOSPACE; diff --git a/mdoc_term.c b/mdoc_term.c index f50149bf..ab098b2b 100644 --- a/mdoc_term.c +++ b/mdoc_term.c @@ -1519,10 +1519,6 @@ termp_fn_pre(DECL_ARGS) { const struct mdoc_node *n; - assert(node->child && MDOC_TEXT == node->child->type); - - /* FIXME: can be "type funcname" "type varname"... */ - p->bold++; term_word(p, node->child->string); p->bold--; -- cgit