diff options
Diffstat (limited to 'utility/formatter.xsl')
-rw-r--r-- | utility/formatter.xsl | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/utility/formatter.xsl b/utility/formatter.xsl index 606a764..fb4acec 100644 --- a/utility/formatter.xsl +++ b/utility/formatter.xsl @@ -107,7 +107,7 @@ <xsl:when test="contains(@class, 'display')"> <p class="math"> <xsl:call-template name="math_highlighter"> - <xsl:with-param name="source" select="substring(text(),3,string-length(text())-4)"/> + <xsl:with-param name="source" select="text()"/> <xsl:with-param name="arguments"> <xsl:text>--display-mode</xsl:text> </xsl:with-param> @@ -117,7 +117,7 @@ <xsl:otherwise> <span class="math"> <xsl:call-template name="math_highlighter"> - <xsl:with-param name="source" select="substring(text(),3,string-length(text())-4)"/> + <xsl:with-param name="source" select="text()"/> </xsl:call-template> </span> </xsl:otherwise> @@ -126,12 +126,23 @@ <xsl:template name="formatter"> <xsl:param name="source"/> + <xsl:param name="format"/> <xsl:variable name="content"> - <xsl:call-template name="plain_formatter"> - <xsl:with-param name="format">pandoc -f markdown -t html4 --katex --no-highlight -fmarkdown-implicit_figures</xsl:with-param> - <xsl:with-param name="source" select="$source"/> - </xsl:call-template> + <xsl:choose> + <xsl:when test="contains($format, 'md')"> + <xsl:call-template name="plain_formatter"> + <xsl:with-param name="format">pandoc -f markdown -t html4 --katex --no-highlight -fmarkdown-implicit_figures</xsl:with-param> + <xsl:with-param name="source" select="$source"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="plain_formatter"> + <xsl:with-param name="format">pandoc -f <xsl:value-of select="$format"/> -t html4 --katex --no-highlight</xsl:with-param> + <xsl:with-param name="source" select="$source"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> </xsl:variable> <xsl:apply-templates select="xalan:nodeset($content)" mode="embellish"/> |