summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog14
-rw-r--r--test/testbook/testbook.xml144
-rw-r--r--xslt/docbook/html/db2html-autotoc.xsl25
-rw-r--r--xslt/docbook/html/db2html-block.xsl5
-rw-r--r--xslt/docbook/html/db2html-css.xsl50
-rw-r--r--xslt/docbook/html/db2html-division.xsl20
-rw-r--r--xslt/docbook/html/db2html-media.xsl2
-rw-r--r--xslt/docbook/html/db2html-table.xsl2
-rw-r--r--xslt/gettext/l10n.xml.in5
9 files changed, 231 insertions, 36 deletions
diff --git a/ChangeLog b/ChangeLog
index 13104008..ea157304 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
2007-04-20 Shaun McCance <shaunm@gnome.org>
+ * test/testbook/testbook.xml:
+ - Added informalfigure formalpara literallayout programlisting screen
+
+ * xslt/docbook/html/db2html-autotoc.xsl:
+ * xslt/docbook/html/db2html-block.xsl:
+ * xslt/docbook/html/db2html-css.xsl:
+ * xslt/docbook/html/db2html-division.xsl:
+ * xslt/docbook/html/db2html-media.xsl:
+ * xslt/docbook/html/db2html-table.xsl:
+ * xslt/gettext/l10n.xml.in:
+ - Some autotoc and figure work
+
+2007-04-20 Shaun McCance <shaunm@gnome.org>
+
* test/testbook/Makefile:
* test/testbook/testbook.xml:
- Adding a simple test book
diff --git a/test/testbook/testbook.xml b/test/testbook/testbook.xml
index 1e8ce9df..e93261aa 100644
--- a/test/testbook/testbook.xml
+++ b/test/testbook/testbook.xml
@@ -183,6 +183,16 @@ $(_DOC_LC_DOCS) : $(_DOC_C_DOCS)
reader</ulink></para></caption>
</mediaobject>
</figure>
+ <informalfigure>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="http://www.gnome.org/projects/orca/images/orca2-sm.jpg"/>
+ </imageobject>
+ <caption><para>The mascot for the <ulink
+ url="http://www.gnome.org/projects/orca/index.html">Orca screen
+ reader</ulink></para></caption>
+ </mediaobject>
+ </informalfigure>
<para>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed risus dui,
faucibus at, blandit eu, congue in, sem. Suspendisse nec mi. Sed vel augue.
@@ -226,14 +236,136 @@ USA</address>
things are done for me against my will.</para>
</blockquote>
+ <formalpara>
+ <title>Formal Paragraph</title>
+ <para>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed risus dui,
+ faucibus at, blandit eu, congue in, sem. Suspendisse nec mi. Sed vel augue.
+ Cras egestas. Vivamus nisi. Fusce neque. Aenean posuere, orci non lacinia
+ consectetuer, neque libero semper metus, ut ullamcorper eros lorem at tellus.
+ Ut ante tellus, iaculis at, tincidunt quis, ultrices at, ligula. Pellentesque
+ porttitor condimentum nulla.</para>
+ </formalpara>
+
+ <para>Next we have a <sgmltag>literallayout</sgmltag> element:</para>
+
+ <literallayout>This is a line.
+This is another line.
+ This line is indented.</literallayout>
+
+ <section id="programlisting">
+ <title>Program Listings</title>
+
+ <para>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed risus dui,
+ faucibus at, blandit eu, congue in, sem. Suspendisse nec mi. Sed vel augue.
+ Cras egestas. Vivamus nisi. Fusce neque. Aenean posuere, orci non lacinia
+ consectetuer, neque libero semper metus, ut ullamcorper eros lorem at tellus.
+ Ut ante tellus, iaculis at, tincidunt quis, ultrices at, ligula. Pellentesque
+ porttitor condimentum nulla.</para>
+
+ <programlisting><![CDATA[
+function runline (line, ix, jx, pre, aft, char, name, id, fmt) {
+ ix = match(line, /[\*\$\@\%\!\#]\{[^\}]*\}/)
+ if (ix > 0) {
+ jx = ix + index(substr(line, ix), "}");
+ pre = substr(line, 1, ix - 1);
+ aft = substr(line, jx);
+ char = substr(line, ix, 1);
+ name = substr(line, ix + 2, jx - ix - 3);
+ id = name;
+ while (sub(/[\.-]/, "_", id));
+ if (char == "!")
+ fmt = "<filename><link linkend='S__%s'>%s</link></filename>";
+ else if (char == "*")
+ fmt = "<function><link linkend='T__%s'>%s</link></function>";
+ else if (char == "%")
+ fmt = "<function><link linkend='M__%s'>%s</link></function>";
+ else if (char == "@")
+ fmt = "<parameter><link linkend='P__%s'>%s</link></parameter>";
+ else if (char == "$")
+ fmt = "<parameter>"name"</parameter>";
+ else if (char == "#")
+ fmt = "<literal>"name"</literal>";
+ else
+ fmt = name;
+ return sprintf("%s%s%s",
+ runline(pre),
+ sprintf(fmt, id, name),
+ runline(aft) );
+ } else {
+ return line;
+ }
+}
+]]></programlisting>
+
+ <para>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed risus dui,
+ faucibus at, blandit eu, congue in, sem. Suspendisse nec mi. Sed vel augue.
+ Cras egestas. Vivamus nisi. Fusce neque. Aenean posuere, orci non lacinia
+ consectetuer, neque libero semper metus, ut ullamcorper eros lorem at tellus.
+ Ut ante tellus, iaculis at, tincidunt quis, ultrices at, ligula. Pellentesque
+ porttitor condimentum nulla.</para>
+
+ <programlisting linenumbering="numbered"><![CDATA[
+function runline (line, ix, jx, pre, aft, char, name, id, fmt) {
+ ix = match(line, /[\*\$\@\%\!\#]\{[^\}]*\}/)
+ if (ix > 0) {
+ jx = ix + index(substr(line, ix), "}");
+ pre = substr(line, 1, ix - 1);
+ aft = substr(line, jx);
+ char = substr(line, ix, 1);
+ name = substr(line, ix + 2, jx - ix - 3);
+ id = name;
+ while (sub(/[\.-]/, "_", id));
+ if (char == "!")
+ fmt = "<filename><link linkend='S__%s'>%s</link></filename>";
+ else if (char == "*")
+ fmt = "<function><link linkend='T__%s'>%s</link></function>";
+ else if (char == "%")
+ fmt = "<function><link linkend='M__%s'>%s</link></function>";
+ else if (char == "@")
+ fmt = "<parameter><link linkend='P__%s'>%s</link></parameter>";
+ else if (char == "$")
+ fmt = "<parameter>"name"</parameter>";
+ else if (char == "#")
+ fmt = "<literal>"name"</literal>";
+ else
+ fmt = name;
+ return sprintf("%s%s%s",
+ runline(pre),
+ sprintf(fmt, id, name),
+ runline(aft) );
+ } else {
+ return line;
+ }
+}
+]]></programlisting>
+ </section>
+
+ <section id="screen">
+ <title>Screens</title>
+
+ <para>This <sgmltag>screen</sgmltag> element has <sgmltag>prompt</sgmltag>,
+ <sgmltag>userinput</sgmltag>, and <sgmltag>computeroutput</sgmltag> elements.</para>
+
+ <screen><prompt>[shaunm@verso testbook] </prompt><userinput>make</userinput>
+<computeroutput><![CDATA[if [ ! -d html ]; then mkdir html; fi
+rm -f html/*.*
+xsltproc --timing --nonet --xinclude -o html/ \
+ --param db.chunk.chunk_top 1 \
+ --stringparam theme.icon.admon.path "../../../data/icons/" \
+ --stringparam theme.icon.nav.previous "../../../data/icons/nav-previous.png" \
+ --stringparam theme.icon.nav.next "../../../data/icons/nav-next.png" \
+ ../../xslt/docbook/html/db2html.xsl \
+ testbook.xml
+Parsing stylesheet ../../xslt/docbook/html/db2html.xsl took 0 ms
+Parsing document testbook.xml took 51 ms
+XInclude processing testbook.xml took 0 ms
+Running stylesheet and saving result took 144 ms
+]]></computeroutput></screen>
+
+ </section>
+
<!-- FIXME:
-example
-figure (caption)
-formalpara
glossary stuff
-highlights
-literallayout
-programlisting
screen
synopsis
-->
diff --git a/xslt/docbook/html/db2html-autotoc.xsl b/xslt/docbook/html/db2html-autotoc.xsl
index 9abc626b..0abc5d44 100644
--- a/xslt/docbook/html/db2html-autotoc.xsl
+++ b/xslt/docbook/html/db2html-autotoc.xsl
@@ -32,6 +32,7 @@ REMARK: Write some intro material here
db2html.autotoc
Creates a table of contents for a given element
$node: The element to create a table of contents for
+$title: Whether to give the contents list a title
$selected: A currently-selected page
$divisions: The division-level child elements of ${node}
$labels: Whether to generate labels
@@ -41,25 +42,33 @@ REMARK: Extra explanation of the parameters would be good
-->
<xsl:template name="db2html.autotoc">
<xsl:param name="node" select="."/>
+ <xsl:param name="title" select="false()"/>
<xsl:param name="selected" select="false()"/>
<xsl:param name="divisions"/>
<xsl:param name="toc_depth" select="1"/>
<xsl:param name="labels" select="true()"/>
<xsl:param name="titleabbrev" select="false()"/>
- <div class="autotoc">
- <ul>
- <xsl:for-each select="$divisions">
- <xsl:if test="($selected = false()) or ($node = $selected/ancestor-or-self::*)">
+ <xsl:if test="($selected = false()) or ($node = $selected/ancestor-or-self::*)">
+ <div class="autotoc">
+ <xsl:if test="$title">
+ <div class="title autotoc-title">
+ <xsl:call-template name="l10n.gettext">
+ <xsl:with-param name="msgid" select="'Contents'"/>
+ </xsl:call-template>
+ </div>
+ </xsl:if>
+ <ul>
+ <xsl:for-each select="$divisions">
<xsl:apply-templates mode="db2html.autotoc.mode" select=".">
<xsl:with-param name="selected" select="$selected"/>
<xsl:with-param name="toc_depth" select="$toc_depth - 1"/>
<xsl:with-param name="labels" select="$labels"/>
<xsl:with-param name="titleabbrev" select="$titleabbrev"/>
</xsl:apply-templates>
- </xsl:if>
- </xsl:for-each>
- </ul>
- </div>
+ </xsl:for-each>
+ </ul>
+ </div>
+ </xsl:if>
</xsl:template>
diff --git a/xslt/docbook/html/db2html-block.xsl b/xslt/docbook/html/db2html-block.xsl
index eaba5f59..7787b247 100644
--- a/xslt/docbook/html/db2html-block.xsl
+++ b/xslt/docbook/html/db2html-block.xsl
@@ -440,6 +440,11 @@ dd.glossdef, dd.glosssee, dd.glossseealso
<xsl:template match="informalfigure">
<xsl:call-template name="db2html.block">
<xsl:with-param name="indent" select="true()"/>
+ <xsl:with-param name="formal" select="true()"/>
+ <!-- When a figure contains only a single mediaobject, it eats the caption -->
+ <xsl:with-param name="caption"
+ select="*[not(self::blockinfo) and not(self::title) and not(self::titleabbrev)]
+ [last() = 1]/self::mediaobject/caption"/>
</xsl:call-template>
</xsl:template>
diff --git a/xslt/docbook/html/db2html-css.xsl b/xslt/docbook/html/db2html-css.xsl
index 532b79bd..a6887c02 100644
--- a/xslt/docbook/html/db2html-css.xsl
+++ b/xslt/docbook/html/db2html-css.xsl
@@ -203,12 +203,27 @@ td.navbar-next {
}
div.autotoc {
+ <!-- FIXME: hack -->
+ display: table;
+ margin-top: 1em;
<!-- FIXME: rtl -->
margin-left: 1.72em;
- padding: 0;
+ padding: 0.5em 1em 0.5em 1em;
+ background-color: </xsl:text>
+ <xsl:value-of select="$theme.color.blue_background"/><xsl:text>;
+ border: solid 1px </xsl:text>
+ <xsl:value-of select="$theme.color.blue_border"/><xsl:text>;
}
div.autotoc ul { margin: 0; padding: 0; }
div.autotoc li { list-style-type: none; }
+div.autotoc div.autotoc-title { margin-bottom: 0.5em; }
+div.autotoc div.autotoc {
+ border: none;
+ padding: 0;
+ margin-top: 0;
+ margin-bottom: 0.5em;
+}
+div.autotoc div.autotoc div.autotoc { margin-bottom: 0; }
div.sidebar {
<!-- FIXME: rtl -->
@@ -224,7 +239,13 @@ div.sidenav {
border: solid 1px </xsl:text>
<xsl:value-of select="$theme.color.gray_border"/><xsl:text>;
}
-div.sidenav div.autotoc { margin: 0; }
+div.sidenav div.autotoc {
+ background-color: </xsl:text>
+ <xsl:value-of select="$theme.color.background"/><xsl:text>;
+ border: none;
+ padding: 0;
+ margin: 0;
+}
div.sidenav div.autotoc div.autotoc { margin-top: 0.5em; }
div.sidenav div.autotoc div.autotoc li { margin-bottom: 0.5em; }
div.sidenav div.autotoc div.autotoc div.autotoc {
@@ -235,6 +256,7 @@ div.sidenav div.autotoc div.autotoc div.autotoc {
div.sidenav div.autotoc div.autotoc div.autotoc li { margin-bottom: 0; }
div.blockquote {
+ <!-- FIXME: i18n -->
background-image: url('../../../data/icons/yelp-watermark-blockquote-201C.png');
background-repeat: no-repeat;
<!-- FIXME: rtl -->
@@ -261,14 +283,17 @@ div.epigraph {
color: </xsl:text>
<xsl:value-of select="$theme.color.text_light"/><xsl:text>;
}
-div.figure {
+div.figure, div.informalfigure {
+ <!-- FIXME: hack -->
+ display: table;
padding: 0.5em;
background-color: </xsl:text>
- <xsl:value-of select="$theme.color.blue_background"/><xsl:text>;
+ <xsl:value-of select="$theme.color.gray_background"/><xsl:text>;
border: solid 1px </xsl:text>
- <xsl:value-of select="$theme.color.blue_border"/><xsl:text>;
+ <xsl:value-of select="$theme.color.gray_border"/><xsl:text>;
}
-div.figure-inner {
+div.figure-inner, div.informalfigure-inner {
+ padding: 0.5em;
background-color: </xsl:text>
<xsl:value-of select="$theme.color.background"/><xsl:text>;
border: solid 1px </xsl:text>
@@ -279,7 +304,6 @@ div.caption {
}
pre.programlisting {
padding: 0.5em;
- overflow: auto;
<!-- FIXME: watermark -->
background-color: </xsl:text>
<xsl:value-of select="$theme.color.gray_background"/><xsl:text>;
@@ -288,23 +312,25 @@ pre.programlisting {
}
pre.screen {
padding: 0.5em;
- overflow: auto;
<!-- FIXME: watermark -->
background-color: </xsl:text>
<xsl:value-of select="$theme.color.gray_background"/><xsl:text>;
border: solid 1px </xsl:text>
<xsl:value-of select="$theme.color.gray_border"/><xsl:text>;
}
-pre.synopsis { overflow: auto; }
+pre.screen .prompt {
+ color: </xsl:text>
+ <xsl:value-of select="$theme.color.text_light"/><xsl:text>;
+}
pre.linenumbering {
<!-- The margin is important to get the line numbering
to line up vertically with the content. -->
margin-top: 0;
- <!-- FIXME: rtl -->
- margin-left: 0.83em;
- padding: 1em 0.4em 1em 0.4em;
+ padding: 0.5em;
border: solid 1px </xsl:text>
<xsl:value-of select="$theme.color.gray_border"/><xsl:text>;
+ <!-- FIXME: rtl -->
+ border-right: none;
background-color: </xsl:text>
<xsl:value-of select="$theme.color.gray_background"/><xsl:text>;
color: </xsl:text>
diff --git a/xslt/docbook/html/db2html-division.xsl b/xslt/docbook/html/db2html-division.xsl
index e450c990..c1716dda 100644
--- a/xslt/docbook/html/db2html-division.xsl
+++ b/xslt/docbook/html/db2html-division.xsl
@@ -273,7 +273,7 @@ REMARK: Talk about some of the parameters
<xsl:param name="chunk_info"
select="($depth_of_chunk = 0) and
($depth_in_chunk = 0 and $info)"/>
- <xsl:param name="autotoc_depth" select="number(boolean($chunk_divisions))"/>
+ <xsl:param name="autotoc_depth" select="number(boolean($divisions))"/>
<div class="division {local-name($node)}">
<xsl:call-template name="db2html.anchor">
@@ -294,13 +294,6 @@ REMARK: Talk about some of the parameters
<xsl:with-param name="node" select="$node"/>
</xsl:call-template>
</xsl:if>
- <xsl:if test="$autotoc_depth != 0">
- <xsl:call-template name="db2html.autotoc">
- <xsl:with-param name="node" select="$node"/>
- <xsl:with-param name="divisions" select="$divisions"/>
- <xsl:with-param name="depth_of_chunk" select="$depth_of_chunk"/>
- </xsl:call-template>
- </xsl:if>
<xsl:variable name="nots" select="$divisions | $entries | $title_node | $subtitle_node"/>
<xsl:apply-templates select="*[not(. = $nots)]">
<xsl:with-param name="depth_in_chunk" select="$depth_in_chunk + 1"/>
@@ -314,6 +307,15 @@ REMARK: Talk about some of the parameters
</xsl:apply-templates>
</dl>
</xsl:if>
+ <xsl:if test="$autotoc_depth != 0">
+ <xsl:call-template name="db2html.autotoc">
+ <xsl:with-param name="node" select="$node"/>
+ <xsl:with-param name="title" select="true()"/>
+ <xsl:with-param name="divisions" select="$divisions"/>
+ <xsl:with-param name="toc_depth" select="$autotoc_depth"/>
+ <xsl:with-param name="depth_of_chunk" select="$depth_of_chunk"/>
+ </xsl:call-template>
+ </xsl:if>
<xsl:if test="not($chunk_divisions)">
<xsl:apply-templates select="$divisions">
<xsl:with-param name="depth_in_chunk" select="$depth_in_chunk + 1"/>
@@ -1059,7 +1061,7 @@ REMARK: Describe this template
<xsl:with-param name="info" select="bookinfo"/>
<xsl:with-param name="depth_in_chunk" select="$depth_in_chunk"/>
<xsl:with-param name="depth_of_chunk" select="$depth_of_chunk"/>
- <xsl:with-param name="autotoc_depth" select="boolean(part | reference) + 1"/>
+ <xsl:with-param name="autotoc_depth" select="2"/>
</xsl:call-template>
</xsl:template>
diff --git a/xslt/docbook/html/db2html-media.xsl b/xslt/docbook/html/db2html-media.xsl
index 1cb1a63f..56577f73 100644
--- a/xslt/docbook/html/db2html-media.xsl
+++ b/xslt/docbook/html/db2html-media.xsl
@@ -196,7 +196,7 @@ as a text-only mode.
<xsl:call-template name="db2html.anchor"/>
<xsl:call-template name="db2html.mediaobject"/>
<!-- When a figure contains only a single mediaobject, it eats the caption -->
- <xsl:if test="not(../self::figure) or
+ <xsl:if test="not(../self::figure or ../self::informalfigure) or
../*[not(self::blockinfo) and not(self::title) and
not(self::titleabbrev) and not(. = current()) ]">
<xsl:apply-templates select="caption"/>
diff --git a/xslt/docbook/html/db2html-table.xsl b/xslt/docbook/html/db2html-table.xsl
index e0eb1c36..e5e6809d 100644
--- a/xslt/docbook/html/db2html-table.xsl
+++ b/xslt/docbook/html/db2html-table.xsl
@@ -46,6 +46,8 @@ REMARK: Describe this template
<xsl:text>
table {
border-collapse: collapse;
+}
+table.table {
border: solid 1px;
-moz-border-radius: 5px;
}
diff --git a/xslt/gettext/l10n.xml.in b/xslt/gettext/l10n.xml.in
index d54eb4b0..ce11449c 100644
--- a/xslt/gettext/l10n.xml.in
+++ b/xslt/gettext/l10n.xml.in
@@ -94,6 +94,11 @@
</_msg>
</msgset>
<msgset>
+ <msgid>Contents</msgid>
+ <!-- Used as the title of the listing of subsections -->
+ <_msg>Contents</_msg>
+</msgset>
+<msgset>
<msgid>Copyright</msgid>
<!-- Used as a header before a list of copyrights. -->
<_msg>