indexdata *idx) {
paragraph *p;
FILE *fp;
- char const *sep;
manconfig conf;
+ int done_copyright;
IGNORE(keywords); /* we don't happen to need this */
IGNORE(idx); /* or this */
fprintf(fp, ".UC\n");
- /* Do the preamble and copyright */
- sep = "";
- for (p = sourceform; p; p = p->next)
- if (p->type == para_Preamble) {
- fprintf(fp, "%s", sep);
- man_text(fp, p->words, TRUE, 0);
- sep = "\n";
- }
- for (p = sourceform; p; p = p->next)
- if (p->type == para_Copyright) {
- fprintf(fp, "%s", sep);
- man_text(fp, p->words, TRUE, 0);
- sep = "\n";
- }
+ done_copyright = FALSE;
for (p = sourceform; p; p = p->next) switch (p->type) {
/*
case para_Biblio: /* only touch BiblioCited */
case para_VersionID:
case para_Copyright:
- case para_Preamble:
case para_NoCite:
case para_Title:
break;
case para_UnnumberedChapter:
case para_Heading:
case para_Subsect:
+
+ if (!done_copyright) {
+ paragraph *p;
+
+ /*
+ * The copyright comes just before the first chapter
+ * title.
+ */
+ for (p = sourceform; p; p = p->next)
+ if (p->type == para_Copyright) {
+ fprintf(fp, ".PP\n");
+ man_text(fp, p->words, TRUE, 0);
+ }
+ done_copyright = TRUE;
+ }
+
{
int depth;
if (p->type == para_Subsect)
char *prefixextra;
int nesting, nestindent;
int indentb, indenta;
+ int done_copyright;
IGNORE(keywords); /* we don't happen to need this */
IGNORE(idx); /* or this */
text_heading(fp, NULL, NULL, p->words,
conf.atitle, conf.indent, conf.width);
- /* Do the preamble and copyright */
- for (p = sourceform; p; p = p->next)
- if (p->type == para_Preamble)
- text_para(fp, NULL, NULL, p->words,
- conf.indent_preambles ? conf.indent : 0, 0,
- conf.width + (conf.indent_preambles ? 0 : conf.indent));
- for (p = sourceform; p; p = p->next)
- if (p->type == para_Copyright)
- text_para(fp, NULL, NULL, p->words,
- conf.indent_preambles ? conf.indent : 0, 0,
- conf.width + (conf.indent_preambles ? 0 : conf.indent));
-
nestindent = conf.listindentbefore + conf.listindentafter;
- nesting = 0;
+ nesting = (conf.indent_preambles ? 0 : -conf.indent);
+ done_copyright = FALSE;
/* Do the main document */
for (p = sourceform; p; p = p->next) switch (p->type) {
case para_Biblio: /* only touch BiblioCited */
case para_VersionID:
case para_Copyright:
- case para_Preamble:
case para_NoCite:
case para_Title:
break;
case para_Chapter:
case para_Appendix:
case para_UnnumberedChapter:
+ /*
+ * The copyright should come after the preamble but before
+ * the first chapter title.
+ */
+ if (!done_copyright) {
+ paragraph *p;
+
+ for (p = sourceform; p; p = p->next)
+ if (p->type == para_Copyright)
+ text_para(fp, NULL, NULL, p->words,
+ conf.indent + nesting, 0, conf.width - nesting);
+ done_copyright = TRUE;
+ }
text_heading(fp, p->kwtext, p->kwtext2, p->words,
conf.achapter, conf.indent, conf.width);
+ nesting = 0;
break;
case para_Heading:
int i;
int nesting;
indexentry *ie;
+ int done_contents_topic;
filename = "output.hlp"; /* FIXME: configurability */
cntname = "output.cnt"; /* corresponding contents file */
whlp_prepare(h);
/* ------------------------------------------------------------------
- * Do the contents page, containing title, preamble and
- * copyright.
+ * Begin the contents page.
*/
whlp_begin_topic(h, contents_topic, "Contents", "DB(\"btn_up\")", NULL);
/* FIXME: configurability in that string */
}
- /*
- * Next comes the preamble, which just goes into the ordinary
- * scrolling region.
- */
- for (p = sourceform; p; p = p->next) {
- if (p->type == para_Preamble) {
- whlp_para_attr(h, WHLP_PARA_SPACEBELOW, 12);
- whlp_begin_para(h, WHLP_PARA_SCROLL);
- whlp_mkparagraph(&state, FONT_NORMAL, p->words, FALSE);
- whlp_end_para(h);
- }
- }
-
- /*
- * The copyright goes to two places, again: into the contents
- * page and also into the system section.
- */
- {
- rdstringc rs = {0, 0, NULL};
- for (p = sourceform; p; p = p->next) {
- if (p->type == para_Copyright) {
- whlp_para_attr(h, WHLP_PARA_SPACEBELOW, 12);
- whlp_begin_para(h, WHLP_PARA_SCROLL);
- whlp_mkparagraph(&state, FONT_NORMAL, p->words, FALSE);
- whlp_end_para(h);
- whlp_rdaddwc(&rs, p->words);
- }
- }
- if (rs.text) {
- whlp_copyright(h, rs.text);
- sfree(rs.text);
- }
- }
-
- /*
- * Now do the primary navigation menu.
- */
- for (p = sourceform; p; p = p->next) {
- if (p->type == para_Chapter ||
- p->type == para_Appendix ||
- p->type == para_UnnumberedChapter)
- whlp_navmenu(&state, p);
- }
-
- state.curr_topic = contents_topic;
lastsect = NULL;
/* ------------------------------------------------------------------
case para_Biblio: /* only touch BiblioCited */
case para_VersionID:
case para_Copyright:
- case para_Preamble:
case para_NoCite:
case para_Title:
break;
case para_UnnumberedChapter:
case para_Heading:
case para_Subsect:
+
+ if (!done_contents_topic) {
+ paragraph *p;
+
+ /*
+ * If this is the first section title we've seen, then
+ * we're currently still in the contents topic. We
+ * should therefore finish up the contents page by
+ * writing the copyright notice and a nav menu.
+ */
+
+ /*
+ * The copyright goes to two places, again: into the
+ * contents page and also into the system section.
+ */
+ {
+ rdstringc rs = {0, 0, NULL};
+ for (p = sourceform; p; p = p->next) {
+ if (p->type == para_Copyright) {
+ whlp_para_attr(h, WHLP_PARA_SPACEBELOW, 12);
+ whlp_begin_para(h, WHLP_PARA_SCROLL);
+ whlp_mkparagraph(&state, FONT_NORMAL, p->words, FALSE);
+ whlp_end_para(h);
+ whlp_rdaddwc(&rs, p->words);
+ }
+ }
+ if (rs.text) {
+ whlp_copyright(h, rs.text);
+ sfree(rs.text);
+ }
+ }
+
+ /*
+ * Now do the primary navigation menu.
+ */
+ for (p = sourceform; p; p = p->next) {
+ if (p->type == para_Chapter ||
+ p->type == para_Appendix ||
+ p->type == para_UnnumberedChapter)
+ whlp_navmenu(&state, p);
+ }
+
+ state.curr_topic = contents_topic;
+
+ done_contents_topic = TRUE;
+ }
+
if (lastsect && lastsect->child) {
paragraph *q;
/*
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);
/* 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)
{
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();
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)
{
case para_Biblio: /* only touch BiblioCited */
case para_VersionID:
case para_Copyright:
- case para_Preamble:
case para_NoCite:
case para_Title:
break;
\cfg{xhtml-body-end}{Comments to <a href='mailto:anakin@pobox.com'>anakin@pobox.com</a>}
-\preamble Halibut is a free (MIT-licensed) documentation production
-system, able to generate multiple output formats from the same input
-data.
+Halibut is a free (MIT-licensed) documentation production system,
+able to generate multiple output formats from the same input data.
+This document is its user manual.
\copyright This manual is copyright 2004 Simon Tatham. All
rights reserved. You may distribute this documentation under the MIT
licence. See \k{licence} for the licence text in full.
-\versionid $Id: blurb.but,v 1.1 2004/03/25 18:33:02 simon Exp $
+\versionid $Id: blurb.but,v 1.2 2004/03/25 19:16:28 simon Exp $
keyword argument, because there is no sensible way to generate an
automatic cross-reference to such a chapter anyway.
-\S{input-blurb} \c{\\preamble}, \c{\\copyright}, \c{\\title},
-\c{\\versionid}: Miscellaneous blurb commands
+\S{input-blurb} \c{\\copyright}, \c{\\title}, \c{\\versionid}:
+Miscellaneous blurb commands
-These four commands define a variety of special paragraph types.
+These three commands define a variety of special paragraph types.
They are all used in the same way: you put the command at the start
of a paragraph, and then just follow it with normal text, like this:
\c \title My First Manual
-The four special paragraph types are:
+The three special paragraph types are:
\dt \c{\\title}
used in a \cw{<title>} tag in the HTML output), so it needs a
special paragraph type to point it out.
-\dt \c{\\preamble}
-
-\dd This command indicates ordinary text that appears \e{before} the
-first chapter heading. \#{FIXME: figure out what Halibut actually
-does do with ordinary text before a chapter heading. Then figure out
-whether that's sensible. Then figure out what \preamble has to offer
-that's perceptibly different. Fix if necessary.}
-
\dt \c{\\copyright}
\dd This command indicates that the paragraph attached to it
contains a copyright statement for the document. This text is
-usually displayed inline, in the same way as \c{\\preamble} text,
-but in some output formats it is given additional special treatment.
-For example, Windows Help files have a standard slot in which to
-store a copyright notice, so that other software can display it
-prominently.
+usually displayed inline, just before the first chapter title but
+after any preamble text before that; but in some output formats it
+is given additional special treatment. For example, Windows Help
+files have a standard slot in which to store a copyright notice, so
+that other software can display it prominently.
\dt \c{\\versionid}
para_Description,
para_Code,
para_Copyright,
- para_Preamble,
para_NoCite,
para_Title,
para_VersionID,
c_lcont, /* continuation para(s) for list item */
c_n, /* numbered list */
c_nocite, /* bibliography trickery */
- c_preamble, /* document preamble text */
+ c_preamble, /* (obsolete) preamble text */
c_q, /* quote marks */
c_quote, /* block-quoted paragraphs */
c_rule, /* horizontal rule */
{"lcont", c_lcont}, /* continuation para(s) for list item */
{"n", c_n}, /* numbered list */
{"nocite", c_nocite}, /* bibliography trickery */
- {"preamble", c_preamble}, /* document preamble text */
+ {"preamble", c_preamble}, /* (obsolete) preamble text */
{"q", c_q}, /* quote marks */
{"quote", c_quote}, /* block-quoted paragraphs */
{"rule", c_rule}, /* horizontal rule */
case c_define: is_macro = TRUE; needkw = 1; break;
/* For \nocite the keyword is _everything_ */
case c_nocite: needkw = 8; par.type = para_NoCite; break;
- case c_preamble: needkw = 32; par.type = para_Preamble; break;
+ case c_preamble: needkw = 32; par.type = para_Normal; break;
case c_rule: needkw = 16; par.type = para_Rule; break;
case c_title: needkw = 32; par.type = para_Title; break;
case c_versionid: needkw = 32; par.type = para_VersionID; break;
\cfg{xhtml-leaf-contains-contents}{true}
\cfg{man-headnumbers}{true}
+This paragraph is not labelled \q{preamble}, but should still appear
+as it.
+
\preamble This manual is a small joke effort, designed to use every
feature \#{ comment } that Halibut's input format supports. Creation
date \date{%Y.%m.%d} (default format is \date).
+\c Here is a code paragraph in the preamble, just to stress that all
+\c things are possible. Ooh!
+
\copyright Copyright 1999 Simon \#{second comment}Tatham. All rights
reserved.
\define{coopt} co\u00F6{-o}pt
-\versionid $Id: test.but,v 1.21 2004/03/24 19:23:21 simon Exp $
+\versionid $Id: test.but,v 1.22 2004/03/25 19:16:28 simon Exp $
\C{ch\\ap} First chapter title; for similar wrapping reasons this
chapter title will be ludicrously long. I wonder how much more