-/* $Id: mandoc.c,v 1.12 2010/05/12 17:08:03 kristaps Exp $ */
+/* $Id: mandoc.c,v 1.13 2010/05/14 14:09:13 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
mandoc_eos(const char *p, size_t sz)
{
- assert(sz);
+ if (0 == sz)
+ return(0);
switch (p[(int)sz - 1]) {
case ('.'):
-/* $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>
*
#include <time.h>
#include "libmdoc.h"
+#include "libmandoc.h"
enum rew {
REWIND_REWIND,
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