summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2011-02-06 22:56:46 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2011-02-06 22:56:46 +0000
commitd62a2d0b098580d24c9e88a7744ae6bb5d13754a (patch)
tree7cef9f910458b3b4263584ae0136f0c8d270a84c
parentc12284a87f6464cb76f414396466c8d21b762e3d (diff)
Do not break the line between the arguments of .Bsx .Dx .Fx .Nx .Ox .Ux.
Original patch from kristaps@, but i fixed a regression regarding .Bk.
-rw-r--r--regress/usr.bin/mandoc/mdoc/Makefile4
-rw-r--r--regress/usr.bin/mandoc/mdoc/Ox/Makefile6
-rw-r--r--regress/usr.bin/mandoc/mdoc/Ox/keep.in11
-rw-r--r--regress/usr.bin/mandoc/mdoc/Ox/keep.out_ascii9
-rw-r--r--usr.bin/mandoc/mdoc_html.c12
-rw-r--r--usr.bin/mandoc/mdoc_term.c12
6 files changed, 47 insertions, 7 deletions
diff --git a/regress/usr.bin/mandoc/mdoc/Makefile b/regress/usr.bin/mandoc/mdoc/Makefile
index edd6cf873a6..642b6b4f9f3 100644
--- a/regress/usr.bin/mandoc/mdoc/Makefile
+++ b/regress/usr.bin/mandoc/mdoc/Makefile
@@ -1,7 +1,7 @@
-# $OpenBSD: Makefile,v 1.13 2011/02/06 00:18:58 schwarze Exp $
+# $OpenBSD: Makefile,v 1.14 2011/02/06 22:56:45 schwarze Exp $
SUBDIR+= Ad Ar At Bd Bk Bl Bx Cd Er Fl Fo Ic In
-SUBDIR+= Lb Li Ms Mt Nd Nm No Ns Op Pf Pp Rs Sm St Sx Sy Tn Vt Xr
+SUBDIR+= Lb Li Ms Mt Nd Nm No Ns Op Ox Pf Pp Rs Sm St Sx Sy Tn Vt Xr
SUBDIR+= blank
# disabled, mandoc must be fixed:
diff --git a/regress/usr.bin/mandoc/mdoc/Ox/Makefile b/regress/usr.bin/mandoc/mdoc/Ox/Makefile
new file mode 100644
index 00000000000..cd5875c38df
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Ox/Makefile
@@ -0,0 +1,6 @@
+# $OpenBSD: Makefile,v 1.1 2011/02/06 22:56:45 schwarze Exp $
+
+REGRESS_TARGETS=keep
+GROFF_TARGETS=keep
+
+.include <bsd.regress.mk>
diff --git a/regress/usr.bin/mandoc/mdoc/Ox/keep.in b/regress/usr.bin/mandoc/mdoc/Ox/keep.in
new file mode 100644
index 00000000000..1a37894f405
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Ox/keep.in
@@ -0,0 +1,11 @@
+.Dd January 30, 2011
+.Dt OX-KEEP 1
+.Os
+.Sh NAME
+.Nm Ox-keep
+.Nd interaction of unix variant macros and word keeps
+.Sh DESCRIPTION
+Because we use a keep,
+.Bk -words
+.Ox 4.9 must be at the beginning of a new line.
+.Ek
diff --git a/regress/usr.bin/mandoc/mdoc/Ox/keep.out_ascii b/regress/usr.bin/mandoc/mdoc/Ox/keep.out_ascii
new file mode 100644
index 00000000000..b064d835294
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Ox/keep.out_ascii
@@ -0,0 +1,9 @@
+OX-KEEP(1) OpenBSD Reference Manual OX-KEEP(1)
+
+NNAAMMEE
+ OOxx--kkeeeepp - interaction of unix variant macros and word keeps
+
+DDEESSCCRRIIPPTTIIOONN
+ Because we use a keep,
+ OpenBSD 4.9 must be at the beginning of a new line.
+
diff --git a/usr.bin/mandoc/mdoc_html.c b/usr.bin/mandoc/mdoc_html.c
index d57108e71a2..05f636d3008 100644
--- a/usr.bin/mandoc/mdoc_html.c
+++ b/usr.bin/mandoc/mdoc_html.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_html.c,v 1.51 2011/02/06 17:33:20 schwarze Exp $ */
+/* $Id: mdoc_html.c,v 1.52 2011/02/06 22:56:45 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -800,6 +800,7 @@ mdoc_xx_pre(MDOC_ARGS)
{
const char *pp;
struct htmlpair tag;
+ int flags;
switch (n->tok) {
case (MDOC_Bsx):
@@ -826,8 +827,15 @@ mdoc_xx_pre(MDOC_ARGS)
PAIR_CLASS_INIT(&tag, "unix");
print_otag(h, TAG_SPAN, 1, &tag);
+
print_text(h, pp);
- return(1);
+ if (n->child) {
+ flags = h->flags;
+ h->flags |= HTML_KEEP;
+ print_text(h, n->child->string);
+ h->flags = flags;
+ }
+ return(0);
}
diff --git a/usr.bin/mandoc/mdoc_term.c b/usr.bin/mandoc/mdoc_term.c
index 88f238b543c..8eae39aa0a1 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.128 2011/02/06 22:25:36 schwarze Exp $ */
+/* $Id: mdoc_term.c,v 1.129 2011/02/06 22:56:45 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org>
@@ -1705,6 +1705,7 @@ static int
termp_xx_pre(DECL_ARGS)
{
const char *pp;
+ int flags;
pp = NULL;
switch (n->tok) {
@@ -1730,9 +1731,14 @@ termp_xx_pre(DECL_ARGS)
break;
}
- assert(pp);
term_word(p, pp);
- return(1);
+ if (n->child) {
+ flags = p->flags;
+ p->flags |= TERMP_KEEP;
+ term_word(p, n->child->string);
+ p->flags = flags;
+ }
+ return(0);
}