So I was able to get jsMath loading when I compile a new page. Couple
followup questions.

The file that I include is "load.js" which loads a bunch of other scripts
based on settings, browser, etc. I had to do a brutal hack and place all of
those files 1 directory above /output/ for load.js to find them. Is there
anyway that I can force load.js to be copied to subdirectory of output?
like /output/jsMath/easy/load.js?

Also, when I call my function jsMath.ProcessBefordShowing() it appears to
run. I got an error from it because it couldn't find a file and fixed that
error and now just nothing happens. No JS errors, nothing. What this
function is supposed to do is scan through the page content and find <div>
elements that have the style class "math" and then process the contents
inside of them. When I call this function does it actually have access to
the page contents? I don't know how the hidden iframes things work and I
suspect this is part of the problem.

Thanks,

Matt

On Fri, Feb 24, 2012 at 3:59 PM, Pascal Chambon <[email protected]> wrote:

>  Hi,
>
> at the moment, like gwt, pyjs always loads in a hidden iframe (for obscure
> compression reasons), so javascript vars won't see each other between pyjs
> and pure javascript.
>
> Look around "from __javascript__ import processBeforeShowing" (there is
> an example like that in the pyjs/examples folder), it should do the trick.
> Provided of course that you also add your js library to the build process
> (see command line args of builder).
>
> Regards,
> PKL
>
>
>
> Le 24/02/2012 22:33, Matt Kelly a écrit :
>
> Hi,
>
> I'm working on a project for school and I'm trying to using a Javascript
> package called jsMath (http://www.math.union.edu/~dpvc/jsMath/) to parse
> LaTeX tags within my Pyjamas application. Unfortunately, I have seen the
> warnings to use at little pure javascript stuff as possible but I don't
> know of any other solutions. That said I'm trying import jsMath in a way I
> can use two functions called jsMath.process() and
> jsMath.processBeforeShowing() so that I can grab text via RPC update the
> page and then have jsMath parse the new contents.
>
> Typically all you do to get just math working is include the line
>
> <SCRIPT SRC="*path-to-jsMath*/easy/load.js"></SCRIPT>
>
> and it goes off and does its thing.
>
> I seen the examples of loading simple external javascript files using
> import so I tried
>
> import jsMath.easy.load.js
>
> and then tried to use my functions with JS
>
> JS(""" jsMath.processBeforeShowing(); """)
>
> but all I'm getting is "jsMath is not defined." I assumed part of this was
> because they weren't in the same directory so I tried moving them to the
> same directory and correcting to "import load.js" with the same results.
>
> I also looked at jsimport() and tried that method (which seems to be
> deprecated?) and had no success either.
>
> Am I doing something simple wrong?
>
> Does this even seem possible or is jsMath just to large of a JS package to
> work correctly with Pyjamas?
>
> Thanks,
>
> Matt
>
>
>

Reply via email to