version 1.379, 2020/03/13 15:32:28 |
version 1.382, 2022/09/11 09:13:48 |
|
|
/* $Id$ */ |
/* $Id$ */ |
/* |
/* |
* Copyright (c) 2010, 2012-2020 Ingo Schwarze <schwarze@openbsd.org> |
* Copyright (c) 2010, 2012-2020, 2022 Ingo Schwarze <schwarze@openbsd.org> |
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> |
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> |
* Copyright (c) 2013 Franco Fichtner <franco@lastsummer.de> |
* Copyright (c) 2013 Franco Fichtner <franco@lastsummer.de> |
* |
* |
Line 320 print_mdoc_node(DECL_ARGS) |
|
Line 320 print_mdoc_node(DECL_ARGS) |
|
(p->flags & TERMP_NONEWLINE) == 0) |
(p->flags & TERMP_NONEWLINE) == 0) |
term_newln(p); |
term_newln(p); |
p->flags |= TERMP_BRNEVER; |
p->flags |= TERMP_BRNEVER; |
} else |
} else { |
|
if (n->flags & NODE_LINE) |
|
term_tab_ref(p); |
p->flags &= ~TERMP_BRNEVER; |
p->flags &= ~TERMP_BRNEVER; |
|
} |
|
|
if (n->type == ROFFT_COMMENT || n->flags & NODE_NOPRT) |
if (n->type == ROFFT_COMMENT || n->flags & NODE_NOPRT) |
return; |
return; |
Line 335 print_mdoc_node(DECL_ARGS) |
|
Line 338 print_mdoc_node(DECL_ARGS) |
|
memset(&npair, 0, sizeof(struct termpair)); |
memset(&npair, 0, sizeof(struct termpair)); |
npair.ppair = pair; |
npair.ppair = pair; |
|
|
if (n->flags & NODE_ID) |
if (n->flags & NODE_ID && n->tok != MDOC_Pp && |
|
(n->tok != MDOC_It || n->type != ROFFT_BLOCK)) |
term_tag_write(n, p->line); |
term_tag_write(n, p->line); |
|
|
/* |
/* |
Line 565 a2width(const struct termp *p, const char *v) |
|
Line 569 a2width(const struct termp *p, const char *v) |
|
|
|
end = a2roffsu(v, &su, SCALE_MAX); |
end = a2roffsu(v, &su, SCALE_MAX); |
if (end == NULL || *end != '\0') { |
if (end == NULL || *end != '\0') { |
SCALE_HS_INIT(&su, term_strlen(p, v)); |
su.unit = SCALE_EN; |
su.scale /= term_strlen(p, "0"); |
su.scale = term_strlen(p, v) / term_strlen(p, "0"); |
} |
} |
return term_hen(p, &su); |
return term_hen(p, &su); |
} |
} |
Line 630 termp_it_pre(DECL_ARGS) |
|
Line 634 termp_it_pre(DECL_ARGS) |
|
|
|
if (n->type == ROFFT_BLOCK) { |
if (n->type == ROFFT_BLOCK) { |
print_bvspace(p, n->parent->parent, n); |
print_bvspace(p, n->parent->parent, n); |
|
if (n->flags & NODE_ID) |
|
term_tag_write(n, p->line); |
return 1; |
return 1; |
} |
} |
|
|
Line 700 termp_it_pre(DECL_ARGS) |
|
Line 706 termp_it_pre(DECL_ARGS) |
|
for (i = 0, nn = n->prev; |
for (i = 0, nn = n->prev; |
nn->prev && i < (int)ncols; |
nn->prev && i < (int)ncols; |
nn = nn->prev, i++) { |
nn = nn->prev, i++) { |
SCALE_HS_INIT(&su, |
su.unit = SCALE_EN; |
term_strlen(p, bl->norm->Bl.cols[i])); |
su.scale = term_strlen(p, bl->norm->Bl.cols[i]) / |
su.scale /= term_strlen(p, "0"); |
term_strlen(p, "0"); |
offset += term_hen(p, &su) + dcol; |
offset += term_hen(p, &su) + dcol; |
} |
} |
|
|
Line 719 termp_it_pre(DECL_ARGS) |
|
Line 725 termp_it_pre(DECL_ARGS) |
|
* Use the declared column widths, extended as explained |
* Use the declared column widths, extended as explained |
* in the preceding paragraph. |
* in the preceding paragraph. |
*/ |
*/ |
SCALE_HS_INIT(&su, term_strlen(p, bl->norm->Bl.cols[i])); |
su.unit = SCALE_EN; |
su.scale /= term_strlen(p, "0"); |
su.scale = term_strlen(p, bl->norm->Bl.cols[i]) / |
|
term_strlen(p, "0"); |
width = term_hen(p, &su) + dcol; |
width = term_hen(p, &su) + dcol; |
break; |
break; |
default: |
default: |
Line 1110 termp_ex_pre(DECL_ARGS) |
|
Line 1117 termp_ex_pre(DECL_ARGS) |
|
static int |
static int |
termp_nd_pre(DECL_ARGS) |
termp_nd_pre(DECL_ARGS) |
{ |
{ |
|
|
if (n->type == ROFFT_BODY) |
if (n->type == ROFFT_BODY) |
term_word(p, "\\(en"); |
term_word(p, "\\(en"); |
return 1; |
return 1; |
Line 1119 termp_nd_pre(DECL_ARGS) |
|
Line 1125 termp_nd_pre(DECL_ARGS) |
|
static int |
static int |
termp_bl_pre(DECL_ARGS) |
termp_bl_pre(DECL_ARGS) |
{ |
{ |
|
switch (n->type) { |
return n->type != ROFFT_HEAD; |
case ROFFT_BLOCK: |
|
term_newln(p); |
|
return 1; |
|
case ROFFT_HEAD: |
|
return 0; |
|
default: |
|
return 1; |
|
} |
} |
} |
|
|
static void |
static void |
termp_bl_post(DECL_ARGS) |
termp_bl_post(DECL_ARGS) |
{ |
{ |
|
|
if (n->type != ROFFT_BLOCK) |
if (n->type != ROFFT_BLOCK) |
return; |
return; |
term_newln(p); |
term_newln(p); |
Line 1140 termp_bl_post(DECL_ARGS) |
|
Line 1152 termp_bl_post(DECL_ARGS) |
|
static int |
static int |
termp_xr_pre(DECL_ARGS) |
termp_xr_pre(DECL_ARGS) |
{ |
{ |
|
|
if (NULL == (n = n->child)) |
if (NULL == (n = n->child)) |
return 0; |
return 0; |
|
|
|
|
termp_pp_pre(DECL_ARGS) |
termp_pp_pre(DECL_ARGS) |
{ |
{ |
term_vspace(p); |
term_vspace(p); |
|
if (n->flags & NODE_ID) |
|
term_tag_write(n, p->line); |
return 0; |
return 0; |
} |
} |
|
|