aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_term.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-09-17 20:18:58 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-09-17 20:18:58 +0000
commit756bc1418bc14662d5166b584a15d391ce60eeef (patch)
tree8149b707186a3b458729b0a0dbb752bc8a48876d /mdoc_term.c
parentf85be39182e378f3e41ba0909f7afabbf5758462 (diff)
downloadmandoc-756bc1418bc14662d5166b584a15d391ce60eeef.tar.gz
mandoc-756bc1418bc14662d5166b584a15d391ce60eeef.tar.zst
mandoc-756bc1418bc14662d5166b584a15d391ce60eeef.zip
simplify handling of .An -[no]split for terminal output:
delete one static function, one flag #define, and 25 lines of code; no functional change
Diffstat (limited to 'mdoc_term.c')
-rw-r--r--mdoc_term.c62
1 files changed, 17 insertions, 45 deletions
diff --git a/mdoc_term.c b/mdoc_term.c
index 21aa4a7c..c4e4ec4f 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_term.c,v 1.281 2014/09/03 05:22:45 schwarze Exp $ */
+/* $Id: mdoc_term.c,v 1.282 2014/09/17 20:18:58 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -65,7 +65,6 @@ static void synopsis_pre(struct termp *,
static void termp____post(DECL_ARGS);
static void termp__t_post(DECL_ARGS);
-static void termp_an_post(DECL_ARGS);
static void termp_bd_post(DECL_ARGS);
static void termp_bk_post(DECL_ARGS);
static void termp_bl_post(DECL_ARGS);
@@ -138,7 +137,7 @@ static const struct termact termacts[MDOC_MAX] = {
{ NULL, NULL }, /* El */
{ termp_it_pre, termp_it_post }, /* It */
{ termp_under_pre, NULL }, /* Ad */
- { termp_an_pre, termp_an_post }, /* An */
+ { termp_an_pre, NULL }, /* An */
{ termp_under_pre, NULL }, /* Ar */
{ termp_cd_pre, NULL }, /* Cd */
{ termp_bold_pre, NULL }, /* Cm */
@@ -1106,54 +1105,27 @@ static int
termp_an_pre(DECL_ARGS)
{
- if (NULL == n->child)
- return(1);
-
- /*
- * If not in the AUTHORS section, `An -split' will cause
- * newlines to occur before the author name. If in the AUTHORS
- * section, by default, the first `An' invocation is nosplit,
- * then all subsequent ones, regardless of whether interspersed
- * with other macros/text, are split. -split, in this case,
- * will override the condition of the implied first -nosplit.
- */
-
- if (n->sec == SEC_AUTHORS) {
- if ( ! (TERMP_ANPREC & p->flags)) {
- if (TERMP_SPLIT & p->flags)
- term_newln(p);
- return(1);
- }
- if (TERMP_NOSPLIT & p->flags)
- return(1);
- term_newln(p);
- return(1);
- }
-
- if (TERMP_SPLIT & p->flags)
- term_newln(p);
-
- return(1);
-}
-
-static void
-termp_an_post(DECL_ARGS)
-{
-
- if (n->child) {
- if (SEC_AUTHORS == n->sec)
- p->flags |= TERMP_ANPREC;
- return;
- }
-
- if (AUTH_split == n->norm->An.auth) {
+ if (n->norm->An.auth == AUTH_split) {
p->flags &= ~TERMP_NOSPLIT;
p->flags |= TERMP_SPLIT;
- } else if (AUTH_nosplit == n->norm->An.auth) {
+ return(0);
+ }
+ if (n->norm->An.auth == AUTH_nosplit) {
p->flags &= ~TERMP_SPLIT;
p->flags |= TERMP_NOSPLIT;
+ return(0);
}
+ if (n->child == NULL)
+ return(0);
+
+ if (p->flags & TERMP_SPLIT)
+ term_newln(p);
+
+ if (n->sec == SEC_AUTHORS && ! (p->flags & TERMP_NOSPLIT))
+ p->flags |= TERMP_SPLIT;
+
+ return(1);
}
static int