]> granicus.if.org Git - docbook-dsssl/commitdiff
Fixed ticket [#1315]: Add possibility to add a link to mediaobjects
authorThomas Schraitle <tom_schr@web.de>
Fri, 25 Oct 2013 11:04:31 +0000 (11:04 +0000)
committerThomas Schraitle <tom_schr@web.de>
Fri, 25 Oct 2013 11:04:31 +0000 (11:04 +0000)
xsl/html/graphics.xsl
xsl/html/param.ent
xsl/html/param.xweb
xsl/params/link.to.self.for.mediaobject.xml [new file with mode: 0644]
xsl/xhtml-1_1/param.ent
xsl/xhtml-1_1/param.xweb

index ab1230245a276cfc70dc75939b1991cb365fbcf8..669d6732b9f2e13bc1988ecf480dc0da9a0ac57d 100644 (file)
@@ -609,6 +609,18 @@ valign: <xsl:value-of select="@valign"/></xsl:message>
         </object>
       </xsl:when>
       <xsl:otherwise>
+        <xsl:variable name="src">
+          <xsl:choose>
+             <xsl:when test="$img.src.path != '' and
+                             $tag = 'img' and
+                             not(starts-with($output_filename, '/')) and
+                             not(contains($output_filename, '://'))">
+               <xsl:value-of select="$img.src.path"/>
+             </xsl:when>
+           </xsl:choose>
+           <xsl:value-of select="$output_filename"/>
+        </xsl:variable>
+        <xsl:variable name="imgcontents">
         <xsl:element name="{$tag}">
          <xsl:if test="$tag = 'img' and ../../self::imageobjectco">
            <xsl:variable name="mapname">
@@ -635,15 +647,7 @@ valign: <xsl:value-of select="@valign"/></xsl:message>
          </xsl:if>
 
           <xsl:attribute name="src">
-           <xsl:choose>
-             <xsl:when test="$img.src.path != '' and
-                           $tag = 'img' and
-                             not(starts-with($output_filename, '/')) and
-                           not(contains($output_filename, '://'))">
-               <xsl:value-of select="$img.src.path"/>
-             </xsl:when>
-           </xsl:choose>
-            <xsl:value-of select="$output_filename"/>
+            <xsl:value-of select="$src"/>
           </xsl:attribute>
 
           <xsl:if test="@align">
@@ -681,6 +685,18 @@ valign: <xsl:value-of select="@valign"/></xsl:message>
             <xsl:with-param name="viewport" select="$viewport"/>
           </xsl:call-template>
         </xsl:element>
+        </xsl:variable>
+        
+        <xsl:choose>
+          <xsl:when test="$link.to.self.for.mediaobject = 0">
+            <xsl:copy-of select="$imgcontents"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <a href="{$src}">
+              <xsl:copy-of select="$imgcontents"/>
+            </a>
+          </xsl:otherwise>
+        </xsl:choose>
       </xsl:otherwise>
     </xsl:choose>
   </xsl:variable>
index a71c8acc10ae905ce7ce59ede3234978880899bd..42f4e1af95bf3241bdefb3bc804d52d0caa61915 100644 (file)
 <!ENTITY linenumbering.separator SYSTEM "../params/linenumbering.separator.xml">
 <!ENTITY linenumbering.width SYSTEM "../params/linenumbering.width.xml">
 <!ENTITY link.mailto.url SYSTEM "../params/link.mailto.url.xml">
+<!ENTITY link.to.self.for.mediaobject SYSTEM "../params/link.to.self.for.mediaobject.xml">
 <!ENTITY make.graphic.viewport SYSTEM "../params/make.graphic.viewport.xml">
 <!ENTITY make.single.year.ranges SYSTEM "../params/make.single.year.ranges.xml">
 <!ENTITY make.valid.html SYSTEM "../params/make.valid.html.xml">
index 9f2f32eb71f9ae12def99263bef23fe7ad546885..966eddabca272733faebfd2ed845242e5b8674d0 100644 (file)
@@ -293,6 +293,7 @@ $Id$
 &use.embed.for.svg;
 &make.graphic.viewport;
 &preferred.mediaobject.role;
+&link.to.self.for.mediaobject;
 &use.role.for.mediaobject;
 &ignore.image.scaling;
 </reference>
diff --git a/xsl/params/link.to.self.for.mediaobject.xml b/xsl/params/link.to.self.for.mediaobject.xml
new file mode 100644 (file)
index 0000000..8aaeeaf
--- /dev/null
@@ -0,0 +1,40 @@
+<refentry xmlns="http://docbook.org/ns/docbook" 
+          xmlns:xlink="http://www.w3.org/1999/xlink"
+          xmlns:xi="http://www.w3.org/2001/XInclude" 
+          xmlns:src="http://nwalsh.com/xmlns/litprog/fragment"
+          xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+          version="5.0" xml:id="link.to.self.for.mediaobject">
+  <refmeta>
+    <refentrytitle>link.to.self.for.mediaobject</refentrytitle>
+    <refmiscinfo class="other" otherclass="datatype">boolean</refmiscinfo>
+  </refmeta>
+  <refnamediv>
+    <refname>link.to.self.for.mediaobject</refname>
+    <refpurpose>Include <tag>a</tag> element to image objects itself to go to a full-size, freely-zoomable version</refpurpose>
+  </refnamediv>
+
+  <refsynopsisdiv>
+<src:fragment xml:id="link.to.self.for.mediaobject.frag">
+<xsl:param name="link.to.self.for.mediaobject" select="0"/>
+</src:fragment>
+  </refsynopsisdiv>
+
+  <refsection>
+    <info>
+      <title>Description</title>
+    </info>
+    <para>In some cases, it can be very helpful to be able to click on an embedded <tag>figure</tag>
+      or <tag>informalfigure</tag> to get a full-size, freely-zoomable version of an image, for
+      instance when targeting readers on smartphones. This is implemented for images only, but not
+      for audio or video objects. </para>
+        
+    <para>If non-zero, the image will be wrapped in an <tag>a</tag> element, using the <tag class="attribute">href</tag> 
+      attribute pointing to the image itself: </para>
+    <screen>&lt;a href="source/image">
+   &lt;!-- the image object -->
+&lt;/a></screen>
+
+    <para> If the value of <parameter>link.to.self.for.mediaobject.xml</parameter> is zero
+      (default), then no <tag>a</tag> container is added. </para>
+  </refsection>
+</refentry>
index 005e4f693321c020ba71cc791b44a8b76e788667..6ec61b8a0e391fd81b77c88d9224f51671fdb3d7 100644 (file)
 <!ENTITY linenumbering.separator SYSTEM "../params/linenumbering.separator.xml">
 <!ENTITY linenumbering.width SYSTEM "../params/linenumbering.width.xml">
 <!ENTITY link.mailto.url SYSTEM "../params/link.mailto.url.xml">
+<!ENTITY link.to.self.for.mediaobject SYSTEM "../params/link.to.self.for.mediaobject.xml">
 <!ENTITY make.graphic.viewport SYSTEM "../params/make.graphic.viewport.xml">
 <!ENTITY make.single.year.ranges SYSTEM "../params/make.single.year.ranges.xml">
 <!ENTITY make.valid.html SYSTEM "../params/make.valid.html.xml">
 <!ENTITY index.method SYSTEM "../params/index.method.xml">
 <!ENTITY reference.autolabel SYSTEM "../params/reference.autolabel.xml">
 <!ENTITY glossary.sort SYSTEM "../params/glossary.sort.xml">
-<!ENTITY javahelp.encoding SYSTEM "../params/javahelp.encoding.xml">
\ No newline at end of file
+<!ENTITY javahelp.encoding SYSTEM "../params/javahelp.encoding.xml">
index 33d710d4c3b4c0025631f6e43e1e232d4c2c0e4f..94f95d91d4e2848d42f5497bca92e5d083fe8fda 100644 (file)
@@ -276,6 +276,7 @@ $Id: param.xweb 7583 2007-12-03 17:02:33Z mzjn $
 &use.embed.for.svg;
 &make.graphic.viewport;
 &preferred.mediaobject.role;
+&link.to.self.for.mediaobject;
 &use.role.for.mediaobject;
 &ignore.image.scaling;
 </reference>