version 1.96, 2011/01/12 10:43:22 |
version 1.98, 2011/01/16 20:12:45 |
|
|
/* $Id$ */ |
/* $Id$ */ |
/* |
/* |
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv> |
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> |
* Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org> |
* Copyright (c) 2010, 2011 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 |
Line 855 print_man_node(DECL_ARGS) |
|
Line 855 print_man_node(DECL_ARGS) |
|
size_t rm, rmax; |
size_t rm, rmax; |
int c; |
int c; |
|
|
c = 1; |
|
|
|
switch (n->type) { |
switch (n->type) { |
case(MAN_TEXT): |
case(MAN_TEXT): |
|
/* |
|
* If we have a blank line, output a vertical space. |
|
* If we have a space as the first character, break |
|
* before printing the line's data. |
|
*/ |
if ('\0' == *n->string) { |
if ('\0' == *n->string) { |
term_vspace(p); |
term_vspace(p); |
break; |
return; |
} |
} else if (' ' == *n->string && MAN_LINE & n->flags) |
|
|
if (' ' == *n->string && MAN_LINE & n->flags) |
|
term_newln(p); |
term_newln(p); |
|
|
term_word(p, n->string); |
term_word(p, n->string); |
|
|
/* FIXME: this means that macro lines are munged! */ |
/* |
|
* If we're in a literal context, make sure that words |
if (MANT_LITERAL & mt->fl) { |
* togehter on the same line stay together. This is a |
|
* POST-printing call, so we check the NEXT word. Since |
|
* -man doesn't have nested macros, we don't need to be |
|
* more specific than this. |
|
*/ |
|
if (MANT_LITERAL & mt->fl && |
|
(NULL == n->next || |
|
n->next->line > n->line)) { |
rm = p->rmargin; |
rm = p->rmargin; |
rmax = p->maxrmargin; |
rmax = p->maxrmargin; |
p->rmargin = p->maxrmargin = TERM_MAXMARGIN; |
p->rmargin = p->maxrmargin = TERM_MAXMARGIN; |
Line 881 print_man_node(DECL_ARGS) |
|
Line 889 print_man_node(DECL_ARGS) |
|
p->rmargin = rm; |
p->rmargin = rm; |
p->maxrmargin = rmax; |
p->maxrmargin = rmax; |
} |
} |
|
return; |
break; |
|
case (MAN_TBL): |
case (MAN_TBL): |
|
/* |
|
* Tables are preceded by a newline. Then process a |
|
* table line, which will cause line termination, |
|
*/ |
if (TBL_SPAN_FIRST & n->span->flags) |
if (TBL_SPAN_FIRST & n->span->flags) |
term_newln(p); |
term_newln(p); |
term_tbl(p, n->span); |
term_tbl(p, n->span); |
break; |
return; |
default: |
default: |
if ( ! (MAN_NOTEXT & termacts[n->tok].flags)) |
|
term_fontrepl(p, TERMFONT_NONE); |
|
if (termacts[n->tok].pre) |
|
c = (*termacts[n->tok].pre)(p, mt, n, m); |
|
break; |
break; |
} |
} |
|
|
|
if ( ! (MAN_NOTEXT & termacts[n->tok].flags)) |
|
term_fontrepl(p, TERMFONT_NONE); |
|
|
|
c = 1; |
|
if (termacts[n->tok].pre) |
|
c = (*termacts[n->tok].pre)(p, mt, n, m); |
|
|
if (c && n->child) |
if (c && n->child) |
print_man_nodelist(p, mt, n->child, m); |
print_man_nodelist(p, mt, n->child, m); |
|
|
switch (n->type) { |
if (termacts[n->tok].post) |
case (MAN_TEXT): |
(*termacts[n->tok].post)(p, mt, n, m); |
/* FALLTHROUGH */ |
if ( ! (MAN_NOTEXT & termacts[n->tok].flags)) |
case (MAN_TBL): |
term_fontrepl(p, TERMFONT_NONE); |
break; |
|
default: |
|
if (termacts[n->tok].post) |
|
(*termacts[n->tok].post)(p, mt, n, m); |
|
if ( ! (MAN_NOTEXT & termacts[n->tok].flags)) |
|
term_fontrepl(p, TERMFONT_NONE); |
|
break; |
|
} |
|
|
|
if (MAN_EOS & n->flags) |
if (MAN_EOS & n->flags) |
p->flags |= TERMP_SENTENCE; |
p->flags |= TERMP_SENTENCE; |