Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/recipe-books.git

Properly output \startinstructions for every first cooking instruction section in a recipe.

Author liantze <email>
Date 2013-04-15 23:57:40 GMT+0800
Commit 7a5137fe8b8be35f2f7ef8c9d47cddd9b27c9fd8
Parent cecc8d7
xsl/latex.xsl
</xsl:template>
-<xsl:template match="directions[1]">
- <xsl:text>\startinstructions&#xa;&#xa;</xsl:text>
-</xsl:template>
-
-<xsl:template match="directions[descendant::text()]">
+<xsl:template match="directions[descendant::text() or @label != '']">
+ <xsl:if test="not(preceding-sibling::directions)">
+ <xsl:text>\startinstructions&#xa;&#xa;</xsl:text>
+ </xsl:if>
<xsl:text>\begin{instructions}&#xa;</xsl:text>
<xsl:apply-templates select="@label" />
<xsl:apply-templates select="step" />
+ <xsl:if test="not(step)">
+ <xsl:text>\item Serve!</xsl:text>
+ </xsl:if>
<xsl:text>\end{instructions}&#xa;&#xa;</xsl:text>
</xsl:template>
Delta 7 lines added, 5 lines removed, 2-line increase