summaryrefslogtreecommitdiffstatshomepage
path: root/mdoc.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-05-31 15:42:09 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-05-31 15:42:09 +0000
commit21bb451eea95935f615ded5d57dc8c6c9d2224f8 (patch)
treec5d5dd4919b2c176c72b1c15cec53c5535dda349 /mdoc.c
parent021bc3db05c09297aa2ca95496a414c675652db4 (diff)
downloadmandoc-21bb451eea95935f615ded5d57dc8c6c9d2224f8.tar.gz
mandoc-21bb451eea95935f615ded5d57dc8c6c9d2224f8.tar.zst
mandoc-21bb451eea95935f615ded5d57dc8c6c9d2224f8.zip
Add ability to interpret initial free-form lines as part of a `Bl
-column' up until the first `It'. This is UGLY and should have all sorts of warnings, and will. On the one hand, it fits with groff's notion of tabs and tab-spaces. On the other hand, it's not really "free-form" text any more. Note that this does not yet accomodate for macros coming on these lines.
Diffstat (limited to 'mdoc.c')
-rw-r--r--mdoc.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/mdoc.c b/mdoc.c
index ba67df40..2f0cc8b8 100644
--- a/mdoc.c
+++ b/mdoc.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc.c,v 1.141 2010/05/31 10:28:04 kristaps Exp $ */
+/* $Id: mdoc.c,v 1.142 2010/05/31 15:42:09 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -542,7 +542,8 @@ mdoc_node_delete(struct mdoc *m, struct mdoc_node *p)
static int
mdoc_ptext(struct mdoc *m, int line, char *buf, int offs)
{
- char *c, *ws, *end;
+ char *c, *ws, *end;
+ struct mdoc_node *n;
/* Ignore bogus comments. */
@@ -556,6 +557,29 @@ mdoc_ptext(struct mdoc *m, int line, char *buf, int offs)
if (SEC_NONE == m->lastnamed)
return(mdoc_pmsg(m, line, offs, MANDOCERR_NOTEXT));
+ assert(m->last);
+ n = m->last;
+
+ /*
+ * Diver directly into list processing if we're encountering a
+ * columnar MDOC_BLOCK with or without a prior MDOC_BLOCK entry
+ * (if it's a MDOC_BODY that means it's open, in which case we
+ * should process within its context).
+ */
+
+ if (MDOC_Bl == n->tok && LIST_column == n->data.list) {
+ m->flags |= MDOC_FREECOL;
+ return(mdoc_macro(m, MDOC_It, line, offs, &offs, buf));
+ }
+
+ if (MDOC_It == n->tok && MDOC_BLOCK == n->type &&
+ NULL != n->parent &&
+ MDOC_Bl == n->parent->tok &&
+ LIST_column == n->parent->data.list) {
+ m->flags |= MDOC_FREECOL;
+ return(mdoc_macro(m, MDOC_It, line, offs, &offs, buf));
+ }
+
/*
* Search for the beginning of unescaped trailing whitespace (ws)
* and for the first character not to be output (end).