summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2012-07-07 21:15:38 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2012-07-07 21:15:38 +0000
commit90ea7ca1baa242a277405f0dc527ded66ff74bc6 (patch)
tree0b1591f00e9121efb0efe0cd1870812cbae9f91a /usr.bin/mandoc
parent46d3af4d47a86b1bbd83adf330b02f9ab5da31e2 (diff)
rudimentary support for -Tman .Ft and .Fn;
some blank lines are still missing from the output
Diffstat (limited to 'usr.bin/mandoc')
-rw-r--r--usr.bin/mandoc/mdoc_man.c52
1 files changed, 49 insertions, 3 deletions
diff --git a/usr.bin/mandoc/mdoc_man.c b/usr.bin/mandoc/mdoc_man.c
index 16928d91e3d..60f19ac43ee 100644
--- a/usr.bin/mandoc/mdoc_man.c
+++ b/usr.bin/mandoc/mdoc_man.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_man.c,v 1.12 2012/07/07 20:34:20 schwarze Exp $ */
+/* $Id: mdoc_man.c,v 1.13 2012/07/07 21:15:37 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -49,6 +49,7 @@ static void post_bd(DECL_ARGS);
static void post_bk(DECL_ARGS);
static void post_dl(DECL_ARGS);
static void post_enc(DECL_ARGS);
+static void post_fn(DECL_ARGS);
static void post_in(DECL_ARGS);
static void post_lb(DECL_ARGS);
static void post_nm(DECL_ARGS);
@@ -63,6 +64,7 @@ static int pre_br(DECL_ARGS);
static int pre_bx(DECL_ARGS);
static int pre_dl(DECL_ARGS);
static int pre_enc(DECL_ARGS);
+static int pre_fn(DECL_ARGS);
static int pre_in(DECL_ARGS);
static int pre_it(DECL_ARGS);
static int pre_nm(DECL_ARGS);
@@ -106,8 +108,8 @@ static const struct manact manacts[MDOC_MAX + 1] = {
{ NULL, NULL, NULL, NULL, NULL }, /* _Fa */
{ NULL, NULL, NULL, NULL, NULL }, /* _Fd */
{ NULL, pre_enc, post_enc, "\\fB-", "\\fP" }, /* Fl */
- { NULL, NULL, NULL, NULL, NULL }, /* _Fn */
- { NULL, NULL, NULL, NULL, NULL }, /* _Ft */
+ { NULL, pre_fn, post_fn, NULL, NULL }, /* Fn */
+ { NULL, pre_enc, post_enc, "\\fI", "\\fP" }, /* Ft */
{ NULL, pre_enc, post_enc, "\\fB", "\\fP" }, /* Ic */
{ NULL, pre_in, post_in, NULL, NULL }, /* In */
{ NULL, pre_enc, post_enc, "\\fR", "\\fP" }, /* Li */
@@ -584,6 +586,50 @@ post_dl(DECL_ARGS)
}
static int
+pre_fn(DECL_ARGS)
+{
+
+ n = n->child;
+ if (NULL == n)
+ return(0);
+
+ if (MDOC_SYNPRETTY & n->flags) {
+ mm->need_nl = 1;
+ print_word(mm, ".br");
+ mm->need_nl = 1;
+ }
+ print_word(mm, "\\fB");
+ mm->need_space = 0;
+ print_node(m, n, mm);
+ mm->need_space = 0;
+ print_word(mm, "\\fP(");
+ mm->need_space = 0;
+ for (n = n->next; n; n = n->next) {
+ print_word(mm, "\\fI");
+ mm->need_space = 0;
+ print_node(m, n, mm);
+ mm->need_space = 0;
+ print_word(mm, "\\fP");
+ if (NULL != n->next)
+ print_word(mm, ",");
+ }
+ return(0);
+}
+
+static void
+post_fn(DECL_ARGS)
+{
+
+ mm->need_space = 0;
+ print_word(mm, ");");
+ if (MDOC_SYNPRETTY & n->flags) {
+ mm->need_nl = 1;
+ print_word(mm, ".br");
+ mm->need_nl = 1;
+ }
+}
+
+static int
pre_in(DECL_ARGS)
{