version 1.206, 2017/06/17 01:27:05 |
version 1.213, 2018/08/16 23:43:37 |
|
|
/* $Id$ */ |
/* $Id$ */ |
/* |
/* |
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> |
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> |
* Copyright (c) 2010-2015, 2017 Ingo Schwarze <schwarze@openbsd.org> |
* Copyright (c) 2010-2015, 2017, 2018 Ingo Schwarze <schwarze@openbsd.org> |
* |
* |
* 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 |
Line 98 static const struct termact __termacts[MAN_MAX - MAN_T |
|
Line 98 static const struct termact __termacts[MAN_MAX - MAN_T |
|
{ pre_SH, post_SH, 0 }, /* SH */ |
{ pre_SH, post_SH, 0 }, /* SH */ |
{ pre_SS, post_SS, 0 }, /* SS */ |
{ pre_SS, post_SS, 0 }, /* SS */ |
{ pre_TP, post_TP, 0 }, /* TP */ |
{ pre_TP, post_TP, 0 }, /* TP */ |
|
{ pre_TP, post_TP, 0 }, /* TQ */ |
{ pre_PP, NULL, 0 }, /* LP */ |
{ pre_PP, NULL, 0 }, /* LP */ |
{ pre_PP, NULL, 0 }, /* PP */ |
{ pre_PP, NULL, 0 }, /* PP */ |
{ pre_PP, NULL, 0 }, /* P */ |
{ pre_PP, NULL, 0 }, /* P */ |
Line 128 static const struct termact __termacts[MAN_MAX - MAN_T |
|
Line 129 static const struct termact __termacts[MAN_MAX - MAN_T |
|
{ pre_literal, NULL, 0 }, /* EE */ |
{ pre_literal, NULL, 0 }, /* EE */ |
{ pre_UR, post_UR, 0 }, /* UR */ |
{ pre_UR, post_UR, 0 }, /* UR */ |
{ NULL, NULL, 0 }, /* UE */ |
{ NULL, NULL, 0 }, /* UE */ |
|
{ pre_UR, post_UR, 0 }, /* MT */ |
|
{ NULL, NULL, 0 }, /* ME */ |
}; |
}; |
static const struct termact *termacts = __termacts - MAN_TH; |
static const struct termact *termacts = __termacts - MAN_TH; |
|
|
Line 582 pre_TP(DECL_ARGS) |
|
Line 585 pre_TP(DECL_ARGS) |
|
p->flags |= TERMP_NOSPACE; |
p->flags |= TERMP_NOSPACE; |
break; |
break; |
case ROFFT_BLOCK: |
case ROFFT_BLOCK: |
print_bvspace(p, n, mt->pardist); |
if (n->tok == MAN_TP) |
|
print_bvspace(p, n, mt->pardist); |
/* FALLTHROUGH */ |
/* FALLTHROUGH */ |
default: |
default: |
return 1; |
return 1; |
Line 671 pre_SS(DECL_ARGS) |
|
Line 675 pre_SS(DECL_ARGS) |
|
|
|
do { |
do { |
n = n->prev; |
n = n->prev; |
} while (n != NULL && n->tok != TOKEN_NONE && |
} while (n != NULL && n->tok >= MAN_TH && |
termacts[n->tok].flags & MAN_NOTEXT); |
termacts[n->tok].flags & MAN_NOTEXT); |
if (n == NULL || (n->tok == MAN_SS && n->body->child == NULL)) |
if (n == NULL || n->type == ROFFT_COMMENT || |
|
(n->tok == MAN_SS && n->body->child == NULL)) |
break; |
break; |
|
|
for (i = 0; i < mt->pardist; i++) |
for (i = 0; i < mt->pardist; i++) |
Line 733 pre_SH(DECL_ARGS) |
|
Line 738 pre_SH(DECL_ARGS) |
|
|
|
do { |
do { |
n = n->prev; |
n = n->prev; |
} while (n != NULL && n->tok != TOKEN_NONE && |
} while (n != NULL && n->tok >= MAN_TH && |
termacts[n->tok].flags & MAN_NOTEXT); |
termacts[n->tok].flags & MAN_NOTEXT); |
if (n == NULL || (n->tok == MAN_SH && n->body->child == NULL)) |
if (n == NULL || n->type == ROFFT_COMMENT || |
|
(n->tok == MAN_SH && n->body->child == NULL)) |
break; |
break; |
|
|
for (i = 0; i < mt->pardist; i++) |
for (i = 0; i < mt->pardist; i++) |
Line 872 print_man_node(DECL_ARGS) |
|
Line 878 print_man_node(DECL_ARGS) |
|
* before printing the line's data. |
* before printing the line's data. |
*/ |
*/ |
if (*n->string == '\0') { |
if (*n->string == '\0') { |
term_vspace(p); |
if (p->flags & TERMP_NONEWLINE) |
|
term_newln(p); |
|
else |
|
term_vspace(p); |
return; |
return; |
} else if (*n->string == ' ' && n->flags & NODE_LINE && |
} else if (*n->string == ' ' && n->flags & NODE_LINE && |
(p->flags & TERMP_NONEWLINE) == 0) |
(p->flags & TERMP_NONEWLINE) == 0) |
term_newln(p); |
term_newln(p); |
|
else if (n->flags & NODE_DELIMC) |
|
p->flags |= TERMP_NOSPACE; |
|
|
term_word(p, n->string); |
term_word(p, n->string); |
goto out; |
goto out; |
|
case ROFFT_COMMENT: |
|
return; |
case ROFFT_EQN: |
case ROFFT_EQN: |
if ( ! (n->flags & NODE_LINE)) |
if ( ! (n->flags & NODE_LINE)) |
p->flags |= TERMP_NOSPACE; |
p->flags |= TERMP_NOSPACE; |
Line 1024 print_man_foot(struct termp *p, const struct roff_meta |
|
Line 1036 print_man_foot(struct termp *p, const struct roff_meta |
|
|
|
term_word(p, title); |
term_word(p, title); |
term_flushln(p); |
term_flushln(p); |
|
|
|
/* |
|
* Reset the terminal state for more output after the footer: |
|
* Some output modes, in particular PostScript and PDF, print |
|
* the header and the footer into a buffer such that it can be |
|
* reused for multiple output pages, then go on to format the |
|
* main text. |
|
*/ |
|
|
|
p->tcol->offset = 0; |
|
p->flags = 0; |
|
|
free(title); |
free(title); |
} |
} |
|
|