diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2013-12-22 13:24:01 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2013-12-22 13:24:01 +0000 |
commit | 2ca2e7ce5c5cbc1b81eee453e3fa63794554da55 (patch) | |
tree | d6f218e9335a8bc4d098a6763a12dcba280374fb | |
parent | d35bebe609ed5a8a99039e2189040324a4d1ddff (diff) |
Implement end-of-sentence spacing at the end of man(7) macro lines.
Improves cvs(1) pcap-filter(3) readline(3) termcap(5) cvsbug(8)
mkhybrid(8) nsd-zonec(8) in multiple places and c++filt(1) com_err(3)
nsd_conf(5) term(5) nsdc(8) in one place each.
Reduces overall groff-mandoc-differences in base by about 1.5%.
Patch from Franco Fichtner <franco at lastsummer dot de> (DragonFly).
-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. |