summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc/man_term.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2010-10-15 20:45:04 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2010-10-15 20:45:04 +0000
commitaee39240bb5c1864b2c71e6ea552b46d90463fcf (patch)
tree2c36f38eec63f2abf5a8e02164d2d57f2ee073e9 /usr.bin/mandoc/man_term.c
parent4dd735d2ad0e1362c6c908b076491a2db8f0b4d4 (diff)
Minimal glue to integrate tbl into the mandoc man(7) parser and formatter.
The output dosn't look nice yet, escape handling is still missing, but will follow soon. "move forward aggressively :-)" deraadt@
Diffstat (limited to 'usr.bin/mandoc/man_term.c')
-rw-r--r--usr.bin/mandoc/man_term.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/usr.bin/mandoc/man_term.c b/usr.bin/mandoc/man_term.c
index 074c3b7d257..c3e03b39d2b 100644
--- a/usr.bin/mandoc/man_term.c
+++ b/usr.bin/mandoc/man_term.c
@@ -1,4 +1,4 @@
-/* $Id: man_term.c,v 1.46 2010/09/21 22:33:41 schwarze Exp $ */
+/* $Id: man_term.c,v 1.47 2010/10/15 20:45:03 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -28,6 +28,7 @@
#include "term.h"
#include "chars.h"
#include "main.h"
+#include "tbl.h"
#define INDENT 7
#define HALFINDENT 3
@@ -92,6 +93,7 @@ static int pre_ign(DECL_ARGS);
static int pre_in(DECL_ARGS);
static int pre_literal(DECL_ARGS);
static int pre_sp(DECL_ARGS);
+static int pre_TS(DECL_ARGS);
static void post_IP(DECL_ARGS);
static void post_HP(DECL_ARGS);
@@ -138,6 +140,8 @@ static const struct termact termacts[MAN_MAX] = {
{ pre_literal, NULL, 0 }, /* Ve */
{ pre_ign, NULL, 0 }, /* AT */
{ pre_in, NULL, MAN_NOTEXT }, /* in */
+ { pre_TS, NULL, 0 }, /* TS */
+ { NULL, NULL, 0 }, /* TE */
};
@@ -826,6 +830,23 @@ post_RS(DECL_ARGS)
}
+/* ARGSUSED */
+static int
+pre_TS(DECL_ARGS)
+{
+
+ if (MAN_BLOCK != n->type)
+ return(0);
+
+ if ( ! tbl_close(n->data.TS, "<man>", n->line))
+ return(0);
+
+ tbl_write(n->data.TS);
+
+ return(0);
+}
+
+
static void
print_man_node(DECL_ARGS)
{