diff options
-rw-r--r-- | regress/usr.bin/mandoc/char/space/Makefile | 4 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/char/space/eos-man.in | 22 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/char/space/eos-man.out_ascii | 26 | ||||
-rw-r--r-- | usr.bin/mandoc/man_macro.c | 11 |
4 files changed, 60 insertions, 3 deletions
diff --git a/regress/usr.bin/mandoc/char/space/Makefile b/regress/usr.bin/mandoc/char/space/Makefile index 578488d78ac..97dfcc07cd9 100644 --- a/regress/usr.bin/mandoc/char/space/Makefile +++ b/regress/usr.bin/mandoc/char/space/Makefile @@ -1,6 +1,6 @@ -# $OpenBSD: Makefile,v 1.7 2013/06/20 22:29:38 schwarze Exp $ +# $OpenBSD: Makefile,v 1.8 2013/12/22 13:24:00 schwarze Exp $ REGRESS_TARGETS = leading-mdoc leading-man multiple zerowidth -REGRESS_TARGETS += eos nobreak tab tab-man esct-mdoc esct-man +REGRESS_TARGETS += eos eos-man nobreak tab tab-man esct-mdoc esct-man .include <bsd.regress.mk> diff --git a/regress/usr.bin/mandoc/char/space/eos-man.in b/regress/usr.bin/mandoc/char/space/eos-man.in new file mode 100644 index 00000000000..48f8a9841d6 --- /dev/null +++ b/regress/usr.bin/mandoc/char/space/eos-man.in @@ -0,0 +1,22 @@ +.TH SPACE-EOS-MAN 1 "December 22, 2013" OpenBSD +.SH NAME +SPACE-EOS-MAN \- end-of-sentence spacing in man(7) documents +.SH DESCRIPTION +This is a sentence. +There is a double space before the next one. +.PP +Here is a full stop +.B at the end of a macro. +It causes a double space, too. +.PP +She said: "Here is another sentence." +And it was detected even with quotation marks. +(Really.) +And within parantheses. +.PP +A dot in parantheses (.) is not a full stop. +.PP +A dot in the middle of an input line . is not a full stop. +.PP +At the end of an input line, even an escaped dot \&. +is regarded as a full stop. diff --git a/regress/usr.bin/mandoc/char/space/eos-man.out_ascii b/regress/usr.bin/mandoc/char/space/eos-man.out_ascii new file mode 100644 index 00000000000..95d394a8227 --- /dev/null +++ b/regress/usr.bin/mandoc/char/space/eos-man.out_ascii @@ -0,0 +1,26 @@ +SPACE-EOS-MAN(1) OpenBSD Reference Manual SPACE-EOS-MAN(1) + + + +NNAAMMEE + SPACE-EOS-MAN - end-of-sentence spacing in man(7) documents + +DDEESSCCRRIIPPTTIIOONN + This is a sentence. There is a double space before the next one. + + Here is a full stop aatt tthhee eenndd ooff aa mmaaccrroo.. It causes a double space, + too. + + She said: "Here is another sentence." And it was detected even with + quotation marks. (Really.) And within parantheses. + + A dot in parantheses (.) is not a full stop. + + A dot in the middle of an input line . is not a full stop. + + At the end of an input line, even an escaped dot . is regarded as a + full stop. + + + +OpenBSD December 22, 2013 SPACE-EOS-MAN(1) diff --git a/usr.bin/mandoc/man_macro.c b/usr.bin/mandoc/man_macro.c index b810a6816a9..e1f5be37cef 100644 --- a/usr.bin/mandoc/man_macro.c +++ b/usr.bin/mandoc/man_macro.c @@ -1,4 +1,4 @@ -/* $Id: man_macro.c,v 1.40 2013/11/11 00:35:51 schwarze Exp $ */ +/* $Id: man_macro.c,v 1.41 2013/12/22 13:24:00 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2012, 2013 Ingo Schwarze <schwarze@openbsd.org> @@ -428,6 +428,15 @@ in_line_eoln(MACRO_PROT_ARGS) } /* + * Append MAN_EOS in case the last snipped argument + * ends with a dot, e.g. `.IR syslog (3).' + */ + + if (n != man->last && + mandoc_eos(man->last->string, strlen(man->last->string), 0)) + man->last->flags |= MAN_EOS; + + /* * If no arguments are specified and this is MAN_SCOPED (i.e., * next-line scoped), then set our mode to indicate that we're * waiting for terms to load into our context. |