summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShaun McCance <shaunm@src.gnome.org>2006-10-11 02:15:16 +0000
committerShaun McCance <shaunm@src.gnome.org>2006-10-11 02:15:16 +0000
commit2ee456960349da4aef4cfbdbf69fb3bb251a1327 (patch)
tree094b8d8cbf82de48192f4095559a1e42ec3babcf
parent31417a0b671ad781dcc916ea02c4079ddbeaae78 (diff)
downloadgnome-doc-utils-2ee456960349da4aef4cfbdbf69fb3bb251a1327.tar.gz
- Added option to output CSS to an external file
* gnome-doc-html.in: * xslt/docbook/html/db2html-css.xsl: * xslt/docbook/html/db2html-division.xsl: * xslt/docbook/html/db2html-info.xsl: - Added option to output CSS to an external file
-rwxr-xr-xgnome-doc-html.in16
-rw-r--r--xslt/docbook/html/db2html-css.xsl149
-rw-r--r--xslt/docbook/html/db2html-division.xsl4
-rw-r--r--xslt/docbook/html/db2html-info.xsl4
4 files changed, 107 insertions, 66 deletions
diff --git a/gnome-doc-html.in b/gnome-doc-html.in
index 2e5212b..b6bf3a2 100755
--- a/gnome-doc-html.in
+++ b/gnome-doc-html.in
@@ -37,12 +37,12 @@ function error {
echo "$progname: $1" 1>&2;
exit 1;
}
-# FIXME: chunk depth
function print_help {
echo "Usage: $progname [OPTIONS] FILE"
echo "Convert FILE into HTML."
echo ""
echo "Basic Output Control:"
+ echo " -c, --css-file=FILE file to output CSS to"
echo " -d, --chunk-depth=INT how deep sections should be chunked"
echo " -e, --extension=EXT the extension to append to output files"
echo " -n, --no-figures do not copy figures into the output directory"
@@ -58,9 +58,9 @@ function print_help {
echo " elements, either 'KR' or 'ANSI'"
echo ""
echo "Miscellaneous:"
- echo " -v, --verbose print all the commands executed"
- echo " -V, --version print version information and exit"
- echo " -h, --help display this help and exit"
+ echo " -v, --verbose print all the commands executed"
+ echo " -V, --version print version information and exit"
+ echo " -h, --help display this help and exit"
}
function echo_verbose {
if [ "x$doc_verbose" == "x1" ]; then echo $1; fi
@@ -77,6 +77,7 @@ function mkdir_p {
}
longopts='
+ -lcss-file:
-lchunk-depth:
-lextension:
-lno-figures
@@ -90,12 +91,14 @@ longopts='
-lversion
-lhelp
'
-options=`getopt -qn$progname $longopts -- d:e:o:nvVh "$@"`
+options=`getopt -qn$progname $longopts -- c:d:e:o:nvVh "$@"`
if [ "$?" != "0" ]; then print_help 1>&2; exit 1; fi
eval set -- "$options";
while [ "$1" != "--" ]; do
case "$1" in
+ -c | --css-file)
+ doc_css_file="$2";;
-d | --chunk-depth)
doc_chunk_depth="$2";;
-e | --extension)
@@ -174,6 +177,9 @@ params="$params --stringparam db.chunk.extension \"$doc_extension\""
if [ "x$doc_chunk_depth" != "x" ]; then
params="$params --param db.chunk.max_depth $doc_chunk_depth"
fi
+if [ "x$doc_css_file" != "x" ]; then
+ params="$params --stringparam db2html.css.file \"$doc_css_file\""
+fi
if [ "x$doc_admon_graphics_path" != "x" ]; then
params="$params --stringparam db2html.admon.graphics_path"
params="$params \"$doc_admon_graphics_path\""
diff --git a/xslt/docbook/html/db2html-css.xsl b/xslt/docbook/html/db2html-css.xsl
index 499c7af..d27953f 100644
--- a/xslt/docbook/html/db2html-css.xsl
+++ b/xslt/docbook/html/db2html-css.xsl
@@ -18,13 +18,27 @@ Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:doc="http://www.gnome.org/~shaunm/xsldoc"
- xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:exsl="http://exslt.org/common"
exclude-result-prefixes="doc"
+ extension-element-prefixes="exsl"
+ xmlns="http://www.w3.org/1999/xhtml"
version="1.0">
<doc:title>CSS</doc:title>
+<!-- == db2html.css.file =================================================== -->
+
+<parameter xmlns="http://www.gnome.org/~shaunm/xsldoc">
+ <name>db2html.css.file</name>
+ <purpose>
+ The file to output CSS to. If blank, CSS is embedded in the HTML.
+ </purpose>
+</parameter>
+
+<xsl:param name="db2html.css.file" select="''"/>
+
+
<!-- == db2html.css ======================================================== -->
<template xmlns="http://www.gnome.org/~shaunm/xsldoc">
@@ -32,64 +46,81 @@ Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
</template>
<xsl:template name="db2html.css">
- <style>
- <xsl:call-template name="db2html.footnote.css"/>
- <xsl:call-template name="db2html.admon.css"/>
- <xsl:call-template name="db2html.autotoc.css"/>
- <xsl:call-template name="db2html.bibliography.css"/>
- <xsl:call-template name="db2html.block.css"/>
- <xsl:call-template name="db2html.callout.css"/>
- <xsl:call-template name="db2html.cmdsynopsis.css"/>
- <xsl:call-template name="db2html.list.css"/>
- <xsl:call-template name="db2html.qanda.css"/>
- <xsl:call-template name="db2html.refentry.css"/>
- <xsl:call-template name="db2html.table.css"/>
- <xsl:call-template name="db2html.title.css"/>
- <xsl:text>
- body {
- margin: 0px;
- direction: </xsl:text>
- <xsl:call-template name="l10n.direction"/><xsl:text>;
- }
- div[class ~= "body"] {
- padding: 12px;
- }
- div[class ~= "navbar"] {
- margin-left: 12px;
- margin-right: 12px;
- margin-bottom: 12px;
- padding: 6px;
- border: solid 1px;
- }
- div[class ~= "navbar-prev"] {
- margin: 0px;
- padding: 0px;
- float: left;
- }
- div[class ~= "navbar-prev-sans-next"] {
- float: none;
- }
- div[class ~= "navbar-next"] {
- margin: 0px;
- padding: 0px;
- text-align: right;
- }
- div {
- margin-top: 0em; margin-bottom: 0em;
- padding-top: 0em; padding-bottom: 0em;
- }
- p {
- margin-top: 0em; margin-bottom: 0em;
- padding-top: 0em; padding-bottom: 0em;
- }
- div + * { margin-top: 1em; }
- p + * { margin-top: 1em; }
- p &gt; div { margin-top: 1em; margin-bottom: 1em; }
- p &gt; div + div { margin-top: 0em; }
- p { text-align: justify; }
- </xsl:text>
- <xsl:call-template name="db2html.css.custom"/>
- </style>
+ <xsl:param name="css_file" select="true()"/>
+ <xsl:choose>
+ <xsl:when test="$db2html.css.file != ''">
+ <xsl:if test="$css_file">
+ <exsl:document href="{$db2html.css.file}" method="text">
+ <xsl:call-template name="db2html.css.content"/>
+ </exsl:document>
+ </xsl:if>
+ <link rel="stylesheet" type="text/css" href="{$db2html.css.file}"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <style type="text/css">
+ <xsl:call-template name="db2html.css.content"/>
+ </style>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template name="db2html.css.content">
+ <xsl:call-template name="db2html.footnote.css"/>
+ <xsl:call-template name="db2html.admon.css"/>
+ <xsl:call-template name="db2html.autotoc.css"/>
+ <xsl:call-template name="db2html.bibliography.css"/>
+ <xsl:call-template name="db2html.block.css"/>
+ <xsl:call-template name="db2html.callout.css"/>
+ <xsl:call-template name="db2html.cmdsynopsis.css"/>
+ <xsl:call-template name="db2html.list.css"/>
+ <xsl:call-template name="db2html.qanda.css"/>
+ <xsl:call-template name="db2html.refentry.css"/>
+ <xsl:call-template name="db2html.table.css"/>
+ <xsl:call-template name="db2html.title.css"/>
+ <xsl:text>
+ body {
+ margin: 0px;
+ direction: </xsl:text>
+ <xsl:call-template name="l10n.direction"/><xsl:text>;
+ }
+ div[class ~= "body"] {
+ padding: 12px;
+ }
+ div[class ~= "navbar"] {
+ margin-left: 12px;
+ margin-right: 12px;
+ margin-bottom: 12px;
+ padding: 6px;
+ border: solid 1px;
+ }
+ div[class ~= "navbar-prev"] {
+ margin: 0px;
+ padding: 0px;
+ float: left;
+ }
+ div[class ~= "navbar-prev-sans-next"] {
+ float: none;
+ }
+ div[class ~= "navbar-next"] {
+ margin: 0px;
+ padding: 0px;
+ text-align: right;
+ }
+ div {
+ margin-top: 0em; margin-bottom: 0em;
+ padding-top: 0em; padding-bottom: 0em;
+ }
+ p {
+ margin-top: 0em; margin-bottom: 0em;
+ padding-top: 0em; padding-bottom: 0em;
+ }
+ div + * { margin-top: 1em; }
+ p + * { margin-top: 1em; }
+ p &gt; div { margin-top: 1em; margin-bottom: 1em; }
+ p &gt; div + div { margin-top: 0em; }
+ p { text-align: justify; }
+ </xsl:text>
+ <xsl:call-template name="db2html.css.custom"/>
</xsl:template>
<xsl:template name="db2html.css.custom"/>
diff --git a/xslt/docbook/html/db2html-division.xsl b/xslt/docbook/html/db2html-division.xsl
index 8576e14..74ac4e4 100644
--- a/xslt/docbook/html/db2html-division.xsl
+++ b/xslt/docbook/html/db2html-division.xsl
@@ -146,7 +146,9 @@ Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
</xsl:attribute>
</link>
</xsl:if>
- <xsl:call-template name="db2html.css"/>
+ <xsl:call-template name="db2html.css">
+ <xsl:with-param name="css_file" select="$depth_of_chunk = 0"/>
+ </xsl:call-template>
<xsl:call-template name="db2html.division.head.extra"/>
</head>
<body>
diff --git a/xslt/docbook/html/db2html-info.xsl b/xslt/docbook/html/db2html-info.xsl
index c1f7789..6bdfbcc 100644
--- a/xslt/docbook/html/db2html-info.xsl
+++ b/xslt/docbook/html/db2html-info.xsl
@@ -56,7 +56,9 @@ Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
</xsl:param>
<html>
<head>
- <xsl:call-template name="db2html.css"/>
+ <xsl:call-template name="db2html.css">
+ <xsl:with-param name="css_file" select="false()"/>
+ </xsl:call-template>
</head>
<body>
<div class="body">