Phillip Lord wrote:
Stuart Rackham <[email protected]> writes:
Phillip Lord wrote:
The asciimath and latexmath macros have only been implemented for xhtml11, but
you can use them in the html4 and wordpress backends using existing
passthroughs.
Ah, okay. That was another possibility that I hadn't thought about.
Here's an example:
AsciiMathML Blogpost Test
=========================
:blogpost-status: published
:blogpost-doctype: article
:blogpost-posttype: page
[subs="none"]
++++
<script type="text/javascript">
/*<![CDATA[*/
include::./javascripts/ASCIIMathML.js[]
/*]]>*/
</script>
++++
$$`[[a,b],[c,d]]((n),(k))`$$
This works with html4 and wordpress backends, but when you post it to
Wordpress Wordpress replaces the script tag with a div, escapes special
characters and envelopes the JavaScript in a p tag, effectively killing the
JavaScript. See:
http://srackham.wordpress.com/asciimathml-blogpost-test/
Okay, that's not so good! So, it looks like the right way to go would be
to use a plugin to serve the JS up and add it to the header. This will
be nicer in many ways, because I can just include the JS, and serve it
from a single location which should be faster. Also, with a plugin, I
should be able to set up configuration options; I think having this run
for an entire blog is likely to cause problems.
I think to get this working ideally, I'd like the option of adding some
custom fields to the post; I think these are supported in the XML-RPC
interface (haven't tried it, though). I could use the attributes support
you've just added to then switch this on or off on a per-post basis.
Anyway, it's going to take a while to do this; never written a wordpress
plugin. Or any PhP. But it doesn't sound too hard.
The alternative would be to display equations as images using an AsciiDoc filter
(this is how the music filter works, see
http://www.methods.co.nz/asciidoc/music-filter.html). I hacked this example
(http://www.amk.ca/python/code/mt-math) into a rough math2png.py script just to
see if it was feasible. The advantages of this approach are:
- It can be used to generate DocBook and HTML.
- Equations appear identical across formats.
- No JavaScript required in HTML outputs so no need for WordPress plugin.
Disadvantages:
- Inline filters have not been implemented yet, so no inline equations.
Cheers, Stuart
Thanks, as always, for your excellent feedback.
Phil
--
You received this message because you are subscribed to the Google Groups
"asciidoc" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/asciidoc?hl=en.