aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_man.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2012-07-08 16:52:20 +0000
committerIngo Schwarze <schwarze@openbsd.org>2012-07-08 16:52:20 +0000
commite00c497f98e897ea30cb2e7a41f009c5272a234f (patch)
tree4165671187dc805cd780de98cf5e420366fd5c7b /mdoc_man.c
parent9aed0ad6fe5f405b87bb5ac69baccbcb31a706ec (diff)
downloadmandoc-e00c497f98e897ea30cb2e7a41f009c5272a234f.tar.gz
mandoc-e00c497f98e897ea30cb2e7a41f009c5272a234f.tar.zst
mandoc-e00c497f98e897ea30cb2e7a41f009c5272a234f.zip
implement -Tman .An
also reset -[no]split mode at .Sh AUTHORS in -Tascii OpenBSD rev. 1.20 and 1.141, respectively
Diffstat (limited to 'mdoc_man.c')
-rw-r--r--mdoc_man.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/mdoc_man.c b/mdoc_man.c
index deea181c..0e0516a9 100644
--- a/mdoc_man.c
+++ b/mdoc_man.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_man.c,v 1.21 2012/07/08 15:48:13 schwarze Exp $ */
+/* $Id: mdoc_man.c,v 1.22 2012/07/08 16:52:20 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -56,6 +56,7 @@ static void post_pf(DECL_ARGS);
static void post_sect(DECL_ARGS);
static void post_sp(DECL_ARGS);
static void post_vt(DECL_ARGS);
+static int pre_an(DECL_ARGS);
static int pre_ap(DECL_ARGS);
static int pre_bd(DECL_ARGS);
static int pre_bk(DECL_ARGS);
@@ -97,7 +98,7 @@ static const struct manact manacts[MDOC_MAX + 1] = {
{ NULL, NULL, NULL, NULL, NULL }, /* El */
{ NULL, pre_it, NULL, NULL, NULL }, /* _It */
{ NULL, pre_enc, post_enc, "\\fI", "\\fP" }, /* Ad */
- { NULL, NULL, NULL, NULL, NULL }, /* _An */
+ { NULL, pre_an, NULL, NULL, NULL }, /* An */
{ NULL, pre_enc, post_enc, "\\fI", "\\fP" }, /* Ar */
{ NULL, pre_enc, post_enc, "\\fB", "\\fP" }, /* Cd */
{ NULL, pre_enc, post_enc, "\\fB", "\\fP" }, /* Cm */
@@ -220,6 +221,8 @@ static int outflags;
#define MMAN_sp (1 << 3)
#define MMAN_Sm (1 << 4)
#define MMAN_Bk (1 << 5)
+#define MMAN_An_split (1 << 6)
+#define MMAN_An_nosplit (1 << 7)
static void
print_word(const char *s)
@@ -481,6 +484,31 @@ post_sect(DECL_ARGS)
outflags &= ~MMAN_spc;
print_word("\"");
outflags |= MMAN_nl;
+ if (MDOC_Sh == n->tok && SEC_AUTHORS == n->sec)
+ outflags &= ~(MMAN_An_split | MMAN_An_nosplit);
+}
+
+static int
+pre_an(DECL_ARGS)
+{
+
+ switch (n->norm->An.auth) {
+ case (AUTH_split):
+ outflags &= ~MMAN_An_nosplit;
+ outflags |= MMAN_An_split;
+ return(0);
+ case (AUTH_nosplit):
+ outflags &= ~MMAN_An_split;
+ outflags |= MMAN_An_nosplit;
+ return(0);
+ default:
+ if (MMAN_An_split & outflags)
+ outflags |= MMAN_br;
+ else if (SEC_AUTHORS == n->sec &&
+ ! (MMAN_An_nosplit & outflags))
+ outflags |= MMAN_An_split;
+ return(1);
+ }
}
static int