version 1.172, 2017/05/05 15:17:32 |
version 1.175, 2017/06/17 13:06:16 |
|
|
man_ptext(struct roff_man *man, int line, char *buf, int offs) |
man_ptext(struct roff_man *man, int line, char *buf, int offs) |
{ |
{ |
int i; |
int i; |
|
const char *cp, *sp; |
|
char *ep; |
|
|
/* Literal free-form text whitespace is preserved. */ |
/* Literal free-form text whitespace is preserved. */ |
|
|
Line 89 man_ptext(struct roff_man *man, int line, char *buf, i |
|
Line 91 man_ptext(struct roff_man *man, int line, char *buf, i |
|
/* Skip leading whitespace. */ ; |
/* Skip leading whitespace. */ ; |
|
|
/* |
/* |
* Blank lines are ignored right after headings |
* Blank lines are ignored in next line scope |
|
* and right after headings and cancel preceding \c, |
* but add a single vertical space elsewhere. |
* but add a single vertical space elsewhere. |
*/ |
*/ |
|
|
if (buf[i] == '\0') { |
if (buf[i] == '\0') { |
/* Allocate a blank entry. */ |
if (man->flags & (MAN_ELINE | MAN_BLINE)) { |
if (man->last->tok != MAN_SH && |
mandoc_msg(MANDOCERR_BLK_BLANK, man->parse, |
man->last->tok != MAN_SS) { |
line, 0, NULL); |
roff_elem_alloc(man, line, offs, ROFF_sp); |
return 1; |
man->next = ROFF_NEXT_SIBLING; |
|
} |
} |
|
if (man->last->tok == MAN_SH || man->last->tok == MAN_SS) |
|
return 1; |
|
switch (man->last->type) { |
|
case ROFFT_TEXT: |
|
sp = man->last->string; |
|
cp = ep = strchr(sp, '\0') - 2; |
|
if (cp < sp || cp[0] != '\\' || cp[1] != 'c') |
|
break; |
|
while (cp > sp && cp[-1] == '\\') |
|
cp--; |
|
if ((ep - cp) % 2) |
|
break; |
|
*ep = '\0'; |
|
return 1; |
|
default: |
|
break; |
|
} |
|
roff_elem_alloc(man, line, offs, ROFF_sp); |
|
man->next = ROFF_NEXT_SIBLING; |
return 1; |
return 1; |
} |
} |
|
|
Line 258 man_breakscope(struct roff_man *man, int tok) |
|
Line 279 man_breakscope(struct roff_man *man, int tok) |
|
* Delete the element that is being broken. |
* Delete the element that is being broken. |
*/ |
*/ |
|
|
if (man->flags & MAN_ELINE && (tok == TOKEN_NONE || |
if (man->flags & MAN_ELINE && (tok < MAN_TH || |
! (man_macros[tok].flags & MAN_NSCOPED))) { |
! (man_macros[tok].flags & MAN_NSCOPED))) { |
n = man->last; |
n = man->last; |
assert(n->type != ROFFT_TEXT); |
assert(n->type != ROFFT_TEXT); |
Line 267 man_breakscope(struct roff_man *man, int tok) |
|
Line 288 man_breakscope(struct roff_man *man, int tok) |
|
|
|
mandoc_vmsg(MANDOCERR_BLK_LINE, man->parse, |
mandoc_vmsg(MANDOCERR_BLK_LINE, man->parse, |
n->line, n->pos, "%s breaks %s", |
n->line, n->pos, "%s breaks %s", |
tok == TOKEN_NONE ? "TS" : roff_name[tok], |
roff_name[tok], roff_name[n->tok]); |
roff_name[n->tok]); |
|
|
|
roff_node_delete(man, n); |
roff_node_delete(man, n); |
man->flags &= ~MAN_ELINE; |
man->flags &= ~MAN_ELINE; |
Line 294 man_breakscope(struct roff_man *man, int tok) |
|
Line 314 man_breakscope(struct roff_man *man, int tok) |
|
* Delete the block that is being broken. |
* Delete the block that is being broken. |
*/ |
*/ |
|
|
if (man->flags & MAN_BLINE && (tok == TOKEN_NONE || |
if (man->flags & MAN_BLINE && (tok < MAN_TH || |
man_macros[tok].flags & MAN_BSCOPE)) { |
man_macros[tok].flags & MAN_BSCOPE)) { |
n = man->last; |
n = man->last; |
if (n->type == ROFFT_TEXT) |
if (n->type == ROFFT_TEXT) |
Line 309 man_breakscope(struct roff_man *man, int tok) |
|
Line 329 man_breakscope(struct roff_man *man, int tok) |
|
|
|
mandoc_vmsg(MANDOCERR_BLK_LINE, man->parse, |
mandoc_vmsg(MANDOCERR_BLK_LINE, man->parse, |
n->line, n->pos, "%s breaks %s", |
n->line, n->pos, "%s breaks %s", |
tok == TOKEN_NONE ? "TS" : roff_name[tok], |
roff_name[tok], roff_name[n->tok]); |
roff_name[n->tok]); |
|
|
|
roff_node_delete(man, n); |
roff_node_delete(man, n); |
man->flags &= ~MAN_BLINE; |
man->flags &= ~MAN_BLINE; |