Skip to content

Commit 903895a

Browse files
committed
don't duplicate IDs with sameas
1 parent 2d683f5 commit 903895a

3 files changed

Lines changed: 17 additions & 9 deletions

File tree

mei2ly.xsl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1091,7 +1091,15 @@
10911091
</xsl:if>
10921092
<xsl:if test="$useSvgBackend">
10931093
<xsl:text>\tweak output-attributes #&apos;</xsl:text>
1094-
<xsl:call-template name="setSvgAttr" />
1094+
<xsl:choose>
1095+
<xsl:when test="ancestor::mei:staff/descendant::mei:rest/@sameas = $restKey">
1096+
<!-- no IDs -->
1097+
<xsl:text>((class . rest)) </xsl:text>
1098+
</xsl:when>
1099+
<xsl:otherwise>
1100+
<xsl:call-template name="setSvgAttr" />
1101+
</xsl:otherwise>
1102+
</xsl:choose>
10951103
</xsl:if>
10961104
<xsl:if test="@color">
10971105
<xsl:text>\tweak color #</xsl:text>

tests/merging-rests.mei

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@
4444
<staff n="1">
4545
<layer n="1">
4646
<rest dur="4" xml:id="rest01a" />
47-
<rest dur="4" sameas="#rest02b" />
47+
<rest dur="4" sameas="#rest02b" xml:id="rest01b" />
4848
<rest dur="4" xml:id="rest01c" />
4949
</layer>
5050
<layer n="2">
51-
<rest sameas="#rest01a" />
51+
<rest sameas="#rest01a" xml:id="rest02a" />
5252
<rest dur="4" xml:id="rest02b" loc="6" color="gray"/>
5353
<rest dur="4" xml:id="rest02c" />
5454
</layer>

tests/merging-rests.preview.svg

Lines changed: 6 additions & 6 deletions
Loading

0 commit comments

Comments
 (0)