summaryrefslogtreecommitdiffstatshomepage
path: root/mdoc.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-05-12 16:01:01 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-05-12 16:01:01 +0000
commited1a9f25e07b6ba9355192a1ca8ebedd5495e953 (patch)
treef76105ec4fa9d034fefaaef81d969d0549ecd196 /mdoc.c
parent9f11efb0307eb4c4dbb4a8fff243321100e27573 (diff)
downloadmandoc-ed1a9f25e07b6ba9355192a1ca8ebedd5495e953.tar.gz
mandoc-ed1a9f25e07b6ba9355192a1ca8ebedd5495e953.tar.zst
mandoc-ed1a9f25e07b6ba9355192a1ca8ebedd5495e953.zip
Tiny EOS patch. Back-end cues front-end through flag. Front-end cues output engine with flag.
Diffstat (limited to 'mdoc.c')
-rw-r--r--mdoc.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/mdoc.c b/mdoc.c
index aa6891fd..a00feaaf 100644
--- a/mdoc.c
+++ b/mdoc.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc.c,v 1.127 2010/05/08 10:25:27 kristaps Exp $ */
+/* $Id: mdoc.c,v 1.128 2010/05/12 16:01:01 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -689,7 +689,33 @@ mdoc_ptext(struct mdoc *m, int line, char *buf)
/* Allocate the whole word. */
- return(mdoc_word_alloc(m, line, 0, buf));
+ if ( ! mdoc_word_alloc(m, line, 0, buf))
+ return(0);
+
+ /*
+ * End-of-sentence check. If the last character is an unescaped
+ * EOS character, then flag the node as being the end of a
+ * sentence. The front-end will know how to interpret this.
+ */
+
+ assert(i);
+
+ switch (buf[i - 1]) {
+ case ('.'):
+ if (i > 1 && '\\' == buf[i - 2])
+ break;
+ /* FALLTHROUGH */
+ case ('!'):
+ /* FALLTHROUGH */
+ case ('?'):
+ m->last->flags |= MDOC_EOS;
+ break;
+ default:
+ break;
+
+ }
+
+ return(1);
}