version 1.14, 2009/06/16 19:45:51 |
version 1.17, 2009/06/22 12:38:07 |
Line 533 arg_width(const struct mdoc_argv *arg, int pos) |
|
Line 533 arg_width(const struct mdoc_argv *arg, int pos) |
|
assert(pos < (int)arg->sz && pos >= 0); |
assert(pos < (int)arg->sz && pos >= 0); |
assert(arg->value[pos]); |
assert(arg->value[pos]); |
if (0 == strcmp(arg->value[pos], "indent")) |
if (0 == strcmp(arg->value[pos], "indent")) |
return(INDENT); |
return(INDENT + 3); |
if (0 == strcmp(arg->value[pos], "indent-two")) |
if (0 == strcmp(arg->value[pos], "indent-two")) |
return(INDENT * 2); |
return(INDENT * 2 + 2); |
|
|
if (0 == (len = (int)strlen(arg->value[pos]))) |
if (0 == (len = (int)strlen(arg->value[pos]))) |
return(0); |
return(0); |
Line 545 arg_width(const struct mdoc_argv *arg, int pos) |
|
Line 545 arg_width(const struct mdoc_argv *arg, int pos) |
|
break; |
break; |
|
|
if (i == len - 1) { |
if (i == len - 1) { |
if ('n' == arg->value[pos][len - 1]) { |
if ('n' == arg->value[pos][len - 1] || |
|
'm' == arg->value[pos][len - 1]) { |
v = (size_t)atoi(arg->value[pos]); |
v = (size_t)atoi(arg->value[pos]); |
return(v); |
return(v + 2); |
} |
} |
|
|
} |
} |
return(strlen(arg->value[pos]) + 1); |
return(strlen(arg->value[pos]) + 2); |
} |
} |
|
|
|
|
Line 603 arg_offset(const struct mdoc_argv *arg) |
|
Line 604 arg_offset(const struct mdoc_argv *arg) |
|
|
|
assert(*arg->value); |
assert(*arg->value); |
if (0 == strcmp(*arg->value, "left")) |
if (0 == strcmp(*arg->value, "left")) |
return(0); |
return(INDENT - 1); |
if (0 == strcmp(*arg->value, "indent")) |
if (0 == strcmp(*arg->value, "indent")) |
return(INDENT); |
return(INDENT + 1); |
if (0 == strcmp(*arg->value, "indent-two")) |
if (0 == strcmp(*arg->value, "indent-two")) |
return(INDENT * 2); |
return(INDENT * 2); |
|
|
Line 714 termp_it_pre(DECL_ARGS) |
|
Line 715 termp_it_pre(DECL_ARGS) |
|
{ |
{ |
const struct mdoc_node *bl, *n; |
const struct mdoc_node *bl, *n; |
char buf[7]; |
char buf[7]; |
int i, type, keys[3], vals[3]; |
int i, type, keys[3], vals[3], sv; |
size_t width, offset; |
size_t width, offset; |
|
|
if (MDOC_BLOCK == node->type) |
if (MDOC_BLOCK == node->type) |
Line 775 termp_it_pre(DECL_ARGS) |
|
Line 776 termp_it_pre(DECL_ARGS) |
|
/* FALLTHROUGH */ |
/* FALLTHROUGH */ |
case (MDOC_Dash): |
case (MDOC_Dash): |
/* FALLTHROUGH */ |
/* FALLTHROUGH */ |
case (MDOC_Enum): |
|
/* FALLTHROUGH */ |
|
case (MDOC_Hyphen): |
case (MDOC_Hyphen): |
if (width < 4) |
if (width < 4) |
width = 4; |
width = 4; |
break; |
break; |
|
case (MDOC_Enum): |
|
if (width < 5) |
|
width = 5; |
|
break; |
case (MDOC_Tag): |
case (MDOC_Tag): |
if (0 == width) |
if (0 == width) |
width = 10; |
width = 10; |
Line 790 termp_it_pre(DECL_ARGS) |
|
Line 793 termp_it_pre(DECL_ARGS) |
|
} |
} |
|
|
/* |
/* |
* Whitespace control. Inset bodies need an initial space. |
* Whitespace control. Inset bodies need an initial space, |
|
* while diagonal bodies need two. |
*/ |
*/ |
|
|
switch (type) { |
switch (type) { |
case (MDOC_Diag): |
case (MDOC_Diag): |
|
term_word(p, "\\ "); |
/* FALLTHROUGH */ |
/* FALLTHROUGH */ |
case (MDOC_Inset): |
case (MDOC_Inset): |
if (MDOC_BODY == node->type) |
if (MDOC_BODY == node->type) |
Line 898 termp_it_pre(DECL_ARGS) |
|
Line 903 termp_it_pre(DECL_ARGS) |
|
|
|
/* |
/* |
* The dash, hyphen, bullet and enum lists all have a special |
* The dash, hyphen, bullet and enum lists all have a special |
* HEAD character. Print it now. |
* HEAD character (temporarily bold, in some cases). |
*/ |
*/ |
|
|
|
sv = p->flags; |
if (MDOC_HEAD == node->type) |
if (MDOC_HEAD == node->type) |
switch (type) { |
switch (type) { |
case (MDOC_Bullet): |
case (MDOC_Bullet): |
|
p->flags |= TERMP_BOLD; |
term_word(p, "\\[bu]"); |
term_word(p, "\\[bu]"); |
break; |
break; |
case (MDOC_Dash): |
case (MDOC_Dash): |
/* FALLTHROUGH */ |
/* FALLTHROUGH */ |
case (MDOC_Hyphen): |
case (MDOC_Hyphen): |
|
p->flags |= TERMP_BOLD; |
term_word(p, "\\-"); |
term_word(p, "\\-"); |
break; |
break; |
case (MDOC_Enum): |
case (MDOC_Enum): |
Line 921 termp_it_pre(DECL_ARGS) |
|
Line 929 termp_it_pre(DECL_ARGS) |
|
break; |
break; |
} |
} |
|
|
|
p->flags = sv; /* Restore saved flags. */ |
|
|
/* |
/* |
* If we're not going to process our children, indicate so here. |
* If we're not going to process our children, indicate so here. |
*/ |
*/ |
Line 1335 termp_d1_pre(DECL_ARGS) |
|
Line 1345 termp_d1_pre(DECL_ARGS) |
|
if (MDOC_BLOCK != node->type) |
if (MDOC_BLOCK != node->type) |
return(1); |
return(1); |
term_newln(p); |
term_newln(p); |
p->offset += (pair->offset = INDENT); |
pair->offset = INDENT + 1; |
|
p->offset += pair->offset; |
return(1); |
return(1); |
} |
} |
|
|