From 056ab80ee9dfc9970457a2436d0cc29eb5caa7c2 Mon Sep 17 00:00:00 2001 From: simon Date: Thu, 7 Dec 2006 18:09:37 +0000 Subject: [PATCH] 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. git-svn-id: svn://svn.tartarus.org/sgt/halibut@6970 cda61777-01e9-0310-a592-d414129be87e --- doc/output.but | 15 ++++++++++----- input.c | 16 +++++++++++++++- inputs/test.but | 3 ++- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/doc/output.but b/doc/output.but index 0575631..0bd6393 100644 --- a/doc/output.but +++ b/doc/output.but @@ -1662,15 +1662,20 @@ The default page size corresponds to 210\_\u00D7{x}\_297\_mm, i.e., \c \cfg{paper-base-font-size}{12} \c \cfg{paper-code-fonts}{Courier-Bold}{Courier-Oblique}{Courier} \c \cfg{paper-code-font-size}{12} -\c \cfg{paper-title-fonts}{Helvetica-Bold}{Helvetica-BoldOblique}{Courier-Bold} +\c \cfg{paper-title-fonts}{Helvetica-Bold} +\c {Helvetica-BoldOblique}{Courier-Bold} \c \cfg{paper-title-font-size}{24} -\c \cfg{paper-chapter-fonts}{Helvetica-Bold}{Helvetica-BoldOblique}{Courier-Bold} +\c \cfg{paper-chapter-fonts}{Helvetica-Bold} +\c {Helvetica-BoldOblique}{Courier-Bold} \c \cfg{paper-chapter-font-size}{20} -\c \cfg{paper-section-fonts}{0}{Helvetica-Bold}{Helvetica-BoldOblique}{Courier-Bold} +\c \cfg{paper-section-fonts}{0}{Helvetica-Bold} +\c {Helvetica-BoldOblique}{Courier-Bold} \c \cfg{paper-section-font-size}{0}{16} -\c \cfg{paper-section-fonts}{1}{Helvetica-Bold}{Helvetica-BoldOblique}{Courier-Bold} +\c \cfg{paper-section-fonts}{1}{Helvetica-Bold} +\c {Helvetica-BoldOblique}{Courier-Bold} \c \cfg{paper-section-font-size}{1}{14} -\c \cfg{paper-section-fonts}{2}{Helvetica-Bold}{Helvetica-BoldOblique}{Courier-Bold} +\c \cfg{paper-section-fonts}{2}{Helvetica-Bold} +\c {Helvetica-BoldOblique}{Courier-Bold} \c \cfg{paper-section-font-size}{2}{13} \c ... and so on for all section levels below this ... \e iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii 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 diff --git a/inputs/test.but b/inputs/test.but index af1f2fc..dc07916 100644 --- a/inputs/test.but +++ b/inputs/test.but @@ -3,7 +3,8 @@ See If Wrapping Titles Works OK. In Fact This Title Will Span Three Lines, Not Just Two. How's That For Ludicrous? \cfg{xhtml-leaf-smallest-contents}{2} -\cfg{xhtml-leaf-contains-contents}{true} +\cfg{xhtml-leaf-contains-contents} +{true} \cfg{info-dir-entry}{Sillinesses}{test.but}{Halibut test document} \cfg{info-dir-entry}{Florbles}{test.but}{Subsection of Halibut test document}{sub-sub} -- 2.11.0