Author: sjur Date: Sat Jan 19 10:17:42 2013 New Revision: 1435515 URL: http://svn.apache.org/viewvc?rev=1435515&view=rev Log: Renamed template name to make its purpose clearer. Added a number of other tests for when a space should NOT be added after a text segment. It should be fairly complete now (but only for the Latin script).
Modified: forrest/trunk/plugins/org.apache.forrest.plugin.input.wiki/resources/chaperon/stylesheets/wiki2xdoc.xsl forrest/trunk/plugins/org.apache.forrest.plugin.input.wiki/status.xml Modified: forrest/trunk/plugins/org.apache.forrest.plugin.input.wiki/resources/chaperon/stylesheets/wiki2xdoc.xsl URL: http://svn.apache.org/viewvc/forrest/trunk/plugins/org.apache.forrest.plugin.input.wiki/resources/chaperon/stylesheets/wiki2xdoc.xsl?rev=1435515&r1=1435514&r2=1435515&view=diff ============================================================================== --- forrest/trunk/plugins/org.apache.forrest.plugin.input.wiki/resources/chaperon/stylesheets/wiki2xdoc.xsl (original) +++ forrest/trunk/plugins/org.apache.forrest.plugin.input.wiki/resources/chaperon/stylesheets/wiki2xdoc.xsl Sat Jan 19 10:17:42 2013 @@ -65,8 +65,10 @@ </xsl:template> <!-- Only add a space if the following char is not a punctuation mark: --> - <xsl:template name="addSpace"> + <xsl:template name="addSpaceAfter"> <xsl:choose> + <!-- Please note that we can't use ends-with() below - it throws an error. + Searches on the 'net indicates it is a bug in the Xslt processor. --> <xsl:when test="starts-with(./following::*[text()],'.') or starts-with(./following::*[text()],',') or starts-with(./following::*[text()],'!') or @@ -74,6 +76,25 @@ starts-with(./following::*[text()],';') or starts-with(./following::*[text()],':') or starts-with(./following::*[text()],'"') or + starts-with(./following::*[text()],'>') or + starts-with(./following::*[text()],'âº') or + starts-with(./following::*[text()],'»') or + starts-with(./following::*[text()],'â') or + starts-with(./following::*[text()],'â') or + starts-with(./following::*[text()],')') or + starts-with(./following::*[text()],'}') or + starts-with(./following::*[text()],']') or + contains(substring(., string-length(. - 1)),'¡') or + contains(substring(., string-length(. - 1)),'¿') or + contains(substring(., string-length(. - 1)),'"') or + contains(substring(., string-length(. - 1)),'<') or + contains(substring(., string-length(. - 1)),'â¹') or + contains(substring(., string-length(. - 1)),'«') or + contains(substring(., string-length(. - 1)),'â') or + contains(substring(., string-length(. - 1)),'â') or + contains(substring(., string-length(. - 1)),'(') or + contains(substring(., string-length(. - 1)),'{') or + contains(substring(., string-length(. - 1)),'[') or ./following::*[1]/st:deftermdefstart"> <xsl:text></xsl:text> </xsl:when> @@ -208,7 +229,7 @@ <xsl:value-of select="."/> </xsl:otherwise> </xsl:choose> - <xsl:call-template name="addSpace"/> + <xsl:call-template name="addSpaceAfter"/> </xsl:template> <xsl:template match="st:deftermdefstart[not(ancestor::st:deflist)]" > @@ -244,7 +265,7 @@ </xsl:call-template> </xsl:otherwise> </xsl:choose> - <xsl:call-template name="addSpace"/> + <xsl:call-template name="addSpaceAfter"/> </xsl:template> <xsl:template name="convertLink" > @@ -301,15 +322,15 @@ </xsl:template> <xsl:template match="st:emblock"><em> <xsl:value-of select="st:text"/></em> - <xsl:call-template name="addSpace"/> + <xsl:call-template name="addSpaceAfter"/> </xsl:template> <xsl:template match="st:strongblock"><strong> <xsl:value-of select="st:text"/></strong> - <xsl:call-template name="addSpace"/> + <xsl:call-template name="addSpaceAfter"/> </xsl:template> <xsl:template match="st:codeblock"><code> <xsl:value-of select="st:text"/></code> - <xsl:call-template name="addSpace"/> + <xsl:call-template name="addSpaceAfter"/> </xsl:template> <!-- Bulleted lists: --> Modified: forrest/trunk/plugins/org.apache.forrest.plugin.input.wiki/status.xml URL: http://svn.apache.org/viewvc/forrest/trunk/plugins/org.apache.forrest.plugin.input.wiki/status.xml?rev=1435515&r1=1435514&r2=1435515&view=diff ============================================================================== --- forrest/trunk/plugins/org.apache.forrest.plugin.input.wiki/status.xml (original) +++ forrest/trunk/plugins/org.apache.forrest.plugin.input.wiki/status.xml Sat Jan 19 10:17:42 2013 @@ -24,6 +24,12 @@ <changes> <release version="0.2-dev" date="not-released"> <action type="fix" context="code" dev="SNM"> + The list of cases for when NOT to add a space after a text segment was + incomplete, thus several constructs contained spaces not in the original + input. Now fixed for all common punctuation in the Latin script. The + list can easily be extended if need be. + </action> + <action type="fix" context="code" dev="SNM"> Corrected a regression introduced in the previous fix. </action> <action type="add" context="code" dev="SNM">