summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2012-07-14 10:43:49 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2012-07-14 10:43:49 +0000
commita2f1ac7e10563b50daa35c56d00d2b2ed809edbe (patch)
tree23b492a713c46a13766d450e7b3dabbda28de2cb
parent2b6567a7e3007502222f44800ee17b7fc24e083a (diff)
Translate blank input lines to .sp just like in mdoc(7),
and ignore .sp after .PP. This fixes vertical spacing for blank lines after .PP and for .sp after .PP.
-rw-r--r--regress/usr.bin/mandoc/man/Makefile4
-rw-r--r--regress/usr.bin/mandoc/man/blank/Makefile5
-rw-r--r--regress/usr.bin/mandoc/man/blank/line.in80
-rw-r--r--regress/usr.bin/mandoc/man/blank/line.out_ascii78
-rw-r--r--usr.bin/mandoc/man.c7
-rw-r--r--usr.bin/mandoc/man_term.c19
6 files changed, 184 insertions, 9 deletions
diff --git a/regress/usr.bin/mandoc/man/Makefile b/regress/usr.bin/mandoc/man/Makefile
index 592ce732287..1aef7968cc9 100644
--- a/regress/usr.bin/mandoc/man/Makefile
+++ b/regress/usr.bin/mandoc/man/Makefile
@@ -1,6 +1,6 @@
-# $OpenBSD: Makefile,v 1.9 2012/07/10 19:53:12 schwarze Exp $
+# $OpenBSD: Makefile,v 1.10 2012/07/14 10:43:48 schwarze Exp $
-SUBDIR = nf BI EX HP IP PP RS TH TP
+SUBDIR = nf BI EX HP IP PP RS TH TP blank
ascii groff groff-clean obj-clean tman: _SUBDIRUSE
diff --git a/regress/usr.bin/mandoc/man/blank/Makefile b/regress/usr.bin/mandoc/man/blank/Makefile
new file mode 100644
index 00000000000..c5d887c3cf9
--- /dev/null
+++ b/regress/usr.bin/mandoc/man/blank/Makefile
@@ -0,0 +1,5 @@
+# $OpenBSD: Makefile,v 1.1 2012/07/14 10:43:48 schwarze Exp $
+
+REGRESS_TARGETS = line
+
+.include <bsd.regress.mk>
diff --git a/regress/usr.bin/mandoc/man/blank/line.in b/regress/usr.bin/mandoc/man/blank/line.in
new file mode 100644
index 00000000000..13c751a3674
--- /dev/null
+++ b/regress/usr.bin/mandoc/man/blank/line.in
@@ -0,0 +1,80 @@
+.TH BLANK-LINE 1 "July 14, 2012" OpenBSD
+.SH NAME
+blank-line \- handling of blank lines
+.SH DESCRIPTION
+Single br:
+.br
+Single PP:
+.PP
+Single sp:
+.sp
+Single blank:
+
+Double br:
+.br
+.br
+br PP:
+.br
+.PP
+PP br:
+.PP
+.br
+Double PP:
+.PP
+.PP
+br sp:
+.br
+.sp
+sp br:
+.sp
+.br
+PP sp:
+.PP
+.sp
+PP sp 2v:
+.PP
+.sp 2v
+sp PP:
+.sp
+.PP
+Double sp:
+.sp
+.sp
+br blank:
+.br
+
+blank br:
+
+.br
+PP blank:
+.PP
+
+blank PP:
+
+.PP
+sp blank:
+.sp
+
+blank sp:
+
+.sp
+Double blank:
+
+
+RS sp 2v:
+.RS 6n
+.sp 2v
+RE sp 2v:
+.RE
+.sp 2v
+IP sp 2v:
+.IP tag 6n
+.sp 2v
+TP sp 2v:
+.TP 6n
+tag
+.sp 2v
+SH sp 2v:
+.SH CUSTOM
+.sp 2v
+End.
diff --git a/regress/usr.bin/mandoc/man/blank/line.out_ascii b/regress/usr.bin/mandoc/man/blank/line.out_ascii
new file mode 100644
index 00000000000..072dcfa7c19
--- /dev/null
+++ b/regress/usr.bin/mandoc/man/blank/line.out_ascii
@@ -0,0 +1,78 @@
+BLANK-LINE(1) OpenBSD Reference Manual BLANK-LINE(1)
+
+
+
+NNAAMMEE
+ blank-line - handling of blank lines
+
+DDEESSCCRRIIPPTTIIOONN
+ Single br:
+ Single PP:
+
+ Single sp:
+
+ Single blank:
+
+ Double br:
+ br PP:
+
+ PP br:
+
+ Double PP:
+
+ br sp:
+
+ sp br:
+
+ PP sp:
+
+ PP sp 2v:
+
+ sp PP:
+
+
+ Double sp:
+
+
+ br blank:
+
+ blank br:
+
+ PP blank:
+
+ blank PP:
+
+
+ sp blank:
+
+
+ blank sp:
+
+
+ Double blank:
+
+
+ RS sp 2v:
+
+
+ RE sp 2v:
+
+
+ IP sp 2v:
+
+ tag
+
+
+ TP sp 2v:
+
+ tag
+
+
+ SH sp 2v:
+
+CCUUSSTTOOMM
+ End.
+
+
+
+OpenBSD July 14, 2012 BLANK-LINE(1)
diff --git a/usr.bin/mandoc/man.c b/usr.bin/mandoc/man.c
index ea6d624a580..5bace1583da 100644
--- a/usr.bin/mandoc/man.c
+++ b/usr.bin/mandoc/man.c
@@ -1,4 +1,4 @@
-/* $Id: man.c,v 1.67 2012/07/07 18:27:36 schwarze Exp $ */
+/* $Id: man.c,v 1.68 2012/07/14 10:43:48 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -431,9 +431,10 @@ man_ptext(struct man *m, int line, char *buf, int offs)
if ('\0' == buf[i]) {
/* Allocate a blank entry. */
- if ( ! man_word_alloc(m, line, offs, ""))
+ if ( ! man_elem_alloc(m, line, offs, MAN_sp))
return(0);
- return(man_descope(m, line, offs));
+ m->next = MAN_NEXT_SIBLING;
+ return(1);
}
/*
diff --git a/usr.bin/mandoc/man_term.c b/usr.bin/mandoc/man_term.c
index b14ca7726d3..1be65baa9e5 100644
--- a/usr.bin/mandoc/man_term.c
+++ b/usr.bin/mandoc/man_term.c
@@ -1,4 +1,4 @@
-/* $Id: man_term.c,v 1.85 2012/07/13 14:15:50 schwarze Exp $ */
+/* $Id: man_term.c,v 1.86 2012/07/14 10:43:48 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2011, 2012 Ingo Schwarze <schwarze@openbsd.org>
@@ -441,10 +441,21 @@ pre_sp(DECL_ARGS)
int neg;
if ((NULL == n->prev && n->parent)) {
- if (MAN_SS == n->parent->tok)
- return(0);
- if (MAN_SH == n->parent->tok)
+ switch (n->parent->tok) {
+ case (MAN_SH):
+ /* FALLTHROUGH */
+ case (MAN_SS):
+ /* FALLTHROUGH */
+ case (MAN_PP):
+ /* FALLTHROUGH */
+ case (MAN_LP):
+ /* FALLTHROUGH */
+ case (MAN_P):
+ /* FALLTHROUGH */
return(0);
+ default:
+ break;
+ }
}
neg = 0;