Customising clean-text.xslt (or xhtml2latex.xslt)

MMD has helped me tremendously. I use Scrivener for writing and MMD for export to latex. I’ve customised several XSLT files, but I wondered if it is possible to customise the clean-text.xslt file (or the xhtml2latex.xslt), so that MMD could translate a specific text string written in Scrivener into latex code. For example, I would like to have a text string as “[NEW_PARAGRAPH_DOUBLELINE]” translated into:

\vskip 1.1em
\noindent

If anybody on the forum can help me out, I will greatly appreciate it.

Cheers,
Magnus

clean-text.png
This doesn’t seem to work for expressions containing underscores, but something like
[NEW PARAGRAPH DOUBLELINE] should be ok.

Thank you!

In my first tryouts I added:

</xsl:with-param>
		<xsl:with-param name="substring">
			<xsl:text>[doublenewline]</xsl:text>
		</xsl:with-param>
		<xsl:with-param name="replacement">
			<xsl:text>\vskip 1.1em \noindent</xsl:text>
		</xsl:with-param>
	</xsl:call-template>

to the clean-text.xslt file – resulting in quite a few compilation errors when exporting from Scrivener. The problem was that I had forgot to add an extra set off

	<xsl:call-template name="replace-substring">
		<xsl:with-param name="original">

After I added this text string (which your instruction did indeed state), the compilation when smoothly.

Also, I’ve changed the xhtml2latex.xslt file. I’ve been a bit annoyed by the way the characters “***” on a new line is translated into a horizontal rule when exporting from Scrivener. So, I changed

<!-- horizontal rule -->
<xsl:template match="html:hr">
	<xsl:text>\vskip 2em

\hrule height 0.4pt
\vskip 2em

</xsl:text>
</xsl:template>

To:

<!-- horizontal rule -->
<xsl:template match="html:hr">
	<xsl:text>\vskip 0.3em

\fancybreak{{}\{* * *}\{}}
\vskip 0.3em
\noindent
</xsl:text>
</xsl:template>

Cheers,
Magnus