summaryrefslogtreecommitdiff
path: root/deck.js/extensions/simplemath/deck.simplemath.js
blob: c09d6f3e9ab9cca64bdce74e1e3a71de37672233 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/*!
Deck JS - deck.simplemath
Copyright (c) 2012 RĂ©mi Emonet,
using a modified version of the script from http://gold-saucer.afraid.org/mathml/greasemonkey/ by Steve Cheng
*/

/*
This module provides a support for latex equation syntax.
*/

(function($, deck, undefined) {
    var $d = $(document);
    var may = function(f) {return f ? f : function() {}};
    
    $d.bind('deck.init', function() {
        var container = $[deck]('getContainer');
        $('.latex', container).each(function() {
            var it = this;
            var v = $(it).text();
            it.innerHTML = "$\\displaystyle "+v+"$";
            new latex2mml().patch_element(it);
        });
    });

})(jQuery, 'deck');