-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
convert nbsp and nbhy to span elements with white-space: nowrap
- Loading branch information
Showing
2 changed files
with
106 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
XSLT transformation for the XML format defined in RFCs 2629, 7749 and 7991 | ||
to HTML | ||
|
||
Copyright (c) 2006-2023, Julian Reschke ([email protected]) | ||
Copyright (c) 2006-2024, Julian Reschke ([email protected]) | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
|
@@ -1694,7 +1694,16 @@ | |
<xsl:text> </xsl:text> | ||
</xsl:if> | ||
</xsl:if> | ||
<xsl:value-of select="$normalized"/> | ||
<xsl:choose> | ||
<xsl:when test="contains($normalized,' ') or contains($normalized,'‑')"> | ||
<xsl:call-template name="emit-words"> | ||
<xsl:with-param name="text" select="$normalized"/> | ||
</xsl:call-template> | ||
</xsl:when> | ||
<xsl:otherwise> | ||
<xsl:value-of select="$normalized"/> | ||
</xsl:otherwise> | ||
</xsl:choose> | ||
<xsl:if test="$ends-with-ws and $normalized!=''"> | ||
<xsl:variable name="t"> | ||
<xsl:for-each select="following-sibling::node()"> | ||
|
@@ -1716,6 +1725,41 @@ | |
</xsl:if> | ||
</xsl:template> | ||
|
||
<!-- emit one word at a time --> | ||
<xsl:template name="emit-words"> | ||
<xsl:param name="text"/> | ||
<xsl:choose> | ||
<xsl:when test="contains($text,' ')"> | ||
<xsl:call-template name="emit-word"> | ||
<xsl:with-param name="word" select="substring-before($text,' ')"/> | ||
</xsl:call-template> | ||
<xsl:text> </xsl:text> | ||
<xsl:call-template name="emit-words"> | ||
<xsl:with-param name="text" select="substring-after($text,' ')"/> | ||
</xsl:call-template> | ||
</xsl:when> | ||
<xsl:otherwise> | ||
<xsl:call-template name="emit-word"> | ||
<xsl:with-param name="word" select="$text"/> | ||
</xsl:call-template> | ||
</xsl:otherwise> | ||
</xsl:choose> | ||
</xsl:template> | ||
|
||
<!-- emit word, potentially wrapping into span/nobr and replacing 'special' characters --> | ||
<xsl:template name="emit-word"> | ||
<xsl:param name="word"/> | ||
<xsl:choose> | ||
<xsl:when test="contains($word,' ') or contains($word,'‑')"> | ||
<span class="nobr"> | ||
<xsl:value-of select="translate($word,' ‑',' -')"/> | ||
</span> | ||
</xsl:when> | ||
<xsl:otherwise> | ||
<xsl:value-of select="$word"/> | ||
</xsl:otherwise> | ||
</xsl:choose> | ||
</xsl:template> | ||
|
||
<xsl:template match="abstract"> | ||
<xsl:call-template name="check-no-text-content"/> | ||
|
@@ -8630,6 +8674,9 @@ ul p { | |
.filename, h1, h2, h3, h4 { | ||
font-family: <xsl:value-of select="$xml2rfc-ext-ff-title"/>; | ||
} | ||
.nobr { | ||
white-space: nowrap; | ||
} | ||
<xsl:if test="$has-index">ul.ind, ul.ind ul { | ||
list-style: none; | ||
margin-left: 1.5em; | ||
|
@@ -12226,11 +12273,11 @@ dd, li, p { | |
<xsl:variable name="gen"> | ||
<xsl:text>http://greenbytes.de/tech/webdav/rfcxml.xslt, </xsl:text> | ||
<!-- when RCS keyword substitution in place, add version info --> | ||
<xsl:if test="contains('$Revision: 1.1563 $',':')"> | ||
<xsl:value-of select="concat('Revision ',normalize-space(translate(substring-after('$Revision: 1.1563 $', 'Revision: '),'$','')),', ')" /> | ||
<xsl:if test="contains('$Revision: 1.1564 $',':')"> | ||
<xsl:value-of select="concat('Revision ',normalize-space(translate(substring-after('$Revision: 1.1564 $', 'Revision: '),'$','')),', ')" /> | ||
</xsl:if> | ||
<xsl:if test="contains('$Date: 2024/04/10 17:12:02 $',':')"> | ||
<xsl:value-of select="concat(normalize-space(translate(substring-after('$Date: 2024/04/10 17:12:02 $', 'Date: '),'$','')),', ')" /> | ||
<xsl:if test="contains('$Date: 2024/04/10 17:40:21 $',':')"> | ||
<xsl:value-of select="concat(normalize-space(translate(substring-after('$Date: 2024/04/10 17:40:21 $', 'Date: '),'$','')),', ')" /> | ||
</xsl:if> | ||
<xsl:variable name="product" select="normalize-space(concat(system-property('xsl:product-name'),' ',system-property('xsl:product-version')))"/> | ||
<xsl:if test="$product!=''"> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
XSLT transformation for the XML format defined in RFCs 2629, 7749 and 7991 | ||
to HTML | ||
|
||
Copyright (c) 2006-2023, Julian Reschke ([email protected]) | ||
Copyright (c) 2006-2024, Julian Reschke ([email protected]) | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
|
@@ -1694,7 +1694,16 @@ | |
<xsl:text> </xsl:text> | ||
</xsl:if> | ||
</xsl:if> | ||
<xsl:value-of select="$normalized"/> | ||
<xsl:choose> | ||
<xsl:when test="contains($normalized,' ') or contains($normalized,'‑')"> | ||
<xsl:call-template name="emit-words"> | ||
<xsl:with-param name="text" select="$normalized"/> | ||
</xsl:call-template> | ||
</xsl:when> | ||
<xsl:otherwise> | ||
<xsl:value-of select="$normalized"/> | ||
</xsl:otherwise> | ||
</xsl:choose> | ||
<xsl:if test="$ends-with-ws and $normalized!=''"> | ||
<xsl:variable name="t"> | ||
<xsl:for-each select="following-sibling::node()"> | ||
|
@@ -1716,6 +1725,41 @@ | |
</xsl:if> | ||
</xsl:template> | ||
|
||
<!-- emit one word at a time --> | ||
<xsl:template name="emit-words"> | ||
<xsl:param name="text"/> | ||
<xsl:choose> | ||
<xsl:when test="contains($text,' ')"> | ||
<xsl:call-template name="emit-word"> | ||
<xsl:with-param name="word" select="substring-before($text,' ')"/> | ||
</xsl:call-template> | ||
<xsl:text> </xsl:text> | ||
<xsl:call-template name="emit-words"> | ||
<xsl:with-param name="text" select="substring-after($text,' ')"/> | ||
</xsl:call-template> | ||
</xsl:when> | ||
<xsl:otherwise> | ||
<xsl:call-template name="emit-word"> | ||
<xsl:with-param name="word" select="$text"/> | ||
</xsl:call-template> | ||
</xsl:otherwise> | ||
</xsl:choose> | ||
</xsl:template> | ||
|
||
<!-- emit word, potentially wrapping into span/nobr and replacing 'special' characters --> | ||
<xsl:template name="emit-word"> | ||
<xsl:param name="word"/> | ||
<xsl:choose> | ||
<xsl:when test="contains($word,' ') or contains($word,'‑')"> | ||
<span class="nobr"> | ||
<xsl:value-of select="translate($word,' ‑',' -')"/> | ||
</span> | ||
</xsl:when> | ||
<xsl:otherwise> | ||
<xsl:value-of select="$word"/> | ||
</xsl:otherwise> | ||
</xsl:choose> | ||
</xsl:template> | ||
|
||
<xsl:template match="abstract"> | ||
<xsl:call-template name="check-no-text-content"/> | ||
|
@@ -8630,6 +8674,9 @@ ul p { | |
.filename, h1, h2, h3, h4 { | ||
font-family: <xsl:value-of select="$xml2rfc-ext-ff-title"/>; | ||
} | ||
.nobr { | ||
white-space: nowrap; | ||
} | ||
<xsl:if test="$has-index">ul.ind, ul.ind ul { | ||
list-style: none; | ||
margin-left: 1.5em; | ||
|
@@ -12226,11 +12273,11 @@ dd, li, p { | |
<xsl:variable name="gen"> | ||
<xsl:text>http://greenbytes.de/tech/webdav/rfcxml.xslt, </xsl:text> | ||
<!-- when RCS keyword substitution in place, add version info --> | ||
<xsl:if test="contains('$Revision: 1.1468 $',':')"> | ||
<xsl:value-of select="concat('Revision ',normalize-space(translate(substring-after('$Revision: 1.1468 $', 'Revision: '),'$','')),', ')" /> | ||
<xsl:if test="contains('$Revision: 1.1469 $',':')"> | ||
<xsl:value-of select="concat('Revision ',normalize-space(translate(substring-after('$Revision: 1.1469 $', 'Revision: '),'$','')),', ')" /> | ||
</xsl:if> | ||
<xsl:if test="contains('$Date: 2024/02/07 17:33:38 $',':')"> | ||
<xsl:value-of select="concat(normalize-space(translate(substring-after('$Date: 2024/02/07 17:33:38 $', 'Date: '),'$','')),', ')" /> | ||
<xsl:if test="contains('$Date: 2024/04/10 17:40:38 $',':')"> | ||
<xsl:value-of select="concat(normalize-space(translate(substring-after('$Date: 2024/04/10 17:40:38 $', 'Date: '),'$','')),', ')" /> | ||
</xsl:if> | ||
<xsl:variable name="product" select="normalize-space(concat(system-property('xsl:product-name'),' ',system-property('xsl:product-version')))"/> | ||
<xsl:if test="$product!=''"> | ||
|