aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_macro.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-05-14 14:09:13 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-05-14 14:09:13 +0000
commit31fa98f26903a8f1fcb3f43804b00c176eaabf78 (patch)
tree064089bb188204fdee05927425a185e31b856931 /mdoc_macro.c
parentd9778532d7fc46ee0ace241131012276d6e28cf2 (diff)
downloadmandoc-31fa98f26903a8f1fcb3f43804b00c176eaabf78.tar.gz
mandoc-31fa98f26903a8f1fcb3f43804b00c176eaabf78.tar.zst
mandoc-31fa98f26903a8f1fcb3f43804b00c176eaabf78.zip
Block-implicit macros now up-propogate end-of-sentence spacing. NOTE: GROFF IS NOT SMART ENOUGH TO DO THIS.
Diffstat (limited to 'mdoc_macro.c')
-rw-r--r--mdoc_macro.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/mdoc_macro.c b/mdoc_macro.c
index bb5afede..0a89e563 100644
--- a/mdoc_macro.c
+++ b/mdoc_macro.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_macro.c,v 1.63 2010/05/14 13:31:20 kristaps Exp $ */
+/* $Id: mdoc_macro.c,v 1.64 2010/05/14 14:09:13 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -26,6 +26,7 @@
#include <time.h>
#include "libmdoc.h"
+#include "libmandoc.h"
enum rew {
REWIND_REWIND,
@@ -1155,6 +1156,25 @@ blk_part_imp(MACRO_PROT_ARGS)
body = m->last;
}
+ for (n = body->child; n && n->next; n = n->next)
+ /* Do nothing. */ ;
+
+ /*
+ * End of sentence spacing: if the last node is a text node and
+ * has a trailing period, then mark it as being end-of-sentence.
+ */
+
+ if (n && MDOC_TEXT == n->type && n->string)
+ if (mandoc_eos(n->string, strlen(n->string)))
+ n->flags |= MDOC_EOS;
+
+ /* Up-propogate the end-of-space flag. */
+
+ if (n && (MDOC_EOS & n->flags)) {
+ body->flags |= MDOC_EOS;
+ body->parent->flags |= MDOC_EOS;
+ }
+
/*
* If we can't rewind to our body, then our scope has already
* been closed by another macro (like `Oc' closing `Op'). This