version 1.172, 2010/07/06 10:54:05 |
version 1.181, 2010/08/09 00:00:37 |
|
|
#include "mandoc.h" |
#include "mandoc.h" |
#include "out.h" |
#include "out.h" |
#include "term.h" |
#include "term.h" |
#include "regs.h" |
|
#include "mdoc.h" |
#include "mdoc.h" |
#include "chars.h" |
#include "chars.h" |
#include "main.h" |
#include "main.h" |
Line 152 static const struct termact termacts[MDOC_MAX] = { |
|
Line 151 static const struct termact termacts[MDOC_MAX] = { |
|
{ termp_bl_pre, termp_bl_post }, /* Bl */ |
{ termp_bl_pre, termp_bl_post }, /* Bl */ |
{ NULL, NULL }, /* El */ |
{ NULL, NULL }, /* El */ |
{ termp_it_pre, termp_it_post }, /* It */ |
{ termp_it_pre, termp_it_post }, /* It */ |
{ NULL, NULL }, /* Ad */ |
{ termp_under_pre, NULL }, /* Ad */ |
{ termp_an_pre, termp_an_post }, /* An */ |
{ termp_an_pre, termp_an_post }, /* An */ |
{ termp_under_pre, NULL }, /* Ar */ |
{ termp_under_pre, NULL }, /* Ar */ |
{ termp_cd_pre, NULL }, /* Cd */ |
{ termp_cd_pre, NULL }, /* Cd */ |
Line 209 static const struct termact termacts[MDOC_MAX] = { |
|
Line 208 static const struct termact termacts[MDOC_MAX] = { |
|
{ termp_under_pre, NULL }, /* Em */ |
{ termp_under_pre, NULL }, /* Em */ |
{ NULL, NULL }, /* Eo */ |
{ NULL, NULL }, /* Eo */ |
{ termp_xx_pre, NULL }, /* Fx */ |
{ termp_xx_pre, NULL }, /* Fx */ |
{ termp_bold_pre, NULL }, /* Ms */ /* FIXME: convert to symbol? */ |
{ termp_bold_pre, NULL }, /* Ms */ |
{ NULL, NULL }, /* No */ |
{ NULL, NULL }, /* No */ |
{ termp_ns_pre, NULL }, /* Ns */ |
{ termp_ns_pre, NULL }, /* Ns */ |
{ termp_xx_pre, NULL }, /* Nx */ |
{ termp_xx_pre, NULL }, /* Nx */ |
Line 1027 termp_nm_pre(DECL_ARGS) |
|
Line 1026 termp_nm_pre(DECL_ARGS) |
|
if (NULL == n->child && NULL == m->name) |
if (NULL == n->child && NULL == m->name) |
return(0); |
return(0); |
|
|
synopsis_pre(p, n); |
if (MDOC_HEAD == n->type) |
|
synopsis_pre(p, n->parent); |
|
|
if (MDOC_HEAD == n->type && n->next->child) { |
if (MDOC_HEAD == n->type && n->next->child) { |
p->flags |= TERMP_NOSPACE | TERMP_NOBREAK | TERMP_HANG; |
p->flags |= TERMP_NOSPACE | TERMP_NOBREAK | TERMP_HANG; |
Line 1621 termp_fa_pre(DECL_ARGS) |
|
Line 1621 termp_fa_pre(DECL_ARGS) |
|
static int |
static int |
termp_bd_pre(DECL_ARGS) |
termp_bd_pre(DECL_ARGS) |
{ |
{ |
size_t tabwidth; |
size_t tabwidth, rm, rmax; |
size_t rm, rmax; |
|
const struct mdoc_node *nn; |
const struct mdoc_node *nn; |
|
|
if (MDOC_BLOCK == n->type) { |
if (MDOC_BLOCK == n->type) { |
Line 1654 termp_bd_pre(DECL_ARGS) |
|
Line 1653 termp_bd_pre(DECL_ARGS) |
|
p->rmargin = p->maxrmargin = TERM_MAXMARGIN; |
p->rmargin = p->maxrmargin = TERM_MAXMARGIN; |
|
|
for (nn = n->child; nn; nn = nn->next) { |
for (nn = n->child; nn; nn = nn->next) { |
p->flags |= TERMP_NOSPACE; |
|
print_mdoc_node(p, pair, m, nn); |
print_mdoc_node(p, pair, m, nn); |
if (NULL == nn->prev || |
if (nn->next && nn->next->line == nn->line) |
nn->prev->line < nn->line || |
continue; |
NULL == nn->next) |
term_flushln(p); |
term_flushln(p); |
p->flags |= TERMP_NOSPACE; |
} |
} |
|
|
p->tabwidth = tabwidth; |
p->tabwidth = tabwidth; |
Line 1906 termp_sp_pre(DECL_ARGS) |
|
Line 1904 termp_sp_pre(DECL_ARGS) |
|
len = 0; |
len = 0; |
break; |
break; |
default: |
default: |
|
assert(n->parent); |
|
if ((NULL == n->next || NULL == n->prev) && |
|
(MDOC_Ss == n->parent->tok || |
|
MDOC_Sh == n->parent->tok)) |
|
return(0); |
len = 1; |
len = 1; |
break; |
break; |
} |
} |
Line 2067 termp_sm_pre(DECL_ARGS) |
|
Line 2070 termp_sm_pre(DECL_ARGS) |
|
{ |
{ |
|
|
assert(n->child && MDOC_TEXT == n->child->type); |
assert(n->child && MDOC_TEXT == n->child->type); |
if (0 == strcmp("on", n->child->string)) |
if (0 == strcmp("on", n->child->string)) { |
|
if (p->col) |
|
p->flags &= ~TERMP_NOSPACE; |
p->flags &= ~TERMP_NONOSPACE; |
p->flags &= ~TERMP_NONOSPACE; |
else |
} else |
p->flags |= TERMP_NONOSPACE; |
p->flags |= TERMP_NONOSPACE; |
|
|
return(0); |
return(0); |
Line 2114 termp_li_pre(DECL_ARGS) |
|
Line 2119 termp_li_pre(DECL_ARGS) |
|
static int |
static int |
termp_lk_pre(DECL_ARGS) |
termp_lk_pre(DECL_ARGS) |
{ |
{ |
const struct mdoc_node *nn; |
const struct mdoc_node *nn, *sv; |
|
|
term_fontpush(p, TERMFONT_UNDER); |
term_fontpush(p, TERMFONT_UNDER); |
nn = n->child; |
|
|
|
|
nn = sv = n->child; |
|
|
if (NULL == nn->next) |
if (NULL == nn->next) |
return(1); |
return(1); |
|
|
term_word(p, nn->string); |
for (nn = nn->next; nn; nn = nn->next) |
|
term_word(p, nn->string); |
|
|
term_fontpop(p); |
term_fontpop(p); |
|
|
p->flags |= TERMP_NOSPACE; |
p->flags |= TERMP_NOSPACE; |
term_word(p, ":"); |
term_word(p, ":"); |
|
|
term_fontpush(p, TERMFONT_BOLD); |
term_fontpush(p, TERMFONT_BOLD); |
for (nn = nn->next; nn; nn = nn->next) |
term_word(p, sv->string); |
term_word(p, nn->string); |
|
term_fontpop(p); |
term_fontpop(p); |
|
|
return(0); |
return(0); |