After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 685998 - Add MathJax to Adium Themes
Add MathJax to Adium Themes
Status: RESOLVED OBSOLETE
Product: empathy
Classification: Core
Component: Chat themes
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: empathy-maint
empathy-maint
Depends on:
Blocks:
 
 
Reported: 2012-10-11 20:41 UTC by Benjamin Berg
Modified: 2018-05-22 15:49 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Modified Template.html that loads mathjax (10.94 KB, text/plain)
2012-10-11 20:41 UTC, Benjamin Berg
Details

Description Benjamin Berg 2012-10-11 20:41:34 UTC
Created attachment 226293 [details]
Modified Template.html that loads mathjax

I was thinking that it would be nice to have formulas. When adium themes are used, this can be easily achived by using mathjax.

I am attaching my modified Template.html file which makes this work. Note that I had to load mathjax dynamically as it would interfere with the rest of the javascript code otherwise.

Works great in my initial tests.
Comment 1 Guillaume Desmottes 2012-12-28 13:59:10 UTC
MathJax looks pretty cool, integrating in Empathy's chat would be awesome.

Any chance you could provide a proper set of patches? We'd be happy to review and merge them. :)
Comment 2 Xavier Claessens 2012-12-28 14:16:47 UTC
One thing to keep in mind is that some adium themes provide their own Template.html. I don't know if that's possible, but it would be nice to "inject" the mathjax support into the chat page without having to touch the template html. Also that would make easier to make it optional, since it could have performance impact probably.

What's the syntax of the message to trigger a math equation replacement? TeX?
Comment 3 Benjamin Berg 2012-12-28 14:26:07 UTC
Hm, it should be possible to inject MathJax directly from C, instead of patching the template. However, that makes it much harder to only reevaluate newly send messages instead of the whole history in the window.

MathJax works by searching for certain strings. formulas will usually be entered using tex and inside $$ $$ or \[ \]. MathJax provides multiple ways, but AFAIK the pidgin math infrastructure only supports $$ formula $$.


It would make sense to make the MathJax URL configurable by the distribution (and maybe the user). Distributions may install a local version of it, that way one can save some bandwidth and offline viewing works too.
Comment 4 Xavier Claessens 2012-12-29 16:06:02 UTC
A few points:

1) What happens if you're offline? That template is used for showing chat history as well, so it should still work offline. I'm fine if formulas are just not replaced in that case, but it should still work.

2) The message passed to the template is escaped using g_markup_escape_text(). Won't that break most of Tex formulas?

3) The template you attached uses MathJax.Hub.Typeset(); which will reparse the whole document as I understand. You should pass the added element to that function, I think.
Comment 5 Benjamin Berg 2013-01-23 10:20:54 UTC
1. Not sure about the attached version; I guess it will fail because of javascript errors; the attached version will probably not scroll correctly.

2. I don't see why escaping would be a problem. The LaTeX code should be normal text, and that is enforced by the escape_text (ie. there are no XML tags). MathML would obviously not work.

3. I don't remember the details. I probably didn't manage to hook things up properly for the partial reparse, and then settled for that.
Comment 6 GNOME Infrastructure Team 2018-05-22 15:49:06 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/empathy/issues/601.