MPPDF-40 : Use optional id tag for sub/section anchors

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@280081 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
ltheussl committed 2005-09-11 05:21:48 +00:00
1 parent 39eff73d60
commit a7e46d6814
4 files changed
+52 -28

No files matched your search

+26 -23
View File
@@ -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">
+13
View File
@@ -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>
+3
View File
@@ -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>
+10 -5
View File
@@ -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>