summaryrefslogtreecommitdiff
path: root/input.c
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2006-12-07 18:09:37 +0000
committerSimon Tatham <anakin@pobox.com>2006-12-07 18:09:37 +0000
commit92242aeaf21903a4c5a12a7c74eb77fcd7158a52 (patch)
tree4882b2abe106923ca2842300bf2d90c20922fa5a /input.c
parent10e38f34f5fc9710cca402b23cbf39d0fb79739a (diff)
downloadhalibut-92242aeaf21903a4c5a12a7c74eb77fcd7158a52.zip
halibut-92242aeaf21903a4c5a12a7c74eb77fcd7158a52.tar.gz
halibut-92242aeaf21903a4c5a12a7c74eb77fcd7158a52.tar.bz2
halibut-92242aeaf21903a4c5a12a7c74eb77fcd7158a52.tar.xz
I've just noticed some unacceptably long lines in code paragraphs in
the Halibut manual. They turn out to be \cfg directives with multiple braced sections after them. The obvious thing to do for legibility would be to wrap those sections by putting newlines between } and {, but that isn't legal in the Halibut syntax. Therefore, it is now :-) For paragraph types which don't have any body text (such as \cfg), we are now lenient about whitespace between multiple keywords. So I can fix the docs so they don't go over the limit, and be confident that the fixed version is still technically accurate. [originally from svn r6970]
Diffstat (limited to 'input.c')
-rw-r--r--input.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/input.c b/input.c
index 47d475a..a677129 100644
--- a/input.c
+++ b/input.c
@@ -903,7 +903,21 @@ static void read_file(paragraph ***ret, input *in, indexdata *idx,
/* Get keywords. */
dtor(t), t = get_token(in);
fp = t.pos;
- while (t.type == tok_lbrace) {
+ while (t.type == tok_lbrace ||
+ (t.type == tok_white && (needkw & 24))) {
+ /*
+ * In paragraph types which can't accept any
+ * body text (such as \cfg), we are lenient
+ * about whitespace between keywords. This is
+ * important for \cfg in particular since it
+ * can often have many keywords which are long
+ * pieces of text, so it's useful to permit the
+ * user to wrap the line between them.
+ */
+ if (t.type == tok_white) {
+ dtor(t), t = get_token(in); /* eat the space */
+ continue;
+ }
/* This is a keyword. */
nkeys++;
/* FIXME: there will be bugs if anyone specifies an