From 6ff762b63e3f22ccc167f1b2805600d76f852af6 Mon Sep 17 00:00:00 2001 From: muhammad-ammar Date: Mon, 19 Sep 2016 16:22:58 +0500 Subject: [PATCH] allow html inside label and descriptions TNL-5557 --- common/lib/capa/capa/capa_problem.py | 22 +-- common/lib/capa/capa/inputtypes.py | 4 +- .../capa/templates/chemicalequationinput.html | 3 +- .../lib/capa/capa/templates/choicegroup.html | 7 +- .../lib/capa/capa/templates/choicetext.html | 3 +- .../capa/templates/formulaequationinput.html | 2 +- .../lib/capa/capa/templates/optioninput.html | 3 +- .../capa/capa/templates/schematicinput.html | 3 +- common/lib/capa/capa/templates/textline.html | 2 +- .../lib/capa/capa/tests/test_capa_problem.py | 97 +++++----- .../lib/capa/capa/tests/test_html_render.py | 2 +- .../capa/capa/tests/test_input_templates.py | 172 ++++++++++++++---- common/lib/capa/capa/tests/test_inputtypes.py | 53 +++--- common/lib/capa/capa/tests/test_util.py | 11 +- common/lib/capa/capa/util.py | 13 ++ 15 files changed, 259 insertions(+), 138 deletions(-) diff --git a/common/lib/capa/capa/capa_problem.py b/common/lib/capa/capa/capa_problem.py index 687bdd7e8e..548ccd43da 100644 --- a/common/lib/capa/capa/capa_problem.py +++ b/common/lib/capa/capa/capa_problem.py @@ -31,6 +31,8 @@ import capa.responsetypes as responsetypes from capa.util import contextualize_text, convert_files_to_filenames import capa.xqueue_interface as xqueue_interface from capa.safe_exec import safe_exec +from openedx.core.djangolib.markup import HTML +from xmodule.stringify import stringify_children # extra things displayed after "show answers" is pressed @@ -926,7 +928,7 @@ class LoncapaProblem(object): group_label_tag.tag = 'p' group_label_tag.set('id', responsetype_id) group_label_tag.set('class', 'multi-inputs-group-label') - group_label_tag_text = group_label_tag.text + group_label_tag_text = stringify_children(group_label_tag) for inputfield in inputfields: problem_data[inputfield.get('id')] = { @@ -938,7 +940,7 @@ class LoncapaProblem(object): # Extract label value from