You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by lt...@apache.org on 2005/09/11 07:21:51 UTC

svn commit: r280081 - in /maven/maven-1/plugins/trunk/pdf: src/plugin-resources/fo-body.xslt src/plugin-test/test02/xdocs/test.xml xdocs/changes.xml xdocs/index.xml

Author: ltheussl
Date: Sat Sep 10 22:21:48 2005
New Revision: 280081

URL: http://svn.apache.org/viewcvs?rev=280081&view=rev
Log:
MPPDF-40 : Use optional id tag for sub/section anchors

Modified:
    maven/maven-1/plugins/trunk/pdf/src/plugin-resources/fo-body.xslt
    maven/maven-1/plugins/trunk/pdf/src/plugin-test/test02/xdocs/test.xml
    maven/maven-1/plugins/trunk/pdf/xdocs/changes.xml
    maven/maven-1/plugins/trunk/pdf/xdocs/index.xml

Modified: maven/maven-1/plugins/trunk/pdf/src/plugin-resources/fo-body.xslt
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/pdf/src/plugin-resources/fo-body.xslt?rev=280081&r1=280080&r2=280081&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/pdf/src/plugin-resources/fo-body.xslt (original)
+++ maven/maven-1/plugins/trunk/pdf/src/plugin-resources/fo-body.xslt Sat Sep 10 22:21:48 2005
@@ -103,14 +103,19 @@
   <xsl:template match="section">
     <xsl:param name="chapterNumber"/>
     <xsl:param name="fileName"/>
-    <xsl:param name="transLink">
-      <xsl:call-template name="escapeNameToken">
-        <xsl:with-param name="oldString" select="@name"/>
-      </xsl:call-template>
-    </xsl:param>
-    <fo:block xsl:use-attribute-sets="body.h1" id="{$fileName}#{$transLink}">
-      <xsl:value-of select="@name"/>
-    </fo:block>
+    <!-- Generate anchor only if id tag exists -->
+    <xsl:choose>
+      <xsl:when test="@id">
+        <fo:block xsl:use-attribute-sets="body.h1" id="{$fileName}#{@id}">
+          <xsl:value-of select="@name"/>
+        </fo:block>
+      </xsl:when>
+      <xsl:otherwise>
+        <fo:block xsl:use-attribute-sets="body.h1">
+          <xsl:value-of select="@name"/>
+        </fo:block>
+      </xsl:otherwise>
+    </xsl:choose>
     <fo:block xsl:use-attribute-sets="body.text">
       <xsl:apply-templates>
         <xsl:with-param name="chapterNumber">
@@ -122,24 +127,22 @@
       </xsl:apply-templates>
     </fo:block>
   </xsl:template>
-  <xsl:template name="escapeNameToken">
-    <!-- Same transformation as done by the escapeNameToken tag of xdoc -->
-    <xsl:param name="oldString"/>
-    <xsl:variable name="replaceChars"> .,;!?/'\()[]{}+*°</xsl:variable>
-    <xsl:variable name="replaceWith">___________________</xsl:variable>
-    <xsl:value-of select="translate($oldString,$replaceChars,$replaceWith)"/>
-  </xsl:template>
   <xsl:template match="subsection">
     <xsl:param name="chapterNumber"/>
     <xsl:param name="fileName"/>
-    <xsl:param name="transLink">
-      <xsl:call-template name="escapeNameToken">
-        <xsl:with-param name="oldString" select="@name"/>
-      </xsl:call-template>
-    </xsl:param>
-    <fo:block xsl:use-attribute-sets="body.h2" id="{$fileName}#{$transLink}">
-      <xsl:value-of select="@name"/>
-    </fo:block>
+    <!-- Generate anchor only if id tag exists -->
+    <xsl:choose>
+      <xsl:when test="@id">
+        <fo:block xsl:use-attribute-sets="body.h2" id="{$fileName}#{@id}">
+          <xsl:value-of select="@name"/>
+        </fo:block>
+      </xsl:when>
+      <xsl:otherwise>
+        <fo:block xsl:use-attribute-sets="body.h2">
+          <xsl:value-of select="@name"/>
+        </fo:block>
+      </xsl:otherwise>
+    </xsl:choose>
     <fo:block xsl:use-attribute-sets="body.text">
       <xsl:apply-templates>
         <xsl:with-param name="chapterNumber">

Modified: maven/maven-1/plugins/trunk/pdf/src/plugin-test/test02/xdocs/test.xml
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/pdf/src/plugin-test/test02/xdocs/test.xml?rev=280081&r1=280080&r2=280081&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/pdf/src/plugin-test/test02/xdocs/test.xml (original)
+++ maven/maven-1/plugins/trunk/pdf/src/plugin-test/test02/xdocs/test.xml Sat Sep 10 22:21:48 2005
@@ -97,5 +97,18 @@
         </p>
       </subsection>
     </section>
+    <section name="Test for MPPDF-40" id="sec1">
+      <subsection name="Identical names" id="subsec1">
+        <p>This subsection has an <code>id="subsec1"</code> tag.</p>
+      </subsection>
+    </section>
+    <section name="Test for MPPDF-40" id="sec2">
+      <subsection name="Identical names" id="subsec2">
+        <p>This subsection has an <code>id="subsec2"</code> tag.</p>
+        <p>
+          Here's a <a href="#subsec1">link</a> to the previous subsetion.
+        </p>
+      </subsection>
+    </section>
   </body>
 </document>

Modified: maven/maven-1/plugins/trunk/pdf/xdocs/changes.xml
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/pdf/xdocs/changes.xml?rev=280081&r1=280080&r2=280081&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/pdf/xdocs/changes.xml (original)
+++ maven/maven-1/plugins/trunk/pdf/xdocs/changes.xml Sat Sep 10 22:21:48 2005
@@ -24,6 +24,9 @@
     <author email="aheritier@apache.org">Arnaud Heritier</author>
   </properties>
   <body>
+    <release version="2.5-SNAPSHOT" date="in SVN">
+      <action dev="ltheussl" type="fix" issue="MPPDF-40">Use optional id tag for sub/section anchors to avoid problems with identical names.</action>
+    </release>
     <release version="2.4" date="2005-09-05">
       <action dev="aheritier" type="update">Make the plugin compatible with maven 1.0 and jdk 1.3/1.4/1.5 or with maven 1.1 and jdk 1.4/1.5.</action>
       <action dev="aheritier" type="fix" issue="MPPDF-43" due-to="Lukas Theussl">sub-/superscripts do not work.</action>

Modified: maven/maven-1/plugins/trunk/pdf/xdocs/index.xml
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/pdf/xdocs/index.xml?rev=280081&r1=280080&r2=280081&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/pdf/xdocs/index.xml (original)
+++ maven/maven-1/plugins/trunk/pdf/xdocs/index.xml Sat Sep 10 22:21:48 2005
@@ -43,17 +43,22 @@
     <section name="Known issues">
       <ul>
         <li>
-          <p>There is a known problem with the PDF generation tool (Apache's FOP) in that it doesn't allow for table structures with automatic column widths to be generated. Widths are uniformly distributed.</p>
+          There is a known problem with the PDF generation tool (Apache's FOP) in that it doesn't allow for table structures with automatic column widths to be generated. Widths are uniformly distributed.
         </li>
         <li>
-          <p>Due to several problems, it is actually impossible to reference the same file in different items in navigation.xml. You must define another navigation file (using the property <a href="properties.html">"maven.pdf.navigationFile"</a>) which you'll use only with the PDF plug-in. This navigation cannot define several items with the same href.</p>
+          Due to several problems, it is actually impossible to reference the same file in different items in navigation.xml. You must define another navigation file (using the property <a href="properties.html">"maven.pdf.navigationFile"</a>) which you'll use only with the PDF plug-in. This navigation cannot define several items with the same href.
         </li>
         <li>
-          <p>Identical <code>name</code> or <code>id</code> attributes within one document will lead to a build failure. Note in particular that in the current version of the pdf plugin, id's are constructed from sub/section names (in analogy to the xdoc plugin), so identical titles for sections or subsections will make the pdf generation fail. See <a href="http://jira.codehaus.org/browse/MPPDF-40">MPPDF-40</a>.
-          </p>
+          Identical <code>id</code> attributes within one document will lead to a build failure.
         </li>
         <li>
-          <p>Other issues are available in <a href="http://jira.codehaus.org/secure/IssueNavigator.jspa?reset=true&amp;pid=10356&amp;statusIds=1" target="_blank">Jira</a>.</p>
+          Contrary to the xdoc plugin, the pdf plugin does not generate
+          anchors from section or subsection names. If you want to reference
+          a section or subsection you have to use the optional
+          <code>id</code> tag.
+        </li>
+        <li>
+          Other issues are available in <a href="http://jira.codehaus.org/secure/IssueNavigator.jspa?reset=true&amp;pid=10356&amp;statusIds=1" target="_blank">Jira</a>.
         </li>
       </ul>
     </section>



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org