Modify

Opened 14 years ago

Closed 4 years ago

#8758 closed defect (wontfix)

Doesn't work with MathJax v1.1

Reported by: Dave Matthews Owned by: Kamil Kisiel
Priority: normal Component: TracMathJaxPlugin
Severity: normal Keywords:
Cc: xancorreu@… Trac Release: 0.11

Description

If I try using MathJax v1.1 I get the following error message on every Trac page I view:

MathJax no longer loads a default configuration file; you must
specify such files explicitly. This page seems to use the older
default config/MathJax.js file, and so needs to be updated.
This is explained further at

http://www.mathjax.org/help/configuration

If I install MathJax v1.0.1a everything works fine but users are strongly encouraged to update.

I did try a simple change to the line

add_script(req, "/chrome/%s/%s" % (MATHJAX_DIR, MATHJAX_JS))

to add "?config=default" but I couldn't get this to work for some reason.

Would it be possible to upgrade this plugin to work with MathJax v1.1 please?

Attachments (1)

tracmathjax.py (3.0 KB) - added by Bangyou Zheng 13 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 Changed 13 years ago by Kamil Kisiel

Status: newassigned

Sorry I've been slacking off on this. Planning on working on it this weekend.

comment:2 Changed 13 years ago by al@…

Have the same problem. The reason why just editing to

add_script(req, "/chrome/%s/%s?config=default") % (MATHJAX_DIR, MATHJAX_JS))

is not working is that the ? and = characters are %-masked (urlencoded) when the HTML code is rendered.

The HTML reads

<script src="/trac/chrome/MathJax/MathJax.js%3Fconfig%3Ddefault" type="text/javascript"></script>

Is there a mask character to turn off % encoding?

comment:3 Changed 13 years ago by anonymous

Cc: xancorreu@… added; anonymous removed

comment:4 Changed 13 years ago by jan.schmidt@…

The resolution is diskussed here:

http://www.mathjax.org/docs/1.1/dynamic.html

There should be shipped a file (i.e. mathjax.js), the user could edit to change the place where mathjax could be reached. This file goes to the place where trac.js is installed.

And in tracmathjax.py the add_script-call is changed to point to that file.

This mathjax.js works for me (0.12).

(function () {
  var script = document.createElement("script");
  script.type = "text/javascript";
  script.src  = "http://cdn.mathjax.org/mathjax/latest/MathJax.js";

  var config = 'MathJax.Hub.Config({' +
                 'extensions: ["tex2jax.js"],' +
                 'jax: ["input/TeX","output/HTML-CSS"]' +
               '});' +
               'MathJax.Hub.Startup.onload();';

  if (window.opera) {script.innerHTML = config}
               else {script.text = config}

  document.getElementsByTagName("head")[0].appendChild(script);
})();
Last edited 10 years ago by Ryan J Ollos (previous) (diff)

comment:5 Changed 13 years ago by Bangyou Zheng

I changed the codes of function 'add_script' to mask '?'. This attachment is working for me.

tracmathjax.py

Changed 13 years ago by Bangyou Zheng

Attachment: tracmathjax.py added

comment:6 Changed 13 years ago by eu@…

Is there a reliable workaround for this bug? I am running Trac 0.12.2 and while the last attachnemt with _add_script(...) used to work fine until recently, now I am getting the warning dialogue from MathJax at every page again. Thanks.

comment:7 Changed 13 years ago by anonymous

I revoke my last ocmment, after some adjustments of the local configuration the attached tracmathjax.py works fine again. Thanks.

comment:8 Changed 12 years ago by Kamil Kisiel

hm, I haven't been receiving emails from TracHacks for some reason so I wasn't aware of the activity on this ticket.

I recently pushed a contributed change that pulls MathJax from the CDN instead of a local install, please give it a try:

https://bitbucket.org/kisielk/tracmathjaxplugin/changeset/7f4e31322263

comment:9 Changed 4 years ago by Ryan J Ollos

Resolution: wontfix
Status: assignedclosed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Kamil Kisiel.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.