LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File 1183-erl_docgen-Implement-width-in-image-tag.patch of Package erlang (Project home:Ledest:erlang:20)

From e7f98a17f139865520e3f961e53d4a722b158223 Mon Sep 17 00:00:00 2001
From: Raimo Niskanen <raimo@erlang.org>
Date: Wed, 28 Mar 2018 11:07:28 +0200
Subject: [PATCH 3/9] erl_docgen: Implement width in image tag

---
 lib/erl_docgen/priv/dtd/common.image.dtd  |  4 +++-
 lib/erl_docgen/priv/xsl/db_html.xsl       | 11 +++++++++--
 lib/erl_docgen/priv/xsl/db_pdf.xsl        | 12 +++++++++---
 lib/erl_docgen/priv/xsl/db_pdf_params.xsl |  3 ++-
 4 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/lib/erl_docgen/priv/dtd/common.image.dtd b/lib/erl_docgen/priv/dtd/common.image.dtd
index d97057590e..138da3609b 100644
--- a/lib/erl_docgen/priv/dtd/common.image.dtd
+++ b/lib/erl_docgen/priv/dtd/common.image.dtd
@@ -18,5 +18,7 @@
      $Id$
 -->
 <!ELEMENT image	              (icaption) >
-<!ATTLIST image		      file CDATA #REQUIRED >
+<!ATTLIST image
+	  file CDATA #REQUIRED
+	  width CDATA #IMPLIED >
 <!ELEMENT icaption            (#PCDATA) >
diff --git a/lib/erl_docgen/priv/xsl/db_html.xsl b/lib/erl_docgen/priv/xsl/db_html.xsl
index 5b7eae4f73..d3ca08f393 100644
--- a/lib/erl_docgen/priv/xsl/db_html.xsl
+++ b/lib/erl_docgen/priv/xsl/db_html.xsl
@@ -3,7 +3,7 @@
      #
      # %CopyrightBegin%
      #
-     # Copyright Ericsson AB 2009-2017. All Rights Reserved.
+     # Copyright Ericsson AB 2009-2018. All Rights Reserved.
      #
      # Licensed under the Apache License, Version 2.0 (the "License");
      # you may not use this file except in compliance with the License.
@@ -1214,7 +1214,14 @@
     </xsl:variable>
 
     <div class="doc-image-wrapper">
-      <img alt="IMAGE MISSING" src="{@file}" class="doc-image"/>
+      <xsl:choose>
+	<xsl:when test="@width">
+	  <img alt="IMAGE MISSING" width="{@width}" src="{@file}" class="doc-image"/>
+	</xsl:when>
+	<xsl:otherwise>
+	  <img alt="IMAGE MISSING" src="{@file}" class="doc-image"/>
+	</xsl:otherwise>
+      </xsl:choose>
 
       <xsl:apply-templates>
         <xsl:with-param name="chapnum" select="$chapnum"/>
diff --git a/lib/erl_docgen/priv/xsl/db_pdf.xsl b/lib/erl_docgen/priv/xsl/db_pdf.xsl
index 46de66bcd8..f6c1c2a716 100644
--- a/lib/erl_docgen/priv/xsl/db_pdf.xsl
+++ b/lib/erl_docgen/priv/xsl/db_pdf.xsl
@@ -3,7 +3,7 @@
      #
      # %CopyrightBegin%
      #
-     # Copyright Ericsson AB 2009-2016. All Rights Reserved.
+     # Copyright Ericsson AB 2009-2018. All Rights Reserved.
      #
      # Licensed under the Apache License, Version 2.0 (the "License");
      # you may not use this file except in compliance with the License.
@@ -1649,8 +1649,14 @@
     </xsl:variable>
 
     <fo:block xsl:use-attribute-sets="image">
-      <fo:external-graphic content-width="scale-down-to-fit" inline-progression-dimension.maximum="100%" src="{@file}"/>
-
+      <xsl:choose>
+	<xsl:when test="@width">
+	  <fo:external-graphic content-width="scale-to-fit" width="{@width}" inline-progression-dimension.maximum="100%" src="{@file}"/>
+	</xsl:when>
+	<xsl:otherwise>
+	   <fo:external-graphic content-width="scale-down-to-fit" inline-progression-dimension.maximum="100%" src="{@file}"/>
+	</xsl:otherwise>
+      </xsl:choose>
       <xsl:apply-templates>
         <xsl:with-param name="chapnum" select="$chapnum"/>
         <xsl:with-param name="fignum" select="$fignum"/>
diff --git a/lib/erl_docgen/priv/xsl/db_pdf_params.xsl b/lib/erl_docgen/priv/xsl/db_pdf_params.xsl
index 99da29c2ac..9bfa991b54 100644
--- a/lib/erl_docgen/priv/xsl/db_pdf_params.xsl
+++ b/lib/erl_docgen/priv/xsl/db_pdf_params.xsl
@@ -3,7 +3,7 @@
      #
      # %CopyrightBegin%
      #
-     # Copyright Ericsson AB 2009-2017. All Rights Reserved.
+     # Copyright Ericsson AB 2009-2018. All Rights Reserved.
      #
      # Licensed under the Apache License, Version 2.0 (the "License");
      # you may not use this file except in compliance with the License.
@@ -139,6 +139,7 @@
   <xsl:attribute-set name="image">
     <xsl:attribute name="space-after">0.5em</xsl:attribute>
     <xsl:attribute name="space-before">0.5em</xsl:attribute>
+    <xsl:attribute name="text-align">center</xsl:attribute>
   </xsl:attribute-set>
 
   <xsl:attribute-set name="listblock">
-- 
2.16.3