[gimp-help-2] Enable to use floating images in HTML



commit 4b440a5158235c6718eaaac63f6b87a7b642fccd
Author: Ulf-D. Ehlert <ulfehlert svn gnome org>
Date:   Sun Nov 21 20:44:49 2010 +0100

    Enable to use floating images in HTML
    
    Add an XSL stylesheet that passes 'condition="float"' attributes
    of <inlinemediaobjects> or <mediaobjects> without <caption> as
    class attributes to HTML. Modify CSS stylesheets to make those
    images float.

 stylesheets/float-images.xsl     |   37 +++++++++++++++++++++++++++++++++++++
 stylesheets/gimp-help-screen.css |   10 ++++++++++
 stylesheets/gimp22.css           |   10 ++++++++++
 stylesheets/plainhtml.xsl.in     |    1 +
 4 files changed, 58 insertions(+), 0 deletions(-)
---
diff --git a/stylesheets/float-images.xsl b/stylesheets/float-images.xsl
new file mode 100644
index 0000000..85eedf6
--- /dev/null
+++ b/stylesheets/float-images.xsl
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Customized docbook-xsl template to generate an additional class
+    value for (inline)mediaobjects with condition attribute "float"
+
+    This file is part of the gimp-help-2 project.
+    You may use this file in accordance to the GNU General Public License
+    Version 2 which is available from http://www.gnu.org.
+-->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
+                xmlns="http://www.w3.org/1999/xhtml";
+                version="1.0">
+
+  <!-- The new class value, to be used via CSS stylesheets -->
+  <xsl:param name="float-attribute">float-img</xsl:param>
+
+  <!-- This is a customized version of the docbook-xsl-1.75.2 template
+       (.../xhtml/html.xsl) -->
+  <xsl:template match="inlinemediaobject[ condition='float'] |
+                       mediaobject[ condition='float']"
+                mode="class.value">
+    <xsl:param name="class" select="local-name(.)"/>
+    <xsl:choose>
+      <xsl:when test="caption">
+        <xsl:message>
+          <xsl:text>Warning: Ignoring 'condition="float"' of mediaobject w/ caption</xsl:text>
+        </xsl:message>
+        <xsl:value-of select="$class"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="concat($class, ' ', $float-attribute)"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+</xsl:stylesheet>
diff --git a/stylesheets/gimp-help-screen.css b/stylesheets/gimp-help-screen.css
index f815cad..e9607ca 100644
--- a/stylesheets/gimp-help-screen.css
+++ b/stylesheets/gimp-help-screen.css
@@ -198,6 +198,16 @@ img {
   display: table-cell;
   padding: 0.5em;
 }
+/*
+ * floating images
+ */
+.float-img {
+  float:   right;
+  display: block;
+  margin:  0.5em 0.25em 0.5em 1.0em;
+  padding: 0;
+  width:   auto;
+}
 ul {
   padding: 0 0 0 1.5em;
 }
diff --git a/stylesheets/gimp22.css b/stylesheets/gimp22.css
index ccafd84..8d36328 100644
--- a/stylesheets/gimp22.css
+++ b/stylesheets/gimp22.css
@@ -185,6 +185,16 @@
 		display: table-cell;
 		padding: 0.5em;
 	}
+	/*
+	 * floating images
+	 */
+	.float-img {
+		float:   right;
+		display: block;
+		margin:  0.5em 0.25em 0.5em 1.0em;
+		padding: 0;
+		width:   auto;
+	}
 	ul {
 		padding: 0 0 0 1.5em;
 	}
diff --git a/stylesheets/plainhtml.xsl.in b/stylesheets/plainhtml.xsl.in
index 39e967d..354f6e7 100644
--- a/stylesheets/plainhtml.xsl.in
+++ b/stylesheets/plainhtml.xsl.in
@@ -8,6 +8,7 @@
     xmlns="http://www.w3.org/1999/xhtml";>
 
   <xsl:import href="@STYLEBASE@/xhtml/chunk.xsl" />
+  <xsl:import href="float-images.xsl" />
   <xsl:include href="htmlalternate.xsl" />
 
   <xsl:param name="admon.graphics" select="1" />



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]