[yelp] Highlight #anchor sections for DocBook documents as well as Mallard
- From: Shaun McCance <shaunm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [yelp] Highlight #anchor sections for DocBook documents as well as Mallard
- Date: Thu, 1 Apr 2010 22:16:06 +0000 (UTC)
commit 97f9d09dc1f87413f102724cb155ea2cba91d700
Author: Shaun McCance <shaunm gnome org>
Date: Thu Apr 1 16:23:50 2010 -0500
Highlight #anchor sections for DocBook documents as well as Mallard
This doesn't work with embedded <anchor> tags, or links to anything
except sections. Might be worthwhile to make the JavaScript a bit
smarter about DOM traversal.
.gitignore | 1 +
configure.in | 1 +
stylesheets/Makefile.am | 2 +-
stylesheets/db2html.xsl.in | 11 +-----
stylesheets/mal2html.xsl.in | 22 +-----------
stylesheets/yelp-common.xsl | 51 ---------------------------
stylesheets/yelp-common.xsl.in | 75 ++++++++++++++++++++++++++++++++++++++++
7 files changed, 80 insertions(+), 83 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 445ff4a..5fedf2b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -55,4 +55,5 @@ Makefile.in
/stylesheets/db2html.xsl
/stylesheets/mal2html.xsl
/stylesheets/toc2html.xsl
+/stylesheets/yelp-common.xsl
/tests/test-view
diff --git a/configure.in b/configure.in
index 399dee5..9393e43 100644
--- a/configure.in
+++ b/configure.in
@@ -268,6 +268,7 @@ stylesheets/db2html.xsl
stylesheets/db-title.xsl
stylesheets/mal2html.xsl
stylesheets/toc2html.xsl
+stylesheets/yelp-common.xsl
data/Makefile
data/icons/Makefile
data/icons/hicolor/Makefile
diff --git a/stylesheets/Makefile.am b/stylesheets/Makefile.am
index 09ccf40..d8f0b58 100644
--- a/stylesheets/Makefile.am
+++ b/stylesheets/Makefile.am
@@ -12,4 +12,4 @@ xsl_DATA = \
toc2html.xsl \
yelp-common.xsl
-EXTRA_DIST=$(xsl_DATA) db2html.xsl.in db-title.xsl.in mal2html.xsl.in toc2html.xsl.in
+EXTRA_DIST=$(xsl_DATA) db2html.xsl.in db-title.xsl.in mal2html.xsl.in toc2html.xsl.in yelp-common.xsl.in
diff --git a/stylesheets/db2html.xsl.in b/stylesheets/db2html.xsl.in
index 3b39adb..80e8712 100644
--- a/stylesheets/db2html.xsl.in
+++ b/stylesheets/db2html.xsl.in
@@ -9,9 +9,6 @@
<xsl:include href="yelp-common.xsl"/>
-<xsl:param name="yelp.javascript"/>
-
-
<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'"/>
@@ -74,13 +71,7 @@ FIXME: yelp:cache no longer works
<!-- == db2html.division.head.extra == -->
<xsl:template name="db2html.division.head.extra">
- <xsl:if test="string($yelp.javascript) != ''">
- <script type="text/javascript">
- <xsl:attribute name="src">
- <xsl:value-of select="concat('file://', $yelp.javascript)"/>
- </xsl:attribute>
- </script>
- </xsl:if>
+ <xsl:call-template name="yelp.common.javascript"/>
</xsl:template>
</xsl:stylesheet>
diff --git a/stylesheets/mal2html.xsl.in b/stylesheets/mal2html.xsl.in
index 0794925..bcce8b8 100644
--- a/stylesheets/mal2html.xsl.in
+++ b/stylesheets/mal2html.xsl.in
@@ -14,7 +14,6 @@
<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="''"/>
@@ -96,26 +95,7 @@ body, div.body {
</xsl:template>
<xsl:template name="mal2html.page.head.extra">
-<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"/>
-<script type="text/javascript" language="javascript">
-<xsl:text>
-$(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>'
- }).animate({
- backgroundColor: '</xsl:text><xsl:value-of select="$theme.color.gray_background"/><xsl:text>'
- }, 8000);
- $('#' + location.hash).css({
- backgroundColor: '</xsl:text><xsl:value-of select="$theme.color.yellow_background"/><xsl:text>'
- }).animate({
- backgroundColor: '</xsl:text><xsl:value-of select="$theme.color.background"/><xsl:text>'
- }, 4000);
- }
-});
-</xsl:text>
-</script>
+ <xsl:call-template name="yelp.common.javascript"/>
</xsl:template>
</xsl:stylesheet>
diff --git a/stylesheets/yelp-common.xsl.in b/stylesheets/yelp-common.xsl.in
new file mode 100644
index 0000000..8645b60
--- /dev/null
+++ b/stylesheets/yelp-common.xsl.in
@@ -0,0 +1,75 @@
+<?xml version='1.0' encoding='UTF-8'?><!-- -*- indent-tabs-mode: nil -*- -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns="http://www.w3.org/1999/xhtml"
+ version="1.0">
+
+<xsl:param name="yelp.editor_mode" select="false()"/>
+
+<!-- == yelp.common.css == -->
+<xsl:template name="theme.html.css.custom">
+ <xsl:param name="direction"/>
+ <xsl:param name="left"/>
+ <xsl:param name="right"/>
+<xsl:text>
+html {
+ height: 100%;
+}
+body {
+ padding: 0;
+ background-color: </xsl:text><xsl:value-of select="$theme.color.background"/><xsl:text>;
+ max-width: 100%;
+ border-top: solid 1px </xsl:text>
+ <xsl:value-of select="$theme.color.gray_border"/><xsl:text>;
+}
+div.head {
+ max-width: 100%;
+ width: 100%;
+ padding: 0;
+ margin: 0 0 1em 0;
+}
+div.trails {
+ margin: 0;
+ padding: 0.2em 12px 0 12px;
+ background-color: </xsl:text>
+ <xsl:value-of select="$theme.color.gray_background"/><xsl:text>;
+ border-bottom: solid 1px </xsl:text>
+ <xsl:value-of select="$theme.color.gray_border"/><xsl:text>;
+}
+div.trail {
+ font-size: 1em;
+ margin: 0 1em 0.2em 1em;
+ padding: 0;
+}
+div.body {
+ margin: 0 12px 0 12px;
+ padding: 0;
+ border: none;
+}
+</xsl:text>
+</xsl:template>
+
+<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"/>
+<script type="text/javascript" language="javascript">
+<xsl:text>
+$(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>'
+ }).animate({
+ backgroundColor: '</xsl:text><xsl:value-of select="$theme.color.gray_background"/><xsl:text>'
+ }, 8000);
+ $('#' + location.hash).css({
+ backgroundColor: '</xsl:text><xsl:value-of select="$theme.color.yellow_background"/><xsl:text>'
+ }).animate({
+ backgroundColor: '</xsl:text><xsl:value-of select="$theme.color.background"/><xsl:text>'
+ }, 4000);
+ }
+});
+</xsl:text>
+</script>
+</xsl:template>
+
+
+</xsl:stylesheet>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]