JSMath Debug

I've been using a version of jsMath and the jsMath plugin for dokuwiki for several months. Whoever, I discovered that it seemed to be implicated in errors when I tried to save new or edited pages. To debug this phenomenon, it seemed to me that it would be best to try a “vanilla” version of the plugin: if that doesn't cause the error, I can then incrementaly change and test to get back to what I was initially trying to accomplish. The features I was trying to incorporate were

  1. a syntax markup for the “block” version with newlines instead of a longer tag (<jsmath>), which seems to me more intuitive and at least as readible.
  2. an associated “action” plugin to furnish a button in the edit form which adds the tags (less typing!)

I removed my version and installed the “vanilla” current release. It didn't start up!! I consulted the q&a of others experience with this issue. I've fiddled, and lost patience. I finally tried replacing its start-up script by the old-style one, and it worked. 1) There was no error message when I saved this page, either.

script.js that works

// full url to jsMath installation                                                 
var jsMathURL = 'http://get-the.net/jsMath';                        
 
document.write('<SCRIPT>jsMath = {Controls: {cookie: {scale: 120}}}</SCRIPT>'); 
document.write('<SCRIPT SRC="' + jsMathURL + '/jsMath.js"></SCRIPT>'); 
 
function installJsMath()
{
    jsMath.Process(document);
}
 
addInitEvent(installJsMath);

new procedure

local.php

Following update of the plugin parameters via admin/config, local.php contains

$conf['plugin']['jsmath']['use_dollar'] = 0;
$conf['plugin']['jsmath']['jsMath_url'] = 'http://get-the.net/jsMath';

This should be read by

install_js.php

then injected into the js command:

 require('../../../conf/local.php');
 $jsMathURL = $conf['plugin']['jsmath']['jsMath_url'];

 ?>
 
 document.write('<SCRIPT>jsMath = {Controls: {cookie: {scale: 120}}}</SCRIPT>');
 document.write('<SCRIPT SRC="<?php echo($jsMathURL); ?>/jsMath.js"></SCRIPT>');
 
 function installJsMath()
 {
     jsMath.Process(document);
 }
 
 addInitEvent(installJsMath);

For some reason, that doesn't seem to be completing as it should.

More Troubleshooting

I've switch back to the “new procedure” – almost. I've skipped (commented out) the path lookup in install_js.php and added the line

var jsMathURL = 'http://get-the.net/jsMath';   

So, install_js.php is now identical to the script.js that works, with some commented-out php at the top. And it still doesn't work. For some reason, the “call” from script.js to install_js.php is not working.

lib/exe/js.php?edit=0&write=0 contains:

document.write('<SCRIPT SRC="'+DOKU_BASE+'/lib/plugins/jsmath/install_js.php"></SCRIPT>');

which indicates it is calling the “right” file, but install_js.php seems to be empty when it arrives in the document (as JS).

Too bad. I don't have time to continue on this, at least not now: I need to get the “block” style working on my mark-up variant!

Another Test

Today I made a clean, “vanilla” install of the latest version of dokuwiki and added the jsmath plugin. The only “difficulty” I had was that the plugin manager couldn't unpack it (a .tar on Windoze), I had to unpack it can copy to the right directory. But after that, I set the path using the config manager and it load immediately!. Very odd.

Conclusion

It is not a problem with the jsMath plugin. And I have no idea why it doesn't work on my hosted site.

Allowed Types Issue

Why would jsmath blocks contain code that needs substitution or formatting? That seems likely to break well-formed LaTeX that happens to resemble something some other wiki mark-up syntax “recognizes” (like newlines needed in arrays and eqarrays). I've edited out those type in syntax.php just now (28 Sep 2009) and will give it a try.

1) with the path hard-coded in the js file, not “managed” by the dokuwiki config

 
jsmath_debug.txt · Dernière modification: 2009/09/28 09:44 par suitable