From 9057a0a8b88a40b9e842ea583a71a49eff306f63 Mon Sep 17 00:00:00 2001 From: simon Date: Tue, 30 Mar 2004 19:40:56 +0000 Subject: [PATCH] Simplify treatment of the copyright notice, now I've also simplified the preamble: \copyright paragraphs are now treated identically to normal paragraphs (so they appear precisely where they're put instead of in a fixed location), _except_ that the Windows Help backend also copies their text into the help file's copyright slot. git-svn-id: svn://svn.tartarus.org/sgt/halibut@4001 cda61777-01e9-0310-a592-d414129be87e --- bk_man.c | 20 +------------------- bk_text.c | 17 +---------------- bk_whlp.c | 44 +++++++++++++++++--------------------------- bk_xhtml.c | 13 ++----------- doc/input.but | 10 +++++----- inputs/test.but | 4 +++- 6 files changed, 29 insertions(+), 79 deletions(-) diff --git a/bk_man.c b/bk_man.c index 1d39729..9a18d20 100644 --- a/bk_man.c +++ b/bk_man.c @@ -63,7 +63,6 @@ void man_backend(paragraph *sourceform, keywordlist *keywords, paragraph *p; FILE *fp; manconfig conf; - int done_copyright; IGNORE(keywords); /* we don't happen to need this */ IGNORE(idx); /* or this */ @@ -107,8 +106,6 @@ void man_backend(paragraph *sourceform, keywordlist *keywords, fprintf(fp, ".UC\n"); - done_copyright = FALSE; - for (p = sourceform; p; p = p->next) switch (p->type) { /* * Things we ignore because we've already processed them or @@ -118,7 +115,6 @@ void man_backend(paragraph *sourceform, keywordlist *keywords, case para_BR: case para_Biblio: /* only touch BiblioCited */ case para_VersionID: - case para_Copyright: case para_NoCite: case para_Title: break; @@ -132,21 +128,6 @@ void man_backend(paragraph *sourceform, keywordlist *keywords, 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) @@ -179,6 +160,7 @@ void man_backend(paragraph *sourceform, keywordlist *keywords, * Normal paragraphs. */ case para_Normal: + case para_Copyright: fprintf(fp, ".PP\n"); man_text(fp, p->words, TRUE, 0); break; diff --git a/bk_text.c b/bk_text.c index bde11bb..15a4fc0 100644 --- a/bk_text.c +++ b/bk_text.c @@ -184,7 +184,6 @@ void text_backend(paragraph *sourceform, keywordlist *keywords, char *prefixextra; int nesting, nestindent; int indentb, indenta; - int done_copyright; IGNORE(keywords); /* we don't happen to need this */ IGNORE(idx); /* or this */ @@ -211,7 +210,6 @@ void text_backend(paragraph *sourceform, keywordlist *keywords, nestindent = conf.listindentbefore + conf.listindentafter; nesting = (conf.indent_preambles ? 0 : -conf.indent); - done_copyright = FALSE; /* Do the main document */ for (p = sourceform; p; p = p->next) switch (p->type) { @@ -240,7 +238,6 @@ void text_backend(paragraph *sourceform, keywordlist *keywords, case para_BR: case para_Biblio: /* only touch BiblioCited */ case para_VersionID: - case para_Copyright: case para_NoCite: case para_Title: break; @@ -251,19 +248,6 @@ void text_backend(paragraph *sourceform, keywordlist *keywords, 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; @@ -281,6 +265,7 @@ void text_backend(paragraph *sourceform, keywordlist *keywords, break; case para_Normal: + case para_Copyright: case para_DescribedThing: case para_Description: case para_BiblioCited: diff --git a/bk_whlp.c b/bk_whlp.c index 1d5dbc6..690bb7c 100644 --- a/bk_whlp.c +++ b/bk_whlp.c @@ -173,6 +173,21 @@ void whlp_backend(paragraph *sourceform, keywordlist *keywords, /* FIXME: configurability in that string */ } + /* + * Put the copyright into the system section. + */ + { + rdstringc rs = {0, 0, NULL}; + for (p = sourceform; p; p = p->next) { + if (p->type == para_Copyright) + whlp_rdaddwc(&rs, p->words); + } + if (rs.text) { + whlp_copyright(h, rs.text); + sfree(rs.text); + } + } + lastsect = NULL; /* ------------------------------------------------------------------ @@ -189,7 +204,6 @@ void whlp_backend(paragraph *sourceform, keywordlist *keywords, case para_BR: case para_Biblio: /* only touch BiblioCited */ case para_VersionID: - case para_Copyright: case para_NoCite: case para_Title: break; @@ -220,32 +234,7 @@ void whlp_backend(paragraph *sourceform, keywordlist *keywords, * 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. + * writing a nav menu. */ for (p = sourceform; p; p = p->next) { if (p->type == para_Chapter || @@ -363,6 +352,7 @@ void whlp_backend(paragraph *sourceform, keywordlist *keywords, break; case para_Normal: + case para_Copyright: case para_DescribedThing: case para_Description: case para_BiblioCited: diff --git a/bk_xhtml.c b/bk_xhtml.c index 0406f45..745cce5 100644 --- a/bk_xhtml.c +++ b/bk_xhtml.c @@ -872,7 +872,7 @@ static void xhtml_do_top_file(xhtmlfile *file, paragraph *sourceform) } } - /* Do the preamble and copyright */ + /* Do the preamble */ for (p = sourceform; p; p = p->next) { if (p->type == para_Chapter || p->type == para_Heading || @@ -886,15 +886,6 @@ static void xhtml_do_top_file(xhtmlfile *file, paragraph *sourceform) break; } } - for (p = sourceform; p; p = p->next) - { - if (p->type == para_Copyright) - { - fprintf(fp, "

"); - xhtml_para(fp, p->words, FALSE); - fprintf(fp, "

\n"); - } - } xhtml_do_contents(fp, file); xhtml_do_sections(fp, file->sections); @@ -1099,7 +1090,6 @@ static void xhtml_do_paras(FILE *fp, paragraph *p, paragraph *end, case para_BR: case para_Biblio: /* only touch BiblioCited */ case para_VersionID: - case para_Copyright: case para_NoCite: case para_Title: break; @@ -1123,6 +1113,7 @@ static void xhtml_do_paras(FILE *fp, paragraph *p, paragraph *end, break; case para_Normal: + case para_Copyright: fprintf(fp, "\n

"); xhtml_para(fp, p->words, indexable); fprintf(fp, "

\n"); diff --git a/doc/input.but b/doc/input.but index ca66df5..e3849e3 100644 --- a/doc/input.but +++ b/doc/input.but @@ -911,11 +911,11 @@ special paragraph type to point it out. \dd This command indicates that the paragraph attached to it contains a \i{copyright statement} for the document. This text is -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. +displayed inline where it appears, exactly like a normal paragraph; +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 \i\cw{\\versionid} diff --git a/inputs/test.but b/inputs/test.but index 9eb469d..1fc007e 100644 --- a/inputs/test.but +++ b/inputs/test.but @@ -19,6 +19,8 @@ date \date{%Y.%m.%d} (default format is \date). \copyright Copyright 1999 Simon \#{second comment}Tatham. All rights reserved. +Here's another paragraph, which goes after the copyright. + \define{metacoopt} [this is a nested, multi-line macro, talking about \coopt a bit] @@ -27,7 +29,7 @@ a bit] \define{eur} \u20AC{EUR } -\versionid $Id: test.but,v 1.23 2004/03/25 19:27:12 simon Exp $ +\versionid $Id: test.but,v 1.24 2004/03/30 19:40:56 simon Exp $ \C{ch\\ap} First chapter title; for similar wrapping reasons this chapter title will be ludicrously long. I wonder how much more -- 2.11.0