version 1.162, 2015/04/23 15:35:59 |
version 1.164, 2015/09/04 21:25:00 |
Line 283 man_breakscope(struct roff_man *man, int tok) |
|
Line 283 man_breakscope(struct roff_man *man, int tok) |
|
} |
} |
|
|
/* |
/* |
|
* Weird special case: |
|
* Switching fill mode closes section headers. |
|
*/ |
|
|
|
if (man->flags & MAN_BLINE && |
|
(tok == MAN_nf || tok == MAN_fi) && |
|
(man->last->tok == MAN_SH || man->last->tok == MAN_SS)) { |
|
n = man->last; |
|
man_unscope(man, n); |
|
roff_body_alloc(man, n->line, n->pos, n->tok); |
|
man->flags &= ~MAN_BLINE; |
|
} |
|
|
|
/* |
* A block header next line scope is open, |
* A block header next line scope is open, |
* and the new macro is not allowed inside block headers. |
* and the new macro is not allowed inside block headers. |
* Delete the block that is being broken. |
* Delete the block that is being broken. |
Line 317 man_mparse(const struct roff_man *man) |
|
Line 331 man_mparse(const struct roff_man *man) |
|
|
|
assert(man && man->parse); |
assert(man && man->parse); |
return(man->parse); |
return(man->parse); |
} |
|
|
|
void |
|
man_deroff(char **dest, const struct roff_node *n) |
|
{ |
|
char *cp; |
|
size_t sz; |
|
|
|
if (n->type != ROFFT_TEXT) { |
|
for (n = n->child; n; n = n->next) |
|
man_deroff(dest, n); |
|
return; |
|
} |
|
|
|
/* Skip leading whitespace and escape sequences. */ |
|
|
|
cp = n->string; |
|
while ('\0' != *cp) { |
|
if ('\\' == *cp) { |
|
cp++; |
|
mandoc_escape((const char **)&cp, NULL, NULL); |
|
} else if (isspace((unsigned char)*cp)) |
|
cp++; |
|
else |
|
break; |
|
} |
|
|
|
/* Skip trailing whitespace. */ |
|
|
|
for (sz = strlen(cp); sz; sz--) |
|
if (0 == isspace((unsigned char)cp[sz-1])) |
|
break; |
|
|
|
/* Skip empty strings. */ |
|
|
|
if (0 == sz) |
|
return; |
|
|
|
if (NULL == *dest) { |
|
*dest = mandoc_strndup(cp, sz); |
|
return; |
|
} |
|
|
|
mandoc_asprintf(&cp, "%s %*s", *dest, (int)sz, cp); |
|
free(*dest); |
|
*dest = cp; |
|
} |
} |