I have copied the ASCIIMathML.js file to the same folder as my
TiddlyWiki, added the reference to the javascript file in the shadow
tiddler MarkUpPreHead:
<script type="text/javascript" src="ASCIIMathML.js"></script>
I'm running FireFox, but my equation insertions does not render at
all.
Other tiddlyWikis using the same javascript renders, but not my own!!
Help is appriciated!!
Regards,
Tomas Sandkvist
Sweden
Tiddler names are highly case sensitive... check the capitalization:
"MarkupPreHead" (correct) versus "MarkUpPreHead" (incorrect)
HTH,
-e
Eric Shulman
TiddlyTools / ELS Design Studios
That is not enough. You have to call the function AMProcessNode at the
appropiate point, since this is the function which renders the
equations.
The appropiate point to put this call depends on the TiddlyWiki
version. I was unable to insert this call without externally modifying
the html file which contains the wiki. I tried to do it via plugin,
but I was unable to (my understanding of the TiddlyWiki architecture
is too insufficient). However, by directly modifying the html source,
I got it running without problems
The modification is very simple, if you want to try it too. You only
have to open your wiki.html file with an ascii editor, search for the
string "prototype.refreshTiddler" (in my file is at line 3834, but I
guess this may be different in your case), and then go to the end of
that function, and insert one line containing:
if (AMprocessNode) AMprocessNode(tiddlerElem,false);
just before the last statement of the function, which reads: return
tiddlerElem;
I hope it works for you too. If you discover an alternative method to
do so without editing the html, please share.
Regards,
--JL Diaz
-Xavier
Thank you very much! It worked.
I tried already something similar:
Story.prototype.refreshTiddler_old =Story.prototype.refreshTiddler;
Story.prototype.refreshTiddler = function(title,template,force)
{
return this.refreshTiddler(title,template,force);
if (AMprocessNode) output.text=AMprocessNode(output.text,false);
}
I can see that this is not exactly what you did, but I expected this
to work. However, what I got instead was all my tiddlers rendered as
black boxes. Why? I was unable even to undo the change (I had to edit
the html file to remove this plugin tiddler).
--
Jose
> I tried already something similar:
>
> Story.prototype.refreshTiddler_old =Story.prototype.refreshTiddler;
> Story.prototype.refreshTiddler = function(title,template,force)
> {
> var tiddlerElem= this.refreshTiddler(title,template,force);
> if (AMprocessNode) AMprocessNode(tiddlerElem, false);
> return tiddlerElem;
> }
--Jose
ummm...
in your hijacked refreshTiddler(), you make a call to
this.refreshTiddler()... which is the SAME hijacked function... which
resulting in *infinite recursion*
What you want to do in your hijacked refreshTiddler() is to make a
call to the *original* saved function, "this.refreshTiddler_old",
instead of:
var tiddlerElem= this.refreshTiddler(title,template,force);
you need to write:
var tiddlerElem= this.refreshTiddler_old(title,template,force);
However, this is NOT good programming form, as it will break if the
params used by the core definition of refreshTiddler() change in
future releases. Fortunately, there is a special "apply()" method
available on all javascript functions that lets you pass-through
whatever params were used to call your hijack:
var tiddlerElem= this.refreshTiddler.apply(this,arguments);
(note: both "this" and "arguments" are automatic variables that are
defined by the JS runtime environment... )
One thing that your code DOES do properly that my quick code snippet
missed was to actually return the "tiddlerElem" value. The original
refreshTiddler() returns this value, so the hijack MUST do the same,
or any calling functions that expect that return value will break.
HTH,
-e
On 1 Jun, 12:47, Eric Shulman <elsdes...@gmail.com> wrote:
> > > Story.prototype.refreshTiddler_old =Story.prototype.refreshTiddler;
> > > Story.prototype.refreshTiddler = function(title,template,force)
> > > {
> > > var tiddlerElem= this.refreshTiddler(title,template,force);
> > > if (AMprocessNode) AMprocessNode(tiddlerElem, false);
> > > return tiddlerElem;
> > > }
>
> ummm...
>
> in your hijacked refreshTiddler(), you make a call to
> this.refreshTiddler()... which is the SAME hijacked function... which
> resulting in *infinite recursion*
Oh, of course! This was also a typo... I deleted my original code and
I was trying to reconstruct it from memory, but I introduced some
errors doing so.
> What you want to do in your hijacked refreshTiddler() is to make a
> call to the *original* saved function, "this.refreshTiddler_old",
Yes, this is what I did. I tried again my reconstructed code, and now
it works! I'm unable to recall what I did wrong. Nevertheless, it is
encouraging to see that I was on the good track.
> However, this is NOT good programming form, as it will break if the
> params used by the core definition of refreshTiddler() change in
> future releases. Fortunately, there is a special "apply()" method
> available on all javascript functions that lets you pass-through
> whatever params were used to call your hijack:
>
> var tiddlerElem= this.refreshTiddler.apply(this,arguments);
Aha. Very interesting. Thank you for explaining it!
> One thing that your code DOES do properly that my quick code snippet
> missed was to actually return the "tiddlerElem" value. The original
> refreshTiddler() returns this value, so the hijack MUST do the same,
> or any calling functions that expect that return value will break.
Aha. In fact it was a surprise to me that your code worked without
returning "tiddlerElem", but the inners of TiddlyWiki are still a
mistery to me, so I assumed it was ok.
Thanks again,
--Jose