diff options
-rw-r--r-- | usr.bin/mandoc/mandoc.1 | 8 | ||||
-rw-r--r-- | usr.bin/mandoc/mandoc.h | 3 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc.c | 20 | ||||
-rw-r--r-- | usr.bin/mandoc/read.c | 3 |
4 files changed, 28 insertions, 6 deletions
diff --git a/usr.bin/mandoc/mandoc.1 b/usr.bin/mandoc/mandoc.1 index 6d8fbd3c0fc..9f3ff74ae58 100644 --- a/usr.bin/mandoc/mandoc.1 +++ b/usr.bin/mandoc/mandoc.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: mandoc.1,v 1.95 2017/01/21 02:32:37 schwarze Exp $ +.\" $OpenBSD: mandoc.1,v 1.96 2017/01/28 23:26:55 schwarze Exp $ .\" .\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> .\" Copyright (c) 2012, 2014-2017 Ingo Schwarze <schwarze@openbsd.org> @@ -15,7 +15,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: January 21 2017 $ +.Dd $Mdocdate: January 28 2017 $ .Dt MANDOC 1 .Os .Sh NAME @@ -1357,6 +1357,10 @@ it is hard to predict which tab stop position the tab will advance to. Whitespace at the end of input lines is almost never semantically significant \(em but in the odd case where it might be, it is extremely confusing when reviewing and maintaining documents. +.It Sy "new sentence, new line" +.Pq mdoc +A new sentence starts in the middle of a text line. +Start it on a new input line to help formatters produce correct spacing. .It Sy "bad comment style" .Pq roff Comment lines start with a dot, a backslash, and a double-quote character. diff --git a/usr.bin/mandoc/mandoc.h b/usr.bin/mandoc/mandoc.h index 4c21dd1adcc..3662aa8fbd7 100644 --- a/usr.bin/mandoc/mandoc.h +++ b/usr.bin/mandoc/mandoc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mandoc.h,v 1.155 2017/01/09 01:36:22 schwarze Exp $ */ +/* $OpenBSD: mandoc.h,v 1.156 2017/01/28 23:26:56 schwarze Exp $ */ /* * Copyright (c) 2010, 2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2017 Ingo Schwarze <schwarze@openbsd.org> @@ -134,6 +134,7 @@ enum mandocerr { MANDOCERR_FI_BLANK, /* blank line in fill mode, using .sp */ MANDOCERR_FI_TAB, /* tab in filled text */ MANDOCERR_SPACE_EOL, /* whitespace at end of input line */ + MANDOCERR_EOS, /* new sentence, new line */ MANDOCERR_COMMENT_BAD, /* bad comment style */ MANDOCERR_ESC_BAD, /* invalid escape sequence: esc */ MANDOCERR_STR_UNDEF, /* undefined string, using "": name */ diff --git a/usr.bin/mandoc/mdoc.c b/usr.bin/mandoc/mdoc.c index 6c8e47e7165..eaa784e52db 100644 --- a/usr.bin/mandoc/mdoc.c +++ b/usr.bin/mandoc/mdoc.c @@ -1,7 +1,7 @@ -/* $OpenBSD: mdoc.c,v 1.147 2017/01/10 13:46:53 schwarze Exp $ */ +/* $OpenBSD: mdoc.c,v 1.148 2017/01/28 23:26:56 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> - * Copyright (c) 2010, 2012-2016 Ingo Schwarze <schwarze@openbsd.org> + * Copyright (c) 2010, 2012-2017 Ingo Schwarze <schwarze@openbsd.org> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -310,6 +310,22 @@ mdoc_ptext(struct roff_man *mdoc, int line, char *buf, int offs) if (mandoc_eos(buf+offs, (size_t)(end-buf-offs))) mdoc->last->flags |= NODE_EOS; + + for (c = buf + offs; c != NULL; c = strchr(c + 1, '.')) { + if (c - buf < offs + 2) + continue; + if (end - c < 4) + break; + if (isalpha((unsigned char)c[-2]) && + isalpha((unsigned char)c[-1]) && + c[1] == ' ' && + isupper((unsigned char)(c[2] == ' ' ? c[3] : c[2])) && + (c[-2] != 'n' || c[-1] != 'c') && + (c[-2] != 'v' || c[-1] != 's')) + mandoc_msg(MANDOCERR_EOS, mdoc->parse, + line, (int)(c - buf), NULL); + } + return 1; } diff --git a/usr.bin/mandoc/read.c b/usr.bin/mandoc/read.c index 48e13abbe11..240e76738ef 100644 --- a/usr.bin/mandoc/read.c +++ b/usr.bin/mandoc/read.c @@ -1,4 +1,4 @@ -/* $OpenBSD: read.c,v 1.130 2017/01/09 01:36:22 schwarze Exp $ */ +/* $OpenBSD: read.c,v 1.131 2017/01/28 23:26:56 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2017 Ingo Schwarze <schwarze@openbsd.org> @@ -172,6 +172,7 @@ static const char * const mandocerrs[MANDOCERR_MAX] = { "blank line in fill mode, using .sp", "tab in filled text", "whitespace at end of input line", + "new sentence, new line", "bad comment style", "invalid escape sequence", "undefined string, using \"\"", |