mirror of
https://github.com/moparisthebest/xeps
synced 2024-11-28 04:02:20 -05:00
Remove duplicates from ‘Notes’ section in XHTML rendered XEPs
Test-Information: Tested on a single XEP that it works as expected. Repeated notes get the same note number and the notes section only mentions each note once.
This commit is contained in:
parent
92d9bbc899
commit
de06827d21
42
xep.xsl
42
xep.xsl
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
Copyright (c) 1999 - 2015 XMPP Standards Foundation
|
Copyright (c) 1999 - 2017 XMPP Standards Foundation
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any
|
Permission is hereby granted, free of charge, to any
|
||||||
person obtaining a copy of this software and
|
person obtaining a copy of this software and
|
||||||
@ -396,9 +396,21 @@ OR OTHER DEALINGS IN THE SOFTWARE.
|
|||||||
<!-- NOTES -->
|
<!-- NOTES -->
|
||||||
<a name="appendix-notes"></a>
|
<a name="appendix-notes"></a>
|
||||||
<h3>Appendix G: Notes</h3>
|
<h3>Appendix G: Notes</h3>
|
||||||
<div class='indent'>
|
<div class='indent'>
|
||||||
<xsl:apply-templates select='//note' mode='endlist'/>
|
<xsl:for-each select="//note">
|
||||||
</div>
|
<xsl:variable name='me' select='.' />
|
||||||
|
<xsl:variable name='firstOccurrence' select='(//note[. = $me])[1]' />
|
||||||
|
<xsl:variable name='oid' select='generate-id($firstOccurrence)' />
|
||||||
|
<xsl:variable name='notenum' select='count($firstOccurrence/preceding::note[not(.=preceding::note)])+1' />
|
||||||
|
<xsl:if test='generate-id($me) = generate-id($firstOccurrence)'>
|
||||||
|
<p>
|
||||||
|
<a name='nt-{$oid}'><xsl:value-of select='$notenum'/></a>
|
||||||
|
<xsl:text>. </xsl:text>
|
||||||
|
<xsl:apply-templates/>
|
||||||
|
</p>
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:for-each>
|
||||||
|
</div>
|
||||||
<!-- REVISION HISTORY -->
|
<!-- REVISION HISTORY -->
|
||||||
<hr />
|
<hr />
|
||||||
<a name="appendix-revs"></a>
|
<a name="appendix-revs"></a>
|
||||||
@ -977,29 +989,17 @@ OR OTHER DEALINGS IN THE SOFTWARE.
|
|||||||
</dd>
|
</dd>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
|
||||||
<xsl:template match='note'>
|
<xsl:template match='note'>
|
||||||
<xsl:variable name='notenum'>
|
<xsl:variable name='me' select='.' />
|
||||||
<xsl:number level='any' count='note'/>
|
<xsl:variable name='firstOccurrence' select='(//note[. = $me])[1]' />
|
||||||
</xsl:variable>
|
<xsl:variable name='oid' select='generate-id($firstOccurrence)' />
|
||||||
<xsl:variable name='oid'>
|
<xsl:variable name='notenum' select='count($firstOccurrence/preceding::note[not(.=preceding::note)])+1' />
|
||||||
<xsl:call-template name='object.id'/>
|
|
||||||
</xsl:variable>
|
|
||||||
<xsl:text> [</xsl:text><a href='#nt-{$oid}'>
|
<xsl:text> [</xsl:text><a href='#nt-{$oid}'>
|
||||||
<xsl:value-of select='$notenum'/></a>
|
<xsl:value-of select='$notenum'/></a>
|
||||||
<xsl:text>]</xsl:text>
|
<xsl:text>]</xsl:text>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match='note' mode='endlist'>
|
|
||||||
<p>
|
|
||||||
<xsl:variable name='oid'>
|
|
||||||
<xsl:call-template name='object.id'/>
|
|
||||||
</xsl:variable>
|
|
||||||
<a name='nt-{$oid}'><xsl:value-of select='position()'/></a>
|
|
||||||
<xsl:text>. </xsl:text>
|
|
||||||
<xsl:apply-templates/>
|
|
||||||
</p>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
<!-- PRESENTATIONAL ELEMENTS -->
|
<!-- PRESENTATIONAL ELEMENTS -->
|
||||||
|
|
||||||
<xsl:template match='blockquote'>
|
<xsl:template match='blockquote'>
|
||||||
|
Loading…
Reference in New Issue
Block a user