Disable mathoid if URL=False
This commit is contained in:
parent
a553466599
commit
9ad1052766
1 changed files with 3 additions and 1 deletions
|
@ -2,6 +2,8 @@ import re
|
||||||
|
|
||||||
import mistune
|
import mistune
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
from judge.utils.mathoid import MathoidMathParser
|
from judge.utils.mathoid import MathoidMathParser
|
||||||
|
|
||||||
mistune._pre_tags.append('latex')
|
mistune._pre_tags.append('latex')
|
||||||
|
@ -48,7 +50,7 @@ class MathInlineLexer(mistune.InlineLexer):
|
||||||
|
|
||||||
class MathRenderer(mistune.Renderer):
|
class MathRenderer(mistune.Renderer):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
if kwargs.pop('math', False):
|
if kwargs.pop('math', False) and settings.MATHOID_URL != False:
|
||||||
self.mathoid = MathoidMathParser(kwargs.pop('math_engine', None) or 'svg')
|
self.mathoid = MathoidMathParser(kwargs.pop('math_engine', None) or 'svg')
|
||||||
else:
|
else:
|
||||||
self.mathoid = None
|
self.mathoid = None
|
||||||
|
|
Loading…
Add table
Reference in a new issue