summaryrefslogtreecommitdiffstatshomepage
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
commit96606df95b209a1590d0eb63bf10d841251e4e5c (patch)
treecf7767e309885261549378864a2ed8186bb336e1
parent86fcbc2e37c7ce462902083265822b79401cecf7 (diff)
downloadmandoc-96606df95b209a1590d0eb63bf10d841251e4e5c.tar.gz
mandoc-96606df95b209a1590d0eb63bf10d841251e4e5c.tar.zst
mandoc-96606df95b209a1590d0eb63bf10d841251e4e5c.zip
Added proper `TP' support.
-rw-r--r--man.76
-rw-r--r--man_term.c67
2 files changed, 45 insertions, 28 deletions
diff --git a/man.7 b/man.7
index 0bb26bc7..0743e4a6 100644
--- a/man.7
+++ b/man.7
@@ -1,4 +1,4 @@
-.\" $Id: man.7,v 1.23 2009/08/13 12:15:58 kristaps Exp $
+.\" $Id: man.7,v 1.24 2009/08/13 12:31:50 kristaps Exp $
.\"
.\" Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se>
.\"
@@ -339,7 +339,9 @@ string specifies the organisation providing the utility. The
.Va volume
replaces the default rendered volume as dictated by the manual section.
.It \&TP
-.\" TODO.
+Begin a paragraph where the head, if exceeding the indentation point, is
+followed by a newline; if not, the body follows on the same line after a
+buffer to the indentation point. Subsequent output lines are indented.
.It \&br
Breaks the current line. Consecutive invocations have no further effect.
.\" TODO.
diff --git a/man_term.c b/man_term.c
index 4d411f24..6506d08e 100644
--- a/man_term.c
+++ b/man_term.c
@@ -1,4 +1,4 @@
-/* $Id: man_term.c,v 1.20 2009/08/13 12:15:58 kristaps Exp $ */
+/* $Id: man_term.c,v 1.21 2009/08/13 12:31:50 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -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;
+ }
}