Just wondering whether anyone uses ConTeXt (from Pragma) in any type of multimarkdown workflow. (I tried searching the forum, but the word ‘context’ appears a lot more frequently in other contexts.)
It will work, though you may have to create some new XSLT files to account for any differences with ConTeXt, and you would probably want to modify the multimarkdown2PDF.pl script to run the appropriate commands automatically.
Cool. Will investigate!
Thanks
I am making some first attempts to produce xhtml2context.xslt and context-snippet.xslt, so that MultiMarkdown can translate to ConTeXt as well as to LaTeX. Nothing production-proof yet, just took the first steps…
One thing I am trying to do is to make Scrivener annotations show up as margin notes in ConTeXt:
<!-- Translate Scrivener annotations into ConTeXt margin note -->
<xsl:template match="html:span[starts-with(@style,'color:')]">
<xsl:text>\inmargin{</xsl:text>
<xsl:apply-templates select="node()"/>
<xsl:text>}</xsl:text>
</xsl:template>
This correctly translates the Multimarkdown output
<span class="annotation" style="color:#FF0000">[This is a test annotation]</span>
to the ConTeXt command
\inmargin{[This is a test annotation]}
But I also want to get rid of the Scrivener-inserted square brackets, since they are not needed when the text is on its own. It looks like I need to go “into the node()” to get rid of these brackets. How would I put this into the XSLT?
Thanks
Roland
I have no idea where those brackets come from, but I got rid of them with the XPath function “substring”:
< xsl:variable name="annotation" select="node()"/>
...
< xsl:value-of select="substring($annotation,2,string-length($annotation)-2)"/>
BTW: Good thing that you’re working on a template for ConTeXt!