summaryrefslogtreecommitdiff
path: root/bk_xhtml.c
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2004-03-25 19:16:28 +0000
committerSimon Tatham <anakin@pobox.com>2004-03-25 19:16:28 +0000
commit10f4d6055c80f45b538cfc6657994b31e4abf525 (patch)
tree250c50a337c5ccd18f6bc0d516c123086d479f73 /bk_xhtml.c
parent187d4791fd0873b4058b381aa3d3a591b846463e (diff)
downloadhalibut-10f4d6055c80f45b538cfc6657994b31e4abf525.zip
halibut-10f4d6055c80f45b538cfc6657994b31e4abf525.tar.gz
halibut-10f4d6055c80f45b538cfc6657994b31e4abf525.tar.bz2
halibut-10f4d6055c80f45b538cfc6657994b31e4abf525.tar.xz
Obsoleted the `\preamble' command. Preamble text is now taken to be
any ordinary displayable paragraph(s) appearing before the first chapter heading, meaning in particular that you can put lists, code paragraphs etc in preambles. Of course, `\preamble' is still supported for backwards compatibility, but it's now a zero-effect paragraph marker. [originally from svn r3981]
Diffstat (limited to 'bk_xhtml.c')
-rw-r--r--bk_xhtml.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/bk_xhtml.c b/bk_xhtml.c
index 449eb4e..b2bed07 100644
--- a/bk_xhtml.c
+++ b/bk_xhtml.c
@@ -580,7 +580,7 @@ static void xhtml_ponder_layout(paragraph *p)
static void xhtml_do_index();
static void xhtml_do_file(xhtmlfile *file);
static void xhtml_do_top_file(xhtmlfile *file, paragraph *sourceform);
-static void xhtml_do_paras(FILE *fp, paragraph *p);
+static void xhtml_do_paras(FILE *fp, paragraph *p, paragraph *end);
static int xhtml_do_contents_limit(FILE *fp, xhtmlfile *file, int limit);
static int xhtml_do_contents_section_limit(FILE *fp, xhtmlsection *section, int limit);
static int xhtml_add_contents_entry(FILE *fp, xhtmlsection *section, int limit);
@@ -875,11 +875,15 @@ static void xhtml_do_top_file(xhtmlfile *file, paragraph *sourceform)
/* Do the preamble and copyright */
for (p = sourceform; p; p = p->next)
{
- if (p->type == para_Preamble)
- {
- fprintf(fp, "<p>");
- xhtml_para(fp, p->words);
- fprintf(fp, "</p>\n");
+ if (p->type == para_Chapter || p->type == para_Heading ||
+ p->type == para_Subsect || p->type == para_Appendix ||
+ p->type == para_UnnumberedChapter) {
+ /*
+ * We've found the end of the preamble. Do every normal
+ * paragraph up to there.
+ */
+ xhtml_do_paras(fp, sourceform, p);
+ break;
}
}
for (p = sourceform; p; p = p->next)
@@ -1067,14 +1071,14 @@ static void xhtml_do_sections(FILE *fp, xhtmlsection *sections)
{
while (sections) {
currentsection = sections;
- xhtml_do_paras(fp, sections->para);
+ xhtml_do_paras(fp, sections->para, NULL);
xhtml_do_sections(fp, sections->child);
sections = sections->next;
}
}
/* Write this list of paragraphs. Close off all lists at the end. */
-static void xhtml_do_paras(FILE *fp, paragraph *p)
+static void xhtml_do_paras(FILE *fp, paragraph *p, paragraph *end)
{
int last_type = -1, ptype, first=TRUE;
stack lcont_stack = stk_new();
@@ -1082,7 +1086,7 @@ static void xhtml_do_paras(FILE *fp, paragraph *p)
return;
/* for (; p && (xhtml_para_level(p)>limit || xhtml_para_level(p)==-1 || first); p=p->next) {*/
- for (; p && (xhtml_para_level(p)==-1 || first); p=p->next) {
+ for (; p && p != end && (xhtml_para_level(p)==-1 || first); p=p->next) {
first=FALSE;
switch (ptype = p->type)
{
@@ -1095,7 +1099,6 @@ static void xhtml_do_paras(FILE *fp, paragraph *p)
case para_Biblio: /* only touch BiblioCited */
case para_VersionID:
case para_Copyright:
- case para_Preamble:
case para_NoCite:
case para_Title:
break;