[yelp] Changes for new common HTML output in yelp-xsl
- From: Shaun McCance <shaunm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [yelp] Changes for new common HTML output in yelp-xsl
- Date: Wed, 26 May 2010 23:47:45 +0000 (UTC)
commit b33a4e412e354eefa06e42ae32e2f9404bc024c8
Author: Shaun McCance <shaunm gnome org>
Date: Wed May 26 18:46:37 2010 -0500
Changes for new common HTML output in yelp-xsl
libyelp/yelp-settings.c | 40 ++++++++++++++--------------
stylesheets/db2html.xsl.in | 52 --------------------------------------
stylesheets/mal2html.xsl.in | 34 +++++++-----------------
stylesheets/yelp-common.xsl.in | 54 ++++++++++++++++++++++++++++++++-------
4 files changed, 74 insertions(+), 106 deletions(-)
---
diff --git a/libyelp/yelp-settings.c b/libyelp/yelp-settings.c
index 0c8a386..47d7357 100644
--- a/libyelp/yelp-settings.c
+++ b/libyelp/yelp-settings.c
@@ -451,20 +451,20 @@ const gchar*
yelp_settings_get_color_param (YelpSettingsColor color)
{
static const gchar *params[YELP_SETTINGS_NUM_COLORS] = {
- "theme.color.background",
- "theme.color.text",
- "theme.color.text_light",
- "theme.color.link",
- "theme.color.link_visted",
- "theme.color.gray_background",
- "theme.color.dark_background",
- "theme.color.gray_border",
- "theme.color.blue_background",
- "theme.color.blue_border",
- "theme.color.red_background",
- "theme.color.red_border",
- "theme.color.yellow_background",
- "theme.color.yellow_border"
+ "color.background",
+ "color.text",
+ "color.text_light",
+ "color.link",
+ "color.link_visted",
+ "color.gray_background",
+ "color.dark_background",
+ "color.gray_border",
+ "color.blue_background",
+ "color.blue_border",
+ "color.red_background",
+ "color.red_border",
+ "color.yellow_background",
+ "color.yellow_border"
};
g_return_val_if_fail (color < YELP_SETTINGS_NUM_COLORS, NULL);
return params[color];
@@ -659,11 +659,11 @@ const gchar *
yelp_settings_get_icon_param (YelpSettingsIcon icon)
{
static const gchar *params[YELP_SETTINGS_NUM_ICONS] = {
- "theme.icons.note.bug",
- "theme.icons.note.important",
- "theme.icons.note",
- "theme.icons.note.tip",
- "theme.icons.note.warning"
+ "icons.note.bug",
+ "icons.note.important",
+ "icons.note",
+ "icons.note.tip",
+ "icons.note.warning"
};
g_return_val_if_fail (icon < YELP_SETTINGS_NUM_ICONS, NULL);
return params[icon];
@@ -727,7 +727,7 @@ yelp_settings_get_all_params (YelpSettings *settings,
g_free (val);
}
ix = 2 * (YELP_SETTINGS_NUM_COLORS + YELP_SETTINGS_NUM_ICONS);
- params[ix++] = g_strdup ("theme.icon.admon.size");
+ params[ix++] = g_strdup ("icons.size.note");
params[ix++] = g_strdup_printf ("%i", yelp_settings_get_icon_size (settings));
params[ix++] = g_strdup ("yelp.editor_mode");
if (settings->priv->editor_mode)
diff --git a/stylesheets/db2html.xsl.in b/stylesheets/db2html.xsl.in
index 06f4804..4a2d48b 100644
--- a/stylesheets/db2html.xsl.in
+++ b/stylesheets/db2html.xsl.in
@@ -9,63 +9,11 @@
<xsl:include href="yelp-common.xsl"/>
-<xsl:param name="db.chunk.chunk_top" select="true()"/>
-<xsl:param name="db.chunk.extension" select="''"/>
<xsl:param name="db.chunk.info_basename" select="'//about'"/>
<xsl:param name="db2html.navbar.top" select="false()"/>
<xsl:param name="db2html.sidenav" select="false()"/>
-<!-- == db.number == -->
-<!--
-FIXME: yelp:cache no longer works
-<xsl:template name="db.number">
- <xsl:param name="node" select="."/>
- <yelp:cache key="db.number" node="$node">
- <xsl:apply-templates mode="db.number.mode" select="$node"/>
- </yelp:cache>
-</xsl:template>
--->
-
-<!-- == db.chunk == -->
-<xsl:template name="db.chunk">
- <xsl:param name="node" select="."/>
- <xsl:param name="info"/>
- <xsl:param name="template"/>
- <xsl:param name="href">
- <xsl:choose>
- <xsl:when test="$template = 'info'">
- <xsl:value-of select="$db.chunk.info_basename"/>
- </xsl:when>
- <xsl:when test="$node/@id">
- <xsl:value-of select="$node/@id"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$node/@xml:id"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:param>
- <xsl:param name="depth_of_chunk">
- <xsl:call-template name="db.chunk.depth-of-chunk">
- <xsl:with-param name="node" select="$node"/>
- </xsl:call-template>
- </xsl:param>
- <yelp:document href="{$href}">
- <xsl:call-template name="db.chunk.content">
- <xsl:with-param name="node" select="$node"/>
- <xsl:with-param name="info" select="$info"/>
- <xsl:with-param name="template" select="$template"/>
- <xsl:with-param name="depth_of_chunk" select="$depth_of_chunk"/>
- </xsl:call-template>
- </yelp:document>
- <xsl:if test="string($template) = ''">
- <xsl:call-template name="db.chunk.children">
- <xsl:with-param name="node" select="$node"/>
- <xsl:with-param name="depth_of_chunk" select="$depth_of_chunk"/>
- </xsl:call-template>
- </xsl:if>
-</xsl:template>
-
<!-- == db.xref.target == -->
<xsl:template name="db.xref.target">
<xsl:param name="linkend"/>
diff --git a/stylesheets/mal2html.xsl.in b/stylesheets/mal2html.xsl.in
index bcce8b8..f5a934b 100644
--- a/stylesheets/mal2html.xsl.in
+++ b/stylesheets/mal2html.xsl.in
@@ -1,35 +1,22 @@
<?xml version='1.0' encoding='UTF-8'?><!-- -*- indent-tabs-mode: nil -*- -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:yelp="http://www.gnome.org/yelp/ns"
xmlns:mal="http://www.gnome.org/~shaunm/mallard"
+ xmlns:yelp="http://www.gnome.org/yelp/ns"
xmlns="http://www.w3.org/1999/xhtml"
extension-element-prefixes="yelp"
version="1.0">
<xsl:import href="@XSL_MAL2XHTML@"/>
-<xsl:include href="yelp-common.xsl"/>
+<xsl:import href="yelp-common.xsl"/>
<xsl:param name="yelp.stub" select="false()"/>
<xsl:param name="mal2html.editor_mode" select="$yelp.editor_mode"/>
-<xsl:param name="mal.chunk.chunk_top" select="true()"/>
-<xsl:param name="mal.chunk.extension" select="''"/>
-
<xsl:param name="mal.cache" select="yelp:input()"/>
<xsl:key name="mal.cache.key" match="mal:page | mal:section" use="@id"/>
-
-<!-- == mal.chunk == -->
-<xsl:template name="mal.chunk">
- <xsl:param name="node" select="."/>
- <xsl:param name="href" select="concat($node/@id, $mal.chunk.extension)"/>
- <yelp:document href="{$href}">
- <xsl:apply-templates mode="mal.chunk.content.mode" select="$node"/>
- </yelp:document>
-</xsl:template>
-
<!-- == mal.link.target == -->
<xsl:template name="mal.link.target">
<xsl:param name="link" select="."/>
@@ -53,23 +40,22 @@
</xsl:choose>
</xsl:template>
-<xsl:template name="mal2html.css.custom">
+<xsl:template name="yelp.css.custom">
<xsl:text>
div.linkdiv { border: none; }
div.linkdiv:hover {
border: none;
outline: solid 1px </xsl:text>
- <xsl:value-of select="$theme.color.blue_background"/><xsl:text>;
+ <xsl:value-of select="$color.blue_background"/><xsl:text>;
background: -webkit-gradient(linear, left top, left 80, from(</xsl:text>
- <xsl:value-of select="$theme.color.blue_background"/><xsl:text>), to(</xsl:text>
- <xsl:value-of select="$theme.color.background"/><xsl:text>));
+ <xsl:value-of select="$color.blue_background"/><xsl:text>), to(</xsl:text>
+ <xsl:value-of select="$color.background"/><xsl:text>));
}
</xsl:text>
<xsl:if test="$yelp.editor_mode">
<xsl:text>
-div.head { margin: 0; }
div.version {
- margin: 0 -12px 1em -12px;
+ margin: -1em -12px 1em -12px;
padding: 0.5em 12px 0.5em 12px;
position: relative;
left: auto; right: auto;
@@ -77,9 +63,9 @@ div.version {
max-width: none;
border: none;
border-bottom: solid 1px </xsl:text>
- <xsl:value-of select="$theme.color.gray_border"/><xsl:text>;
+ <xsl:value-of select="$color.gray_border"/><xsl:text>;
background-color: </xsl:text>
- <xsl:value-of select="$theme.color.yellow_background"/><xsl:text>;
+ <xsl:value-of select="$color.yellow_background"/><xsl:text>;
}
div.version:hover { opacity: 1.0; }
</xsl:text>
@@ -87,7 +73,7 @@ div.version:hover { opacity: 1.0; }
<xsl:text>
body, div.body {
background-color: </xsl:text>
- <xsl:value-of select="$theme.color.red_background"/><xsl:text>;
+ <xsl:value-of select="$color.red_background"/><xsl:text>;
}
</xsl:text>
</xsl:if>
diff --git a/stylesheets/yelp-common.xsl.in b/stylesheets/yelp-common.xsl.in
index 143c5af..72c9c2e 100644
--- a/stylesheets/yelp-common.xsl.in
+++ b/stylesheets/yelp-common.xsl.in
@@ -1,12 +1,43 @@
<?xml version='1.0' encoding='UTF-8'?><!-- -*- indent-tabs-mode: nil -*- -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:yelp="http://www.gnome.org/yelp/ns"
xmlns="http://www.w3.org/1999/xhtml"
+ extension-element-prefixes="yelp"
version="1.0">
<xsl:param name="yelp.editor_mode" select="false()"/>
-<!-- == yelp.common.css == -->
-<xsl:template name="theme.html.css.custom">
+<xsl:param name="html.extension" select="''"/>
+
+<!-- == html.output == -->
+<xsl:template name="html.output">
+ <xsl:param name="node" select="."/>
+ <xsl:param name="href">
+ <xsl:choose>
+ <xsl:when test="$node/@xml:id">
+ <xsl:value-of select="$node/@xml:id"/>
+ </xsl:when>
+ <xsl:when test="$node/@id">
+ <xsl:value-of select="$node/@id"/>
+ </xsl:when>
+ <xsl:when test="set:has-same-node($node, /*)">
+ <xsl:value-of select="$html.basename"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="generate-id()"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:param>
+ <yelp:document href="{$node/@id}">
+ <xsl:call-template name="html.page">
+ <xsl:with-param name="node" select="$node"/>
+ </xsl:call-template>
+ </yelp:document>
+ <xsl:apply-templates mode="html.output.after.mode" select="$node"/>
+</xsl:template>
+
+<!-- == html.css.custom == -->
+<xsl:template name="html.css.custom">
<xsl:param name="direction"/>
<xsl:param name="left"/>
<xsl:param name="right"/>
@@ -16,10 +47,10 @@ html {
}
body {
padding: 0;
- background-color: </xsl:text><xsl:value-of select="$theme.color.background"/><xsl:text>;
+ background-color: </xsl:text><xsl:value-of select="$color.background"/><xsl:text>;
max-width: 100%;
}
-div.head {
+div.header {
max-width: 100%;
width: 100%;
padding: 0;
@@ -29,9 +60,9 @@ div.trails {
margin: 0;
padding: 0.2em 12px 0 12px;
background-color: </xsl:text>
- <xsl:value-of select="$theme.color.gray_background"/><xsl:text>;
+ <xsl:value-of select="$color.gray_background"/><xsl:text>;
border-bottom: solid 1px </xsl:text>
- <xsl:value-of select="$theme.color.gray_border"/><xsl:text>;
+ <xsl:value-of select="$color.gray_border"/><xsl:text>;
}
div.trail {
font-size: 1em;
@@ -44,8 +75,11 @@ div.body {
border: none;
}
</xsl:text>
+<xsl:call-template name="yelp.css.custom"/>
</xsl:template>
+<xsl:template name="yelp.css.custom"/>
+
<xsl:template name="yelp.common.javascript">
<script type="text/javascript" language="javascript" src="@DATADIR@/jquery-1.4.2.min.js"/>
<script type="text/javascript" language="javascript" src="@DATADIR@/jquery-ui-1.8.custom.min.js"/>
@@ -54,14 +88,14 @@ div.body {
$(document).ready (function () {
if (location.hash != '') {
$('#' + location.hash).find('div.header').css({
- backgroundColor: '</xsl:text><xsl:value-of select="$theme.color.yellow_background"/><xsl:text>'
+ backgroundColor: '</xsl:text><xsl:value-of select="$color.yellow_background"/><xsl:text>'
}).animate({
- backgroundColor: '</xsl:text><xsl:value-of select="$theme.color.gray_background"/><xsl:text>'
+ backgroundColor: '</xsl:text><xsl:value-of select="$color.gray_background"/><xsl:text>'
}, 8000);
$('#' + location.hash).css({
- backgroundColor: '</xsl:text><xsl:value-of select="$theme.color.yellow_background"/><xsl:text>'
+ backgroundColor: '</xsl:text><xsl:value-of select="$color.yellow_background"/><xsl:text>'
}).animate({
- backgroundColor: '</xsl:text><xsl:value-of select="$theme.color.background"/><xsl:text>'
+ backgroundColor: '</xsl:text><xsl:value-of select="$color.background"/><xsl:text>'
}, 4000);
}
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]