aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2012-07-11 16:19:08 +0000
committerIngo Schwarze <schwarze@openbsd.org>2012-07-11 16:19:08 +0000
commit73fe8afeea7ced44f00ab0a5a25c42d5ee23800b (patch)
treec98b468f2fb4bd4131e18280dba3ba04e31494d5
parentd5973a09c2048d5499eb9034d85ab6ecffdaa529 (diff)
downloadmandoc-73fe8afeea7ced44f00ab0a5a25c42d5ee23800b.tar.gz
mandoc-73fe8afeea7ced44f00ab0a5a25c42d5ee23800b.tar.zst
mandoc-73fe8afeea7ced44f00ab0a5a25c42d5ee23800b.zip
basic implementation of -Tman .Bl -column using tbl(7); OpenBSD rev. 1.31
-rw-r--r--mdoc_man.c48
1 files changed, 42 insertions, 6 deletions
diff --git a/mdoc_man.c b/mdoc_man.c
index 71020ebe..c50286c5 100644
--- a/mdoc_man.c
+++ b/mdoc_man.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_man.c,v 1.32 2012/07/10 20:37:02 schwarze Exp $ */
+/* $Id: mdoc_man.c,v 1.33 2012/07/11 16:19:08 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -754,9 +754,24 @@ post_bk(DECL_ARGS)
static int
pre_bl(DECL_ARGS)
{
+ size_t icol;
- if (LIST_enum == n->norm->Bl.type)
+ switch (n->norm->Bl.type) {
+ case (LIST_enum):
n->norm->Bl.count = 0;
+ return(1);
+ case (LIST_column):
+ break;
+ default:
+ return(1);
+ }
+
+ outflags |= MMAN_nl;
+ print_word(".TS");
+ outflags |= MMAN_nl;
+ for (icol = 0; icol < n->norm->Bl.ncols; icol++)
+ print_word("l");
+ print_word(".");
return(1);
}
@@ -764,9 +779,18 @@ static void
post_bl(DECL_ARGS)
{
- outflags |= MMAN_br;
- if (LIST_enum == n->norm->Bl.type)
+ switch (n->norm->Bl.type) {
+ case (LIST_enum):
n->norm->Bl.count = 0;
+ break;
+ case (LIST_column):
+ outflags |= MMAN_nl;
+ print_word(".TE");
+ break;
+ default:
+ break;
+ }
+ outflags |= MMAN_br;
}
static int
@@ -1075,8 +1099,10 @@ post_it(DECL_ARGS)
{
const struct mdoc_node *bln;
- if (MDOC_HEAD == n->type) {
- bln = n->parent->parent;
+ bln = n->parent->parent;
+
+ switch (n->type) {
+ case (MDOC_HEAD):
switch (bln->norm->Bl.type) {
case (LIST_diag):
outflags &= ~MMAN_spc;
@@ -1088,6 +1114,16 @@ post_it(DECL_ARGS)
default:
break;
}
+ break;
+ case (MDOC_BODY):
+ if (LIST_column == bln->norm->Bl.type &&
+ NULL != n->next) {
+ putchar('\t');
+ outflags &= ~MMAN_spc;
+ }
+ break;
+ default:
+ break;
}
}