Skip to content

Commit

Permalink
Improve the nesting of complex interchanging ordered and unordered lists
Browse files Browse the repository at this point in the history
  • Loading branch information
u01jmg3 committed Dec 30, 2018
1 parent 2ab7cc3 commit 7ceeee5
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions docx2md.php
Original file line number Diff line number Diff line change
Expand Up @@ -1019,7 +1019,11 @@ private function runTests(array $args)
<!-- Bulleted, unordered list-item -->
<xsl:template match="i:listitem[@type='%d']">
<xsl:value-of select="substring(' ', 1, @level * 3)" />
<xsl:variable name="level" select="@level" />
<xsl:variable name="type" select="@type" />
<xsl:if test="preceding-sibling::*[1]/@type = $type or not(preceding-sibling::i:listitem[@level = ($level - 1) and @type = $type])">
<xsl:value-of select="substring(' ', 1, $level * 3)" />
</xsl:if>
<xsl:text> - </xsl:text>
<xsl:apply-templates />
<xsl:text>&#xa;</xsl:text>
Expand All @@ -1032,7 +1036,9 @@ private function runTests(array $args)
<xsl:template match="i:listitem[@type='%d']">
<xsl:variable name="level" select="@level" />
<xsl:variable name="type" select="@type" />
<xsl:value-of select="substring(' ', 1, $level * 3)" />
<xsl:if test="preceding-sibling::*[1]/@type = $type or not(preceding-sibling::i:listitem[@level = ($level - 1) and @type = $type])">
<xsl:value-of select="substring(' ', 1, $level * 3)" />
</xsl:if>
<xsl:text> 1. </xsl:text>
<xsl:apply-templates />
<xsl:text>&#xa;</xsl:text>
Expand Down

0 comments on commit 7ceeee5

Please sign in to comment.