version 1.82, 2010/06/12 12:10:55 |
version 1.89, 2010/07/01 14:34:03 |
|
|
/* $Id$ */ |
/* $Id$ */ |
/* |
/* |
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> |
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@bsd.lv> |
* |
* |
* Permission to use, copy, modify, and distribute this software for any |
* Permission to use, copy, modify, and distribute this software for any |
* purpose with or without fee is hereby granted, provided that the above |
* purpose with or without fee is hereby granted, provided that the above |
|
|
#include "mandoc.h" |
#include "mandoc.h" |
#include "out.h" |
#include "out.h" |
#include "html.h" |
#include "html.h" |
|
#include "regs.h" |
#include "mdoc.h" |
#include "mdoc.h" |
#include "main.h" |
#include "main.h" |
|
|
Line 303 synopsis_pre(struct html *h, const struct mdoc_node *n |
|
Line 304 synopsis_pre(struct html *h, const struct mdoc_node *n |
|
struct roffsu su; |
struct roffsu su; |
struct htmlpair tag; |
struct htmlpair tag; |
|
|
if (NULL == n->prev || SEC_SYNOPSIS != n->sec) |
if (NULL == n->prev || ! (MDOC_SYNPRETTY & n->flags)) |
return; |
return; |
|
|
SCALE_VS_INIT(&su, 1); |
SCALE_VS_INIT(&su, 1); |
Line 436 print_mdoc_node(MDOC_ARGS) |
|
Line 437 print_mdoc_node(MDOC_ARGS) |
|
print_text(h, n->string); |
print_text(h, n->string); |
return; |
return; |
default: |
default: |
if (mdocs[n->tok].pre) |
if (mdocs[n->tok].pre && ENDBODY_NOT == n->end) |
child = (*mdocs[n->tok].pre)(m, n, h); |
child = (*mdocs[n->tok].pre)(m, n, h); |
break; |
break; |
} |
} |
Line 452 print_mdoc_node(MDOC_ARGS) |
|
Line 453 print_mdoc_node(MDOC_ARGS) |
|
mdoc_root_post(m, n, h); |
mdoc_root_post(m, n, h); |
break; |
break; |
default: |
default: |
if (mdocs[n->tok].post) |
if (mdocs[n->tok].post && ENDBODY_NOT == n->end) |
(*mdocs[n->tok].post)(m, n, h); |
(*mdocs[n->tok].post)(m, n, h); |
break; |
break; |
} |
} |
Line 1035 mdoc_it_pre(MDOC_ARGS) |
|
Line 1036 mdoc_it_pre(MDOC_ARGS) |
|
if (MDOC_BLOCK != n->type) |
if (MDOC_BLOCK != n->type) |
bl = bl->parent; |
bl = bl->parent; |
|
|
|
SCALE_HS_INIT(&offs, 0); |
|
|
type = bl->data.Bl.type; |
type = bl->data.Bl.type; |
comp = bl->data.Bl.comp; |
comp = bl->data.Bl.comp; |
|
|
/* Set default width and offset. */ |
if (bl->data.Bl.offs) |
|
a2offs(bl->data.Bl.offs, &offs); |
|
|
SCALE_HS_INIT(&offs, 0); |
|
|
|
switch (type) { |
switch (type) { |
case (LIST_enum): |
case (LIST_enum): |
/* FALLTHROUGH */ |
/* FALLTHROUGH */ |
Line 1057 mdoc_it_pre(MDOC_ARGS) |
|
Line 1059 mdoc_it_pre(MDOC_ARGS) |
|
break; |
break; |
} |
} |
|
|
/* Get width, offset, and compact arguments. */ |
if (bl->data.Bl.width) |
|
a2width(bl->data.Bl.width, &width); |
|
|
wp = -1; |
wp = -1; |
for (i = 0; bl->args && i < (int)bl->args->argc; i++) |
for (i = 0; bl->args && i < (int)bl->args->argc; i++) |
Line 1065 mdoc_it_pre(MDOC_ARGS) |
|
Line 1068 mdoc_it_pre(MDOC_ARGS) |
|
case (MDOC_Column): |
case (MDOC_Column): |
wp = i; /* Save for later. */ |
wp = i; /* Save for later. */ |
break; |
break; |
case (MDOC_Width): |
|
a2width(bl->args->argv[i].value[0], &width); |
|
break; |
|
case (MDOC_Offset): |
|
a2offs(bl->args->argv[i].value[0], &offs); |
|
break; |
|
default: |
default: |
break; |
break; |
} |
} |
Line 1617 mdoc_fn_pre(MDOC_ARGS) |
|
Line 1614 mdoc_fn_pre(MDOC_ARGS) |
|
*/ |
*/ |
|
|
#if 0 |
#if 0 |
if (SEC_SYNOPSIS == n->sec) { |
if (MDOC_SYNPRETTY & n->flags) { |
nbuf[0] = '\0'; |
nbuf[0] = '\0'; |
html_idcat(nbuf, sp, BUFSIZ); |
html_idcat(nbuf, sp, BUFSIZ); |
PAIR_ID_INIT(&tag[1], nbuf); |
PAIR_ID_INIT(&tag[1], nbuf); |
Line 1647 mdoc_fn_pre(MDOC_ARGS) |
|
Line 1644 mdoc_fn_pre(MDOC_ARGS) |
|
|
|
for (nn = n->child->next; nn; nn = nn->next) { |
for (nn = n->child->next; nn; nn = nn->next) { |
i = 1; |
i = 1; |
if (SEC_SYNOPSIS == n->sec) |
if (MDOC_SYNPRETTY & n->flags) |
i = 2; |
i = 2; |
t = print_otag(h, TAG_SPAN, i, tag); |
t = print_otag(h, TAG_SPAN, i, tag); |
print_text(h, nn->string); |
print_text(h, nn->string); |
Line 1657 mdoc_fn_pre(MDOC_ARGS) |
|
Line 1654 mdoc_fn_pre(MDOC_ARGS) |
|
} |
} |
|
|
print_text(h, ")"); |
print_text(h, ")"); |
if (SEC_SYNOPSIS == n->sec) |
if (MDOC_SYNPRETTY & n->flags) |
print_text(h, ";"); |
print_text(h, ";"); |
|
|
return(0); |
return(0); |
Line 1827 mdoc_in_pre(MDOC_ARGS) |
|
Line 1824 mdoc_in_pre(MDOC_ARGS) |
|
PAIR_CLASS_INIT(&tag[0], "includes"); |
PAIR_CLASS_INIT(&tag[0], "includes"); |
print_otag(h, TAG_SPAN, 1, tag); |
print_otag(h, TAG_SPAN, 1, tag); |
|
|
if (SEC_SYNOPSIS == n->sec && MDOC_LINE & n->flags) |
if (MDOC_SYNPRETTY & n->flags && MDOC_LINE & n->flags) |
print_text(h, "#include"); |
print_text(h, "#include"); |
|
|
print_text(h, "<"); |
print_text(h, "<"); |