lib/isodoc/m3aawg/m3aawg.policy.xsl in metanorma-m3aawg-2.1.10 vs lib/isodoc/m3aawg/m3aawg.policy.xsl in metanorma-m3aawg-2.1.11
- old
+ new
@@ -4063,12 +4063,21 @@
</xsl:if>
<xsl:apply-templates/>
</fo:inline>
</xsl:template> <!-- tt -->
+ <xsl:variable name="regex_url_start">^(http://|https://|www\.)?(.*)</xsl:variable>
<xsl:template match="*[local-name()='tt']/text()" priority="2">
- <xsl:call-template name="add_spaces_to_sourcecode"/>
+ <xsl:choose>
+ <xsl:when test="java:replaceAll(java:java.lang.String.new(.), '$2', '') != ''">
+ <!-- url -->
+ <xsl:call-template name="add-zero-spaces-link-java"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:template>
<xsl:template match="*[local-name()='underline']">
<fo:inline text-decoration="underline">
<xsl:apply-templates/>
@@ -4420,12 +4429,15 @@
<xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1')"/>
</xsl:template>
<xsl:template name="add-zero-spaces-link-java">
<xsl:param name="text" select="."/>
+
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$1')"/> <!-- http://. https:// or www. -->
+ <xsl:variable name="url_continue" select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$2')"/>
<!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
- <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |,)','$1')"/>
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/)','$1')"/>
</xsl:template>
<!-- add zero space after dash character (for table's entries) -->
<xsl:template name="add-zero-spaces">
<xsl:param name="text" select="."/>
@@ -8849,10 +8861,10 @@
<xsl:variable name="express_reference_separators">_.\</xsl:variable>
<xsl:variable name="express_reference_characters" select="concat($upper,$lower,'1234567890',$express_reference_separators)"/>
<xsl:variable name="element_name_keep-together_within-line">keep-together_within-line</xsl:variable>
- <xsl:template match="text()[not(ancestor::*[local-name() = 'bibdata'] or ancestor::*[local-name() = 'sourcecode'] or ancestor::*[local-name() = 'math'])]" name="keep_together_standard_number" mode="update_xml_enclose_keep-together_within-line">
+ <xsl:template match="text()[not(ancestor::*[local-name() = 'bibdata'] or ancestor::*[local-name() = 'link'][not(contains(.,' '))] or ancestor::*[local-name() = 'sourcecode'] or ancestor::*[local-name() = 'math'] or starts-with(., 'http://') or starts-with(., 'https://') or starts-with(., 'www.') )]" name="keep_together_standard_number" mode="update_xml_enclose_keep-together_within-line">
<!-- enclose standard's number into tag 'keep-together_within-line' -->
<xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
<xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
<xsl:variable name="tag_keep-together_within-line_close">###/<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
\ No newline at end of file