diff options
-rw-r--r-- | regress/usr.bin/mandoc/mdoc/An/Makefile | 5 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/mdoc/An/break.in | 31 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/mdoc/An/break.out_ascii | 21 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/mdoc/Makefile | 4 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc_man.c | 32 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc_term.c | 4 |
6 files changed, 92 insertions, 5 deletions
diff --git a/regress/usr.bin/mandoc/mdoc/An/Makefile b/regress/usr.bin/mandoc/mdoc/An/Makefile new file mode 100644 index 00000000000..1d2356173e6 --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/An/Makefile @@ -0,0 +1,5 @@ +# $OpenBSD: Makefile,v 1.1 2012/07/08 16:50:36 schwarze Exp $ + +REGRESS_TARGETS = break + +.include <bsd.regress.mk> diff --git a/regress/usr.bin/mandoc/mdoc/An/break.in b/regress/usr.bin/mandoc/mdoc/An/break.in new file mode 100644 index 00000000000..5e6d596475b --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/An/break.in @@ -0,0 +1,31 @@ +.Dd July 8, 2012 +.Dt AN-BREAK 1 +.Os OpenBSD +.Sh NAME +.Nm An-break +.Nd line breaking of the author macro +.Sh DESCRIPTION +inline is the default: +.An Kristaps , +.An Ingo , +and +.An Joerg . +.Pp +.An -split +split mode: +.An Kristaps +.An Ingo +.An Joerg +.An -nosplit +.Sh AUTHORS +split mode is the default: +.An Kristaps +.An Ingo +.An Joerg +.An -nosplit +.Pp +inline: +.An Kristaps , +.An Ingo , +and +.An Joerg . diff --git a/regress/usr.bin/mandoc/mdoc/An/break.out_ascii b/regress/usr.bin/mandoc/mdoc/An/break.out_ascii new file mode 100644 index 00000000000..68035c9581e --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/An/break.out_ascii @@ -0,0 +1,21 @@ +AN-BREAK(1) OpenBSD Reference Manual AN-BREAK(1) + +NNAAMMEE + AAnn--bbrreeaakk - line breaking of the author macro + +DDEESSCCRRIIPPTTIIOONN + inline is the default: Kristaps, Ingo, and Joerg. + + split mode: + Kristaps + Ingo + Joerg + +AAUUTTHHOORRSS + split mode is the default: Kristaps + Ingo + Joerg + + inline: Kristaps, Ingo, and Joerg. + +OpenBSD July 8, 2012 OpenBSD diff --git a/regress/usr.bin/mandoc/mdoc/Makefile b/regress/usr.bin/mandoc/mdoc/Makefile index bda3aa3af95..ce5b7afc7e7 100644 --- a/regress/usr.bin/mandoc/mdoc/Makefile +++ b/regress/usr.bin/mandoc/mdoc/Makefile @@ -1,6 +1,6 @@ -# $OpenBSD: Makefile,v 1.18 2012/07/07 14:10:55 schwarze Exp $ +# $OpenBSD: Makefile,v 1.19 2012/07/08 16:50:36 schwarze Exp $ -SUBDIR += Ad Ap Aq Ar At Bd Bk Bl Brq Bx Cd Cm D1 Dl Dq Dv Er Ev Fl Fo +SUBDIR += Ad An Ap Aq Ar At Bd Bk Bl Brq Bx Cd Cm D1 Dl Dq Dv Er Ev Fl Fo SUBDIR += Ic In Lb Li Ms Mt Nd Nm No Ns Oo Op Ox Pf Pp Qq Rs SUBDIR += Sm Sq St Sx Sy Tn Ux Vt Xr blank diff --git a/usr.bin/mandoc/mdoc_man.c b/usr.bin/mandoc/mdoc_man.c index a77717a1d02..7fb308aae29 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.19 2012/07/08 15:46:47 schwarze Exp $ */ +/* $Id: mdoc_man.c,v 1.20 2012/07/08 16:50:36 schwarze Exp $ */ /* * Copyright (c) 2011, 2012 Ingo Schwarze <schwarze@openbsd.org> * @@ -52,6 +52,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); @@ -93,7 +94,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 */ @@ -216,6 +217,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) @@ -477,6 +480,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 diff --git a/usr.bin/mandoc/mdoc_term.c b/usr.bin/mandoc/mdoc_term.c index fd2b07e5796..c1b0a4e5957 100644 --- a/usr.bin/mandoc/mdoc_term.c +++ b/usr.bin/mandoc/mdoc_term.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_term.c,v 1.140 2011/11/13 13:05:23 schwarze Exp $ */ +/* $Id: mdoc_term.c,v 1.141 2012/07/08 16:50:36 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org> @@ -1421,6 +1421,8 @@ termp_sh_pre(DECL_ARGS) break; case (MDOC_BODY): p->offset = term_len(p, p->defindent); + if (SEC_AUTHORS == n->sec) + p->flags &= ~(TERMP_SPLIT|TERMP_NOSPLIT); break; default: break; |