summaryrefslogtreecommitdiffstats
path: root/man_term.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-08-13 12:31:50 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-08-13 12:31:50 +0000
commitd79adbbd22e2af10c5e82d6e61a45712042d6601 (patch)
tree6302eb0cd315f33683acb70edc09ba41a95c9376 /man_term.c
parentfb03acbc5fea24978190703b547b408b3fa45664 (diff)
downloadmandoc-d79adbbd22e2af10c5e82d6e61a45712042d6601.tar.gz
Added proper `TP' support.
Diffstat (limited to 'man_term.c')
-rw-r--r--man_term.c65
1 files changed, 40 insertions, 25 deletions
diff --git a/man_term.c b/man_term.c
index 504f8a7c..57530644 100644
--- a/man_term.c
+++ b/man_term.c
@@ -69,6 +69,7 @@ static void post_I(DECL_ARGS);
static void post_HP(DECL_ARGS);
static void post_SH(DECL_ARGS);
static void post_SS(DECL_ARGS);
+static void post_TP(DECL_ARGS);
static void post_i(DECL_ARGS);
static const struct termact termacts[MAN_MAX] = {
@@ -76,7 +77,7 @@ static const struct termact termacts[MAN_MAX] = {
{ NULL, NULL }, /* TH */
{ pre_SH, post_SH }, /* SH */
{ pre_SS, post_SS }, /* SS */
- { pre_TP, NULL }, /* TP */
+ { pre_TP, post_TP }, /* TP */
{ pre_PP, NULL }, /* LP */
{ pre_PP, NULL }, /* PP */
{ pre_PP, NULL }, /* P */
@@ -522,35 +523,49 @@ pre_IP(DECL_ARGS)
static int
pre_TP(DECL_ARGS)
{
- /* TODO */
-#if 0
- const struct man_node *nn;
- size_t offs;
- term_vspace(p);
-
- p->offset = INDENT;
+ switch (n->type) {
+ case (MAN_BLOCK):
+ fmt_block_vspace(p, n);
+ break;
+ case (MAN_HEAD):
+ p->rmargin = INDENT * 2;
+ p->offset = INDENT;
+ p->flags |= TERMP_NOBREAK;
+ p->flags |= TERMP_TWOSPACE;
+ break;
+ case (MAN_BODY):
+ p->flags |= TERMP_NOLPAD;
+ p->flags |= TERMP_NOSPACE;
+ p->offset = INDENT * 2;
+ break;
+ default:
+ break;
+ }
- if (NULL == (nn = n->child))
- return(1);
+ return(1);
+}
- if (nn->line == n->line) {
- if (MAN_TEXT != nn->type)
- errx(1, "expected text line argument");
- offs = (size_t)atoi(nn->string);
- nn = nn->next;
- } else
- offs = INDENT;
- for ( ; nn; nn = nn->next)
- print_node(p, fl, nn, m);
+/* ARGSUSED */
+static void
+post_TP(DECL_ARGS)
+{
- term_flushln(p);
- p->flags |= TERMP_NOSPACE;
- p->offset += offs;
- return(0);
-#endif
- return(1);
+ switch (n->type) {
+ case (MAN_HEAD):
+ term_flushln(p);
+ p->flags &= ~TERMP_NOBREAK;
+ p->flags &= ~TERMP_TWOSPACE;
+ p->rmargin = p->maxrmargin;
+ break;
+ case (MAN_BODY):
+ term_flushln(p);
+ p->flags &= ~TERMP_NOLPAD;
+ break;
+ default:
+ break;
+ }
}