summaryrefslogtreecommitdiffstatshomepage
path: root/mdoc.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-03-02 17:14:46 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-03-02 17:14:46 +0000
commit162ce81d3a61862bea3503763f631cf91bd28023 (patch)
treec48fa77b4506ea1d073a0f402c7d2c5b0f0754f4 /mdoc.c
parentc6e959568733601f6b74e21b18a4243e63f53f3b (diff)
downloadmandoc-162ce81d3a61862bea3503763f631cf91bd28023.tar.gz
mandoc-162ce81d3a61862bea3503763f631cf91bd28023.tar.zst
mandoc-162ce81d3a61862bea3503763f631cf91bd28023.zip
Added new old escape sequence \*[nn].
Initial correct .Bd support (still only text in literal displays). Symbols put into tables (character-encoding).
Diffstat (limited to 'mdoc.c')
-rw-r--r--mdoc.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/mdoc.c b/mdoc.c
index af8a7fcc..ca3f5752 100644
--- a/mdoc.c
+++ b/mdoc.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc.c,v 1.49 2009/03/01 23:14:15 kristaps Exp $ */
+/* $Id: mdoc.c,v 1.50 2009/03/02 17:14:46 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -180,6 +180,12 @@ mdoc_endparse(struct mdoc *mdoc)
}
+/*
+ * Main line-parsing routine. If the line is a macro-line (started with
+ * a '.' control character), then pass along to the parser, which parses
+ * subsequent macros until the end of line. If normal text, simply
+ * append the entire line to the chain.
+ */
int
mdoc_parseln(struct mdoc *mdoc, int line, char *buf)
{
@@ -191,20 +197,24 @@ mdoc_parseln(struct mdoc *mdoc, int line, char *buf)
mdoc->linetok = 0;
- /*
- * FIXME: should puke on whitespace in non-literal displays.
- */
-
if ('.' != *buf) {
+ /*
+ * Free-form text. Not allowed in the prologue.
+ */
if (SEC_PROLOGUE == mdoc->lastnamed)
return(mdoc_perr(mdoc, line, 0,
- "no text in document prologue"));
+ "no text in prologue"));
+
if ( ! mdoc_word_alloc(mdoc, line, 0, buf))
return(0);
mdoc->next = MDOC_NEXT_SIBLING;
return(1);
}
+ /*
+ * Control-character detected. Begin the parsing sequence.
+ */
+
if (buf[1] && '\\' == buf[1])
if (buf[2] && '\"' == buf[2])
return(1);
@@ -238,6 +248,7 @@ mdoc_parseln(struct mdoc *mdoc, int line, char *buf)
mdoc->flags |= MDOC_HALT;
return(0);
}
+
return(1);
}