mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 00:14:32 +09:00
man: handle leading/trailing/repeating whitespaces in anchor links
So even if a <term> section contains newlines, we get a reasonable anchor link to it. Before: <dt id=" bind UNIT PATH [PATH] "><span class="term"> ... <a class="headerlink" title="Permalink to this term" href="#%0A%20%20%20%20%20%20%20%20%20%20%20%20bind%0A%20%20%20%20%20%20%20%20%20%20%20%20UNIT%0A%20%20%20%20%20%20%20%20%20%20%20%20PATH%0A%20%20%20%20%20%20%20%20%20%20%20%20[PATH]%0A%20%20%20%20%20%20%20%20%20%20">¶</a> After: <dt id="bind UNIT PATH [PATH]"><span class="term"> ... <a class="headerlink" title="Permalink to this term" href="#bind%20UNIT%20PATH%20[PATH]">¶</a> Resolves: #39196
This commit is contained in:
@@ -158,6 +158,8 @@
|
||||
<xsl:param name="keyNode"/>
|
||||
<!-- suggested value for generatedID output, a contextually meaningful ID string -->
|
||||
<xsl:param name="templateID"/>
|
||||
<!-- Strip leading and trailing whitespaces, and replace repeating whitespaces with a single space -->
|
||||
<xsl:variable name="normalizedID" select="normalize-space($templateID)"/>
|
||||
<xsl:variable name="conflictSource" select="preceding::refsect1/title|preceding::refsect1/info/title|
|
||||
preceding::refsect2/title|preceding::refsect2/info/title|
|
||||
preceding::varlistentry/term[1]"/>
|
||||
@@ -165,10 +167,10 @@
|
||||
<xsl:choose>
|
||||
<!-- special case conflictCount = 0 to preserve compatibility with URLs generated by previous versions of this XSL stylesheet where possible -->
|
||||
<xsl:when test="$conflictCount = 0">
|
||||
<xsl:value-of select="$templateID"/>
|
||||
<xsl:value-of select="$normalizedID"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="concat($templateID, $conflictCount)"/>
|
||||
<xsl:value-of select="concat($normalizedID, $conflictCount)"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
Reference in New Issue
Block a user