Add a script to produce the manual with an xml toolchain

This commit is contained in:
Jean-Francois Dockes 2012-04-07 11:33:01 +02:00
parent 0880f4f7fb
commit a200d22b34
2 changed files with 258 additions and 0 deletions

View File

@ -0,0 +1,212 @@
/*
* Copyright (c) 2001, 2003, 2010 The FreeBSD Documentation Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD: doc/share/misc/docbook.css,v 1.15 2010/03/20 04:15:01 hrs Exp $
*/
body address {
line-height: 1.3;
margin: .6em 0;
}
body blockquote {
margin-top: .75em;
line-height: 1.5;
margin-bottom: .75em;
}
html body {
margin: 1em 8% 1em 10%;
line-height: 1.2;
}
.legalnotice {
font-size: small;
font-variant: small-caps;
}
body div {
margin: 0;
}
dl {
margin: .8em 0;
line-height: 1.2;
}
body form {
margin: .6em 0;
}
h1, h2, h3, h4, h5, h6,
div.example p b,
.question,
div.table p b,
div.procedure p b {
color: #990000;
}
body h1, body h2, body h3, body h4, body h5, body h6 {
line-height: 1.3;
margin-left: 0;
}
body h1, body h2 {
margin: .8em 0 0 -4%;
}
body h3, body h4 {
margin: .8em 0 0 -3%;
}
body h5 {
margin: .8em 0 0 -2%;
}
body h6 {
margin: .8em 0 0 -1%;
}
body hr {
margin: .6em;
border-width: 0 0 1px 0;
border-style: solid;
border-color: #cecece;
}
body img.navheader {
margin: 0 0 0 -4%;
}
ol {
margin: 0 0 0 5%;
line-height: 1.2;
}
body pre {
margin: .75em 0;
line-height: 1.0;
font-family: monospace;
}
body td, body th {
line-height: 1.2;
}
ul, body dir, body menu {
margin: 0 0 0 5%;
line-height: 1.2;
}
html {
margin: 0;
padding: 0;
}
body p b.application {
color: #000000;
}
body p span.application {
font-weight: bold;
color: #000000;
}
.filename {
color: #007a00;
}
.guimenu, .guimenuitem, .guisubmenu,
.guilabel, .interface,
.shortcut, .shortcut .keycap {
font-weight: bold;
}
.guibutton {
background-color: #cfcfcf;
padding: 2px;
}
.accel {
background-color: #f0f0f0;
text-decoration: underline;
}
.screen {
padding: 1ex;
}
.programlisting {
padding: 1ex;
background-color: #eee;
border: 1px solid #ccc;
}
@media screen { /* hide from ie3 */
a[href]:hover { background: #ffa }
}
blockquote.note {
color: #222;
background: #eee;
border: 1px solid #ccc;
padding: 0.4em 0.4em;
width: 85%;
}
blockquote.tip {
color: #004f00;
background: #d8ecd6;
border: 1px solid green;
padding: 0.2em 2em;
width: 85%;
}
blockquote.important {
font-style:italic;
border: 1px solid #a00;
border-left: 12px solid #c00;
padding: 0.1em 1em;
}
blockquote.warning {
color: #9f1313;
background: #f8e8e8;
border: 1px solid #e59595;
padding: 0.2em 2em;
width: 85%;
}
.example {
background: #fefde6;
border: 1px solid #f1bb16;
margin: 1em 0;
padding: 0.2em 2em;
width: 90%;
}
.informaltable table.calstable tr td {
padding-left: 1em;
padding-right: 1em;
}

46
src/doc/user/xmlmake.sh Normal file
View File

@ -0,0 +1,46 @@
#!/bin/sh
# A script to produce the Recoll manual with an xml toolchain.
# Limitations:
# - Does not produce the links to the whole/chunked versions at the top
# of the document
# - The anchor names from the source text are converted to uppercase by
# the sgml toolchain. This does not happen with the xml toolchain,
# which means that external links like
# usermanual.html#RCL.CONFIG.INDEXING won't work because fragments are
# case-sensitive. This could be solved by converting all ids inside the
# source file to upper-case.
# Wherever docbook.xsl and chunk.xsl live
XSLDIR="/usr/local/share/xsl/docbook/"
# Remove the SGML header and uncomment the XML one
sed -e '\!//FreeBSD//DTD!d' \
-e '\!DTD DocBook XML!s/<!--//' \
-e '\!/docbookx.dtd!s/-->//' \
< usermanual.sgml > usermanual.xml
# Options common to the single-file and chunked versions
commonoptions="--stringparam section.autolabel 1 \
--stringparam section.autolabel.max.depth 3 \
--stringparam section.label.includes.component.label 1 \
--stringparam autotoc.label.in.hyperlink 0 \
--stringparam abstract.notitle.enabled 1 \
--stringparam html.stylesheet docbook-xsl.css \
--stringparam generate.toc \"book toc,title,figure,table,example,equation\" \
"
# Do the chunky thing
eval xsltproc $commonoptions \
--stringparam use.id.as.filename 1 \
"$XSLDIR/html/chunk.xsl" \
usermanual.xml
# Produce the single file version
eval xsltproc $commonoptions \
-o usermanual-xml.html \
"$XSLDIR/html/docbook.xsl" \
usermanual.xml
tidy -indent usermanual-xml.html > tmpfile
mv -f tmpfile usermanual-xml.html