Allow textinputdynamath to specify its Mathjax preprocessor per-problem
This commit is contained in:
@@ -326,8 +326,16 @@ def textline_dynamath(element, value, status, render_template, msg=''):
|
||||
count = int(eid.split('_')[-2]) - 1 # HACK
|
||||
size = element.get('size')
|
||||
hidden = element.get('hidden', '') # if specified, then textline is hidden and id is stored in div of name given by hidden
|
||||
|
||||
# Preprocessor to insert between raw input and Mathjax
|
||||
preprocessor = {'class_name': element.get('preprocessorClassName',''),
|
||||
'script_src': element.get('preprocessorSrc','')}
|
||||
if '' in preprocessor.values():
|
||||
preprocessor = None
|
||||
|
||||
context = {'id': eid, 'value': value, 'state': status, 'count': count, 'size': size,
|
||||
'msg': msg, 'hidden': hidden,
|
||||
'preprocessor': preprocessor,
|
||||
}
|
||||
html = render_template("textinput_dynamath.html", context)
|
||||
return etree.XML(html)
|
||||
|
||||
@@ -3,8 +3,10 @@
|
||||
###
|
||||
<section class="text-input-dynamath textinputdynamath capa_inputtype" id="inputtype_${id}">
|
||||
|
||||
<div class="textinputdynamath_data" data-preprocessor="MathjaxPreprocessorFor6002x"/>
|
||||
<div class="script_placeholder" data-src="/static/js/mathjax_preprocessor_for_6002x.js"/>
|
||||
% if preprocessor is not None:
|
||||
<div class="textinputdynamath_data" data-preprocessor="${preprocessor['class_name']}"/>
|
||||
<div class="script_placeholder" data-src="${preprocessor['script_src']}"/>
|
||||
% endif
|
||||
|
||||
% if state == 'unsubmitted':
|
||||
<div class="unanswered" id="status_${id}">
|
||||
|
||||
Reference in New Issue
Block a user