Skip to content

Commit

Permalink
add support for dots.ges
Browse files Browse the repository at this point in the history
  • Loading branch information
rettinghaus committed Apr 9, 2020
1 parent 6ced65d commit 5c16b53
Show file tree
Hide file tree
Showing 6 changed files with 137 additions and 4 deletions.
13 changes: 11 additions & 2 deletions mei2ly.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -920,6 +920,9 @@
<xsl:if test="@head.visible = false()">
<xsl:text>\tweak transparent ##t </xsl:text>
</xsl:if>
<xsl:if test="@dots.ges">
<xsl:value-of select="concat('\tweak Dots.dot-count #', number(@dots), ' ')" />
</xsl:if>
<xsl:if test="following-sibling::*[1]/@attach = 'pre'">
<xsl:text>\afterGrace </xsl:text>
</xsl:if>
Expand Down Expand Up @@ -1049,6 +1052,9 @@
<xsl:value-of select="'\once \override Stem.color = #'" />
<xsl:call-template name="setColor" />
</xsl:if>
<xsl:if test="@dots.ges">
<xsl:value-of select="concat('\once \override Dots.dot-count = #', number(@dots), ' ')" />
</xsl:if>
<xsl:text>&lt; </xsl:text>
<xsl:if test="@stem.mod = '1slash'">
<xsl:text>\tweak Flag.stroke-style #"grace" </xsl:text>
Expand Down Expand Up @@ -1172,6 +1178,9 @@
<xsl:call-template name="setOffset" />
</xsl:if>
</xsl:if>
<xsl:if test="@dots.ges">
<xsl:value-of select="concat('\tweak Dots.dot-count #', number(@dots), ' ')" />
</xsl:if>
<xsl:if test="not(@*[contains(name(), 'loc')]) and (ancestor::mei:staff/descendant::mei:rest/@sameas = $restKey)">
<xsl:text>\tweak staff-position #0 </xsl:text>
</xsl:if>
Expand Down Expand Up @@ -3177,8 +3186,8 @@
</xsl:template>
<!-- set dots -->
<xsl:template name="setDots">
<xsl:param name="dots" select="@dots" />
<xsl:if test="number($dots) gt 0">
<xsl:param name="dots" select="if (not(@dots.ges)) then xs:integer(@dots) else xs:integer(@dots.ges)" />
<xsl:if test="$dots gt 0">
<xsl:text>.</xsl:text>
<xsl:call-template name="setDots">
<xsl:with-param name="dots" select="$dots - 1" />
Expand Down
2 changes: 2 additions & 0 deletions tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ This is an autogenerated overview of the testfiles.
![gracenotes.mei](gracenotes.preview.png)
### [noteheads.mei](noteheads.mei)
![noteheads.mei](noteheads.preview.png)
### [dots.mei](dots.mei)
![dots.mei](dots.preview.png)

Rendered with GNU LilyPond 2.20.0.
All test files are licensed under a [Creative Commons Attribution 4.0 International License](http://creativecommons.org/licenses/by/4.0/).
56 changes: 56 additions & 0 deletions tests/dots.mei
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="https://music-encoding.org/schema/4.0.0/mei-all.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?>
<mei xmlns="http://www.music-encoding.org/ns/mei" meiversion="4.0.0">
<meiHead>
<fileDesc>
<titleStmt>
<title>Visible and invisible dots</title>
</titleStmt>
<pubStmt>
<respStmt>
<persName>Klaus Rettinghaus</persName>
</respStmt>
</pubStmt>
<seriesStmt>
<title>MEILER test files</title>
</seriesStmt>
</fileDesc>
</meiHead>
<music>
<body>
<mdiv>
<score>
<scoreDef system.leftline="false">
<staffGrp>
<staffDef clef.shape="G" clef.line="2" n="1" lines="5">
<meterSig count="9" unit="8"/>
</staffDef>
</staffGrp>
</scoreDef>
<section>
<measure n="1">
<staff n="1">
<layer n="1">
<note dur="4" dots.ges="1" oct="4" pname="b" />
<note dur="4" dots="3" dots.ges="1" oct="4" pname="b" />
<note dur="4" dots="1" oct="4" pname="b" />
</layer>
</staff>
</measure>
<measure n="1" metcon="false" right="end">
<staff n="1">
<layer n="1">
<chord dur="2" dots="4" dots.ges="1">
<note oct="4" pname="b" />
<note oct="4" pname="g" dots="3" dots.ges="1" />
<note oct="4" pname="e" dots="2" dots.ges="1" />
</chord>
</layer>
</staff>
</measure>
</section>
</score>
</mdiv>
</body>
</music>
</mei>
Binary file added tests/dots.preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
66 changes: 66 additions & 0 deletions tests/dots.preview.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions tests/merging-rests.mei
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@
<mRest xml:id="mrest01" />
</layer>
<layer n="2">
<mRest sameas="#mrest01" xml:id="mrest02" />
<mRest xml:id="mrest02" sameas="#mrest01" />
</layer>
<layer n="3">
<mRest sameas="#mrest02" xml:id="mrest03" />
<mRest xml:id="mrest03" sameas="#mrest02" />
</layer>
</staff>
</measure>
Expand Down

0 comments on commit 5c16b53

Please sign in to comment.