2014-07-17 08:23:43 -04:00
|
|
|
define [
|
|
|
|
"base"
|
2018-07-13 16:02:52 -04:00
|
|
|
], (App) ->
|
2014-07-17 08:23:43 -04:00
|
|
|
App.directive "mathjax", () ->
|
|
|
|
return {
|
|
|
|
link: (scope, element, attrs) ->
|
2018-07-13 16:02:52 -04:00
|
|
|
if attrs.delimiter != 'no-single-dollar'
|
2018-07-23 10:32:17 -04:00
|
|
|
inlineMathConfig = MathJax?.Hub?.config?.tex2jax.inlineMath
|
|
|
|
alreadyConfigured = _.find inlineMathConfig, (c) ->
|
|
|
|
c[0] == '$' and c[1] == '$'
|
2018-07-13 16:02:52 -04:00
|
|
|
|
2018-07-23 10:32:17 -04:00
|
|
|
if !alreadyConfigured?
|
|
|
|
MathJax?.Hub?.Config(
|
|
|
|
tex2jax:
|
|
|
|
inlineMath: inlineMathConfig.concat([['$', '$']])
|
|
|
|
)
|
2018-07-13 16:02:52 -04:00
|
|
|
|
2014-07-17 08:23:43 -04:00
|
|
|
setTimeout () ->
|
2015-02-23 12:46:17 -05:00
|
|
|
MathJax?.Hub?.Queue(["Typeset", MathJax?.Hub, element.get(0)])
|
2014-07-17 08:23:43 -04:00
|
|
|
, 0
|
|
|
|
}
|