[explanation] A short explanation of the answer. [explanation]
-
-
-
-
-
- %endif
-
-
-
-
-
-
-<%include file="metadata-edit.html" />
diff --git a/lms/djangoapps/courseware/tests/test_submitting_problems.py b/lms/djangoapps/courseware/tests/test_submitting_problems.py
index 4d04204078de..e7f69fdd0e83 100644
--- a/lms/djangoapps/courseware/tests/test_submitting_problems.py
+++ b/lms/djangoapps/courseware/tests/test_submitting_problems.py
@@ -924,7 +924,6 @@ def schematic_setup(self, name):
BlockFactory.create(
parent_location=self.section.location,
category='problem',
- boilerplate='circuitschematic.yaml',
display_name=name,
data=xmldata
)
@@ -948,7 +947,6 @@ def custom_response_setup(self, name):
BlockFactory.create(
parent_location=self.section.location,
category='problem',
- boilerplate='customgrader.yaml',
data=cfn_problem_xml,
display_name=name
)
@@ -972,7 +970,6 @@ def computed_answer_setup(self, name):
BlockFactory.create(
parent_location=self.section.location,
category='problem',
- boilerplate='customgrader.yaml',
data=computed_xml,
display_name=name
)
diff --git a/openedx/core/djangoapps/content_libraries/tests/test_content_libraries.py b/openedx/core/djangoapps/content_libraries/tests/test_content_libraries.py
index 91a9c29a3754..10d6c1ead94d 100644
--- a/openedx/core/djangoapps/content_libraries/tests/test_content_libraries.py
+++ b/openedx/core/djangoapps/content_libraries/tests/test_content_libraries.py
@@ -481,11 +481,6 @@ def test_library_blocks_studio_view(self):
"last_draft_created": update_date.isoformat().replace('+00:00', 'Z')
})
- # Now view the XBlock's studio view (including draft changes):
- fragment = self._render_block_view(block_id, "studio_view")
- assert 'resources' in fragment
- assert 'Hello world!' in fragment['content']
-
@patch(
"openedx.core.djangoapps.content_libraries.rest_api.libraries.LibraryBlocksView.pagination_class.page_size",
new=2,
diff --git a/webpack.builtinblocks.config.js b/webpack.builtinblocks.config.js
index c0f2fdaeb4fa..20d8790fc5b5 100644
--- a/webpack.builtinblocks.config.js
+++ b/webpack.builtinblocks.config.js
@@ -65,10 +65,6 @@ module.exports = {
'./xmodule/js/src/capa/imageinput.js',
'./xmodule/js/src/capa/schematic.js'
],
- ProblemBlockEditor: [
- './xmodule/js/src/xmodule.js',
- './xmodule/js/src/problem/edit.js'
- ],
SequenceBlockDisplay: [
'./xmodule/js/src/xmodule.js',
'./xmodule/js/src/sequence/display.js'
diff --git a/xmodule/capa_block.py b/xmodule/capa_block.py
index 8ca49eba97a3..f0832ae6baf9 100644
--- a/xmodule/capa_block.py
+++ b/xmodule/capa_block.py
@@ -41,13 +41,12 @@
from xmodule.capa.responsetypes import LoncapaProblemError, ResponseError, StudentInputError
from xmodule.capa.util import convert_files_to_filenames, get_inner_html_from_xpath
from xmodule.contentstore.django import contentstore
-from xmodule.editing_block import EditingMixin
from xmodule.exceptions import NotFoundError, ProcessingError
from xmodule.graders import ShowCorrectness
from xmodule.raw_block import RawMixin
from xmodule.util.builtin_assets import add_css_to_fragment, add_webpack_js_to_fragment
from xmodule.util.sandboxing import SandboxService
-from xmodule.x_module import ResourceTemplates, XModuleMixin, XModuleToXBlockMixin, shim_xmodule_js
+from xmodule.x_module import XModuleMixin, XModuleToXBlockMixin, shim_xmodule_js
from xmodule.xml_block import XmlMixin
from .capa.xqueue_interface import XQueueService
@@ -130,7 +129,6 @@ def from_json(self, value):
@XBlock.needs("user")
@XBlock.needs("i18n")
-@XBlock.needs("mako")
@XBlock.needs("cache")
@XBlock.needs("sandbox")
@XBlock.needs("replace_urls")
@@ -139,9 +137,7 @@ class _BuiltInProblemBlock(
ScorableXBlockMixin,
RawMixin,
XmlMixin,
- EditingMixin,
XModuleToXBlockMixin,
- ResourceTemplates,
XModuleMixin,
):
"""
@@ -165,12 +161,9 @@ class _BuiltInProblemBlock(
is_extracted = False
- resources_dir = None
-
has_score = True
show_in_read_only_mode = True
template_dir_name = "problem"
- mako_template = "widgets/problem-edit.html"
has_author_view = True
icon_class = "problem"
@@ -396,19 +389,6 @@ def author_view(self, context):
"""
return self.student_view(context, show_detailed_errors=True)
- def studio_view(self, _context):
- """
- Return the studio view.
- """
- # Not converting this to django template since this method is deprecated.
- fragment = Fragment(
- self.runtime.service(self, "mako").render_cms_template(self.mako_template, self.get_context())
- )
- add_css_to_fragment(fragment, "ProblemBlockEditor.css")
- add_webpack_js_to_fragment(fragment, "ProblemBlockEditor")
- shim_xmodule_js(fragment, "MarkdownEditingDescriptor")
- return fragment
-
def handle_ajax(self, dispatch, data):
"""
This is called by courseware.block_render, to handle an AJAX call.
@@ -547,17 +527,6 @@ def filter_templates(cls, template, course):
"""
return "latex" not in template["template_id"] or course.use_latex_compiler
- def get_context(self):
- _context = EditingMixin.get_context(self)
- _context.update(
- {
- "markdown": self.markdown,
- "enable_markdown": self.markdown is not None,
- "enable_latex_compiler": self.use_latex_compiler,
- }
- )
- return _context
-
# VS[compat]
# TODO (cpennington): Delete this method once all fall 2012 course are being
# edited in the cms
diff --git a/xmodule/js/fixtures/problem-with-markdown.html b/xmodule/js/fixtures/problem-with-markdown.html
deleted file mode 100644
index be4fcd5ecc43..000000000000
--- a/xmodule/js/fixtures/problem-with-markdown.html
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/xmodule/js/fixtures/problem-without-markdown.html b/xmodule/js/fixtures/problem-without-markdown.html
deleted file mode 100644
index 06225e99b6d0..000000000000
--- a/xmodule/js/fixtures/problem-without-markdown.html
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/xmodule/js/spec/problem/edit_spec.js b/xmodule/js/spec/problem/edit_spec.js
deleted file mode 100644
index 75e46da4bd9e..000000000000
--- a/xmodule/js/spec/problem/edit_spec.js
+++ /dev/null
@@ -1,1080 +0,0 @@
-describe('MarkdownEditingDescriptor', function() {
- describe('save stores the correct data', function() {
- it('saves markdown from markdown editor', function() {
- loadFixtures('problem-with-markdown.html');
- this.descriptor = new MarkdownEditingDescriptor($('.problem-editor'));
- const saveResult = this.descriptor.save();
- expect(saveResult.metadata.markdown).toEqual('markdown');
- expect(saveResult.data).toXMLEqual('\n
markdown
\n');
- });
- it('clears markdown when xml editor is selected', function() {
- loadFixtures('problem-with-markdown.html');
- this.descriptor = new MarkdownEditingDescriptor($('.problem-editor'));
- this.descriptor.createXMLEditor('replace with markdown');
- const saveResult = this.descriptor.save();
- expect(saveResult.nullout).toEqual(['markdown']);
- expect(saveResult.data).toEqual('replace with markdown');
- });
- it('saves xml from the xml editor', function() {
- loadFixtures('problem-without-markdown.html');
- this.descriptor = new MarkdownEditingDescriptor($('.problem-editor'));
- const saveResult = this.descriptor.save();
- expect(saveResult.nullout).toEqual(['markdown']);
- expect(saveResult.data).toEqual('xml only');
- });
- });
-
- describe('advanced editor opens correctly', () =>
- it('click on advanced editor should work', function() {
- loadFixtures('problem-with-markdown.html');
- this.descriptor = new MarkdownEditingDescriptor($('.problem-editor'));
- spyOn(this.descriptor, 'confirmConversionToXml').and.returnValue(true);
- expect(this.descriptor.confirmConversionToXml).not.toHaveBeenCalled();
- const e = jasmine.createSpyObj('e', [ 'preventDefault' ]);
- this.descriptor.onShowXMLButton(e);
- expect(e.preventDefault).toHaveBeenCalled();
- expect(this.descriptor.confirmConversionToXml).toHaveBeenCalled();
- expect($('.editor-bar').length).toEqual(0);
- })
- );
-
- describe('insertMultipleChoice', function() {
- it('inserts the template if selection is empty', function() {
- const revisedSelection = MarkdownEditingDescriptor.insertMultipleChoice('');
- expect(revisedSelection).toEqual(MarkdownEditingDescriptor.multipleChoiceTemplate);
- });
- it('wraps existing text', function() {
- const revisedSelection = MarkdownEditingDescriptor.insertMultipleChoice('foo\nbar');
- expect(revisedSelection).toEqual('( ) foo\n( ) bar\n');
- });
- it('recognizes x as a selection if there is non-whitespace after x', function() {
- const revisedSelection = MarkdownEditingDescriptor.insertMultipleChoice('a\nx b\nc\nx \nd\n x e');
- expect(revisedSelection).toEqual('( ) a\n(x) b\n( ) c\n( ) x \n( ) d\n(x) e\n');
- });
- it('recognizes x as a selection if it is first non whitespace and has whitespace with other non-whitespace', function() {
- const revisedSelection = MarkdownEditingDescriptor.insertMultipleChoice(' x correct\n x \nex post facto\nb x c\nx c\nxxp');
- expect(revisedSelection).toEqual('(x) correct\n( ) x \n( ) ex post facto\n( ) b x c\n(x) c\n( ) xxp\n');
- });
- it('removes multiple newlines but not last one', function() {
- const revisedSelection = MarkdownEditingDescriptor.insertMultipleChoice('a\nx b\n\n\nc\n');
- expect(revisedSelection).toEqual('( ) a\n(x) b\n( ) c\n');
- });
- });
-
- describe('insertCheckboxChoice', function() {
- // Note, shares code with insertMultipleChoice. Therefore only doing smoke test.
- it('inserts the template if selection is empty', function() {
- const revisedSelection = MarkdownEditingDescriptor.insertCheckboxChoice('');
- expect(revisedSelection).toEqual(MarkdownEditingDescriptor.checkboxChoiceTemplate);
- });
- it('wraps existing text', function() {
- const revisedSelection = MarkdownEditingDescriptor.insertCheckboxChoice('foo\nbar');
- expect(revisedSelection).toEqual('[ ] foo\n[ ] bar\n');
- });
- });
-
- describe('insertStringInput', function() {
- it('inserts the template if selection is empty', function() {
- const revisedSelection = MarkdownEditingDescriptor.insertStringInput('');
- expect(revisedSelection).toEqual(MarkdownEditingDescriptor.stringInputTemplate);
- });
- it('wraps existing text', function() {
- const revisedSelection = MarkdownEditingDescriptor.insertStringInput('my text');
- expect(revisedSelection).toEqual('= my text');
- });
- });
-
- describe('insertNumberInput', function() {
- it('inserts the template if selection is empty', function() {
- const revisedSelection = MarkdownEditingDescriptor.insertNumberInput('');
- expect(revisedSelection).toEqual(MarkdownEditingDescriptor.numberInputTemplate);
- });
- it('wraps existing text', function() {
- const revisedSelection = MarkdownEditingDescriptor.insertNumberInput('my text');
- expect(revisedSelection).toEqual('= my text');
- });
- });
-
- describe('insertSelect', function() {
- it('inserts the template if selection is empty', function() {
- const revisedSelection = MarkdownEditingDescriptor.insertSelect('');
- expect(revisedSelection).toEqual(MarkdownEditingDescriptor.selectTemplate);
- });
- it('wraps existing text', function() {
- const revisedSelection = MarkdownEditingDescriptor.insertSelect('my text');
- expect(revisedSelection).toEqual('[[my text]]');
- });
- });
-
- describe('insertHeader', function() {
- it('inserts the template if selection is empty', function() {
- const revisedSelection = MarkdownEditingDescriptor.insertHeader('');
- expect(revisedSelection).toEqual(MarkdownEditingDescriptor.headerTemplate);
- });
- it('wraps existing text', function() {
- const revisedSelection = MarkdownEditingDescriptor.insertHeader('my text');
- expect(revisedSelection).toEqual('my text\n====\n');
- });
- });
-
- describe('insertExplanation', function() {
- it('inserts the template if selection is empty', function() {
- const revisedSelection = MarkdownEditingDescriptor.insertExplanation('');
- expect(revisedSelection).toEqual(MarkdownEditingDescriptor.explanationTemplate);
- });
- it('wraps existing text', function() {
- const revisedSelection = MarkdownEditingDescriptor.insertExplanation('my text');
- expect(revisedSelection).toEqual('[explanation]\nmy text\n[explanation]');
- });
- });
-
- describe('markdownToXml', function() {
- it('converts raw text to paragraph', function() {
- const data = MarkdownEditingDescriptor.markdownToXml('foo');
- expect(data).toXMLEqual('\n
foo
\n');
- });
- // test default templates
- it('converts numerical response to xml', function() {
- const data = MarkdownEditingDescriptor.markdownToXml(`A numerical response problem accepts a line of text input from the student, and evaluates the input for correctness based on its numerical value.
-
-The answer is correct if it is within a specified numerical tolerance of the expected answer.
-
-Enter the numerical value of Pi:
-= 3.14159 +- .02
-
-Enter the approximate value of 502*9:
-= 502*9 +- 15%
-
-Enter the approximate number of atoms in a mol:
-= 6.022e23 +- 10%
-
-Enter the number of fingers on a human hand:
-= 5
-
-Range tolerance case
-= [6, 7]
-= (1, 2)
-
-If first and last symbols are not brackets, or they are not closed, stringresponse will appear.
-= (7), 7
-= (1+2
-
-Just input 100 test. Stringresponse will appear:
-= 100 test
-
-[Explanation]
-Pi, or the the ratio between a circle's circumference to its diameter, is an irrational number known to extreme precision. It is value is approximately equal to 3.14.
-
-Although you can get an exact value by typing 502*9 into a calculator, the result will be close to 500*10, or 5,000. The grader accepts any response within 15% of the true value, 4518, so that you can use any estimation technique that you like.
-
-If you look at your hand, you can count that you have five fingers.
-[Explanation]\
-`);
- expect(data).toXMLEqual(`
-
A numerical response problem accepts a line of text input from the student, and evaluates the input for correctness based on its numerical value.
-
The answer is correct if it is within a specified numerical tolerance of the expected answer.
-
Enter the numerical value of Pi:
-
-
-
-
-
Enter the approximate value of 502*9:
-
-
-
-
-
Enter the approximate number of atoms in a mol:
-
-
-
-
-
Enter the number of fingers on a human hand:
-
-
-
-
Range tolerance case
-
-
-
-
-
-
-
If first and last symbols are not brackets, or they are not closed, stringresponse will appear.
-
-
-
-
-
-
-
Just input 100 test. Stringresponse will appear:
-
-
-
-
-
-
Explanation
-
Pi, or the the ratio between a circle's circumference to its diameter, is an irrational number known to extreme precision. It is value is approximately equal to 3.14.
-
Although you can get an exact value by typing 502*9 into a calculator, the result will be close to 500*10, or 5,000. The grader accepts any response within 15% of the true value, 4518, so that you can use any estimation technique that you like.
-
If you look at your hand, you can count that you have five fingers.
-
-
-`);
- });
- it('will convert 0 as a numerical response (instead of string response)', function() {
- const data = MarkdownEditingDescriptor.markdownToXml(`\
-Enter 0 with a tolerance:
-= 0 +- .02\
-`);
- expect(data).toXMLEqual(`
-
-
Enter 0 with a tolerance:
-
-
-
-
-
-`);
- });
- it('markup with additional answer does not break numerical response', function() {
- const data = MarkdownEditingDescriptor.markdownToXml(`\
-Enter 1 with a tolerance:
-= 1 +- .02
-or= 2\
-`);
- expect(data).toXMLEqual(`
-
-
Enter 1 with a tolerance:
-
-
-
-
-
-`
- );
- });
- it('markup for numerical with multiple additional answers renders correctly', function() {
- const data = MarkdownEditingDescriptor.markdownToXml(`\
-Enter 1 with a tolerance:
-= 1 +- .02
-or= 2
-or= 3\
-`);
- expect(data).toXMLEqual(`
-
-
-
-
-
-
-
-
-`
- );
- });
- it('markup with feedback renders correctly in additional answer for numerical response', function() {
- const data = MarkdownEditingDescriptor.markdownToXml(`\
-Enter 1 with a tolerance:
-= 100 +- .02 {{ main feedback }}
-or= 10 {{ additional feedback }}\
-`);
- expect(data).toXMLEqual(`
-
-
Enter 1 with a tolerance:
-
-
- additional feedback
-
-
- main feedback
-
-
-`
- );
- });
- it('converts multiple choice to xml', function() {
- const data = MarkdownEditingDescriptor.markdownToXml(`A multiple choice problem presents radio buttons for student input. Students can only select a single option presented. Multiple Choice questions have been the subject of many areas of research due to the early invention and adoption of bubble sheets.
-
-One of the main elements that goes into a good multiple choice question is the existence of good distractors. That is, each of the alternate responses presented to the student should be the result of a plausible mistake that a student might make.
-
->>What Apple device competed with the portable CD player?<<
-( ) The iPad
-( ) Napster
-(x) The iPod
-( ) The vegetable peeler
-( ) Android
-( ) The Beatles
-
-[Explanation]
-The release of the iPod allowed consumers to carry their entire music library with them in a format that did not rely on fragile and energy-intensive spinning disks.
-[Explanation]\
-`);
- expect(data).toXMLEqual(`
-
-
A multiple choice problem presents radio buttons for student input. Students can only select a single option presented. Multiple Choice questions have been the subject of many areas of research due to the early invention and adoption of bubble sheets.
-
One of the main elements that goes into a good multiple choice question is the existence of good distractors. That is, each of the alternate responses presented to the student should be the result of a plausible mistake that a student might make.
-
-
- The iPad
- Napster
- The iPod
- The vegetable peeler
- Android
- The Beatles
-
-
-
-
Explanation
-
The release of the iPod allowed consumers to carry their entire music library with them in a format that did not rely on fragile and energy-intensive spinning disks.
-
-
-
-`);
- });
- it('converts multiple choice shuffle to xml', function() {
- const data = MarkdownEditingDescriptor.markdownToXml(`A multiple choice problem presents radio buttons for student input. Students can only select a single option presented. Multiple Choice questions have been the subject of many areas of research due to the early invention and adoption of bubble sheets.
-
-One of the main elements that goes into a good multiple choice question is the existence of good distractors. That is, each of the alternate responses presented to the student should be the result of a plausible mistake that a student might make.
-
-What Apple device competed with the portable CD player?
-(!x@) The iPad
-(@) Napster
-() The iPod
-( ) The vegetable peeler
-( ) Android
-(@) The Beatles
-
-[Explanation]
-The release of the iPod allowed consumers to carry their entire music library with them in a format that did not rely on fragile and energy-intensive spinning disks.
-[Explanation]\
-`);
- expect(data).toXMLEqual(`\
-
-
-
A multiple choice problem presents radio buttons for student input. Students can only select a single option presented. Multiple Choice questions have been the subject of many areas of research due to the early invention and adoption of bubble sheets.
-
One of the main elements that goes into a good multiple choice question is the existence of good distractors. That is, each of the alternate responses presented to the student should be the result of a plausible mistake that a student might make.
-
What Apple device competed with the portable CD player?
-
- The iPad
- Napster
- The iPod
- The vegetable peeler
- Android
- The Beatles
-
-
-
-
Explanation
-
The release of the iPod allowed consumers to carry their entire music library with them in a format that did not rely on fragile and energy-intensive spinning disks.
-
-
-
-`);
- });
-
- it('converts a series of multiplechoice to xml', function() {
- const data = MarkdownEditingDescriptor.markdownToXml(`bleh
-(!x) a
-() b
-() c
-yatta
-( ) x
-( ) y
-(x) z
-testa
-(!) i
-( ) ii
-(x) iii
-[Explanation]
-When the student is ready, the explanation appears.
-[Explanation]\
-`);
- expect(data).toXMLEqual(`\
-
-
bleh
-
-
- a
- b
- c
-
-
-
yatta
-
-
- x
- y
- z
-
-
-
testa
-
-
- i
- ii
- iii
-
-
-
-
-
Explanation
-
When the student is ready, the explanation appears.
-
-
-`);
- });
-
- it('converts OptionResponse to xml', function() {
- const data = MarkdownEditingDescriptor.markdownToXml(`OptionResponse gives a limited set of options for students to respond with, and presents those options in a format that encourages them to search for a specific answer rather than being immediately presented with options from which to recognize the correct answer.
-
-The answer options and the identification of the correct answer is defined in the optioninput tag.
-
-Translation between Option Response and __________ is extremely straightforward:
-[[(Multiple Choice), String Response, Numerical Response, External Response, Image Response]]
-
-[Explanation]
-Multiple Choice also allows students to select from a variety of pre-written responses, although the format makes it easier for students to read very long response options. Optionresponse also differs slightly because students are more likely to think of an answer and then search for it rather than relying purely on recognition to answer the question.
-[Explanation]\
-`);
- expect(data).toXMLEqual(`\
-
-
-
OptionResponse gives a limited set of options for students to respond with, and presents those options in a format that encourages them to search for a specific answer rather than being immediately presented with options from which to recognize the correct answer.
-
The answer options and the identification of the correct answer is defined in the optioninput tag.
-
Translation between Option Response and __________ is extremely straightforward:
-
-
-
-
Explanation
-
Multiple Choice also allows students to select from a variety of pre-written responses, although the format makes it easier for students to read very long response options. Optionresponse also differs slightly because students are more likely to think of an answer and then search for it rather than relying purely on recognition to answer the question.
-
-
-
-`);
- });
- it('converts StringResponse to xml', function() {
- const data = MarkdownEditingDescriptor.markdownToXml(`A string response problem accepts a line of text input from the student, and evaluates the input for correctness based on an expected answer within each input box.
-
-The answer is correct if it matches every character of the expected answer. This can be a problem with international spelling, dates, or anything where the format of the answer is not clear.
-
-Which US state has Lansing as its capital?
-= Michigan
-
-[Explanation]
-Lansing is the capital of Michigan, although it is not Michgan's largest city, or even the seat of the county in which it resides.
-[Explanation]\
-`);
- expect(data).toXMLEqual(`\
-
-
-
A string response problem accepts a line of text input from the student, and evaluates the input for correctness based on an expected answer within each input box.
-
The answer is correct if it matches every character of the expected answer. This can be a problem with international spelling, dates, or anything where the format of the answer is not clear.
-
Which US state has Lansing as its capital?
-
-
-
-
Explanation
-
Lansing is the capital of Michigan, although it is not Michgan's largest city, or even the seat of the county in which it resides.
-
-
-
-`);
- });
- it('converts StringResponse with regular expression to xml', function() {
- const data = MarkdownEditingDescriptor.markdownToXml(`Who lead the civil right movement in the United States of America?
-= | \w*\.?\s*Luther King\s*.*
-
-[Explanation]
-Test Explanation.
-[Explanation]\
-`);
- expect(data).toXMLEqual(`\
-
-
-
Who lead the civil right movement in the United States of America?
-
-
-
-
Explanation
-
Test Explanation.
-
-
-
-`);
- });
- it('converts StringResponse with multiple answers to xml', function() {
- const data = MarkdownEditingDescriptor.markdownToXml(`Who lead the civil right movement in the United States of America?
-= Dr. Martin Luther King Jr.
-or= Doctor Martin Luther King Junior
-or= Martin Luther King
-or= Martin Luther King Junior
-
-[Explanation]
-Test Explanation.
-[Explanation]\
-`);
- expect(data).toXMLEqual(`\
-
-
-
Who lead the civil right movement in the United States of America?
-
-
-
-
-
-
-
Explanation
-
Test Explanation.
-
-
-
-`);
- });
- it('converts StringResponse with multiple answers and regular expressions to xml', function() {
- const data = MarkdownEditingDescriptor.markdownToXml(`Write a number from 1 to 4.
-=| ^One$
-or= two
-or= ^thre+
-or= ^4|Four$
-
-[Explanation]
-Test Explanation.
-[Explanation]\
-`);
- expect(data).toXMLEqual(`\
-
-
-
Write a number from 1 to 4.
-
-
-
-
-
-
-
Explanation
-
Test Explanation.
-
-
-
-`);
- });
- // test labels
- it('converts markdown labels to label attributes', function() {
- const data = MarkdownEditingDescriptor.markdownToXml(`>>Who lead the civil right movement in the United States of America?<<
-= | \w*\.?\s*Luther King\s*.*
-
-[Explanation]
-Test Explanation.
-[Explanation]\
-`);
- expect(data).toXMLEqual(`\
-
-
-
-
-
-
-
Explanation
-
Test Explanation.
-
-
-
-`);
- });
- it('handles multiple questions with labels', function() {
- const data = MarkdownEditingDescriptor.markdownToXml(`\
-France is a country in Europe.
-
->>What is the capital of France?<<
-= Paris
-
-Germany is a country in Europe, too.
-
->>What is the capital of Germany?<<
-( ) Bonn
-( ) Hamburg
-(x) Berlin
-( ) Donut\
-`);
- expect(data).toXMLEqual(`\
-
-
France is a country in Europe.
-
-
-
-
-
-
-
Germany is a country in Europe, too.
-
-
-
-
- Bonn
- Hamburg
- Berlin
- Donut
-
-
-`);
- });
- it('tests multiple questions with only one label', function() {
- const data = MarkdownEditingDescriptor.markdownToXml(`\
-France is a country in Europe.
-
->>What is the capital of France?<<
-= Paris
-
-Germany is a country in Europe, too.
-
-What is the capital of Germany?
-( ) Bonn
-( ) Hamburg
-(x) Berlin
-( ) Donut\
-`);
- expect(data).toXMLEqual(`\
-
-
France is a country in Europe.
-
-
-
-
-
-
-
Germany is a country in Europe, too.
-
-
What is the capital of Germany?
-
-
- Bonn
- Hamburg
- Berlin
- Donut
-
-
-`);
- });
-
- it('adds labels to formulae', function() {
- const data = MarkdownEditingDescriptor.markdownToXml(`\
->>Enter the numerical value of Pi:<<
-= 3.14159 +- .02\
-`);
- expect(data).toXMLEqual(`
-
-
-
-
-
-
-
-`);
- });
-
- // test oddities
- it('converts headers and oddities to xml', function() {
- const data = MarkdownEditingDescriptor.markdownToXml(`Not a header
-A header
-==============
-
-Multiple choice w/ parentheticals
-( ) option (with parens)
-( ) xd option (x)
-()) parentheses inside
-() no space b4 close paren
-
-Choice checks
-[ ] option1 [x]
-[x] correct
-[x] redundant
-[(] distractor
-[] no space
-
-Option with multiple correct ones
-[[one option, (correct one), (should not be correct)]]
-
-Option with embedded parens
-[[My (heart), another, (correct)]]
-
-What happens w/ empty correct options?
-[[()]]
-
-[Explanation]see[/expLanation]
-
-[explanation]
-orphaned start
-
-No p tags in the below
-
-
-But in this there should be
-
-
-[code]
-Code should be nicely monospaced.
-[/code]\
-`);
- expect(data).toXMLEqual(`\
-
-
Not a header
-
A header
-
Multiple choice w/ parentheticals
-
-
- option (with parens)
- xd option (x)
- parentheses inside
- no space b4 close paren
-
-
-
Choice checks
-
-
- option1 [x]
- correct
- redundant
- distractor
- no space
-
-
-
Option with multiple correct ones
-
-
-
-
Option with embedded parens
-
-
-
-
What happens w/ empty correct options?
-
-
-
-
-
-
Explanation
-
see
-
-
-
[explanation]
-
orphaned start
-
No p tags in the below
-
-
But in this there should be
-
-
Great ideas require offsetting.
-
bad tests require drivel
-
-
- Code should be nicely monospaced.
-
-
-`);
- });
-
- it('can separate responsetypes based on ---', function() {
- const data = MarkdownEditingDescriptor.markdownToXml(`\
-Multiple choice problems allow learners to select only one option. Learners can see all the options along with the problem text.
-
->>Which of the following countries has the largest population?<<
-( ) Brazil {{ timely feedback -- explain why an almost correct answer is wrong }}
-( ) Germany
-(x) Indonesia
-( ) Russia
-
-[explanation]
-According to September 2014 estimates:
-The population of Indonesia is approximately 250 million.
-The population of Brazil is approximately 200 million.
-The population of Russia is approximately 146 million.
-The population of Germany is approximately 81 million.
-[explanation]
-
----
-
-Checkbox problems allow learners to select multiple options. Learners can see all the options along with the problem text.
-
->>The following languages are in the Indo-European family:<<
-[x] Urdu
-[ ] Finnish
-[x] Marathi
-[x] French
-[ ] Hungarian
-
-Note: Make sure you select all of the correct options—there may be more than one!
-
-[explanation]
-Urdu, Marathi, and French are all Indo-European languages, while Finnish and Hungarian are in the Uralic family.
-[explanation]
-\
-`);
- expect(data).toXMLEqual(`\
-
-
-
Multiple choice problems allow learners to select only one option. Learners can see all the options along with the problem text.
-
-
- Brazil timely feedback -- explain why an almost correct answer is wrong
-
- Germany
- Indonesia
- Russia
-
-
-
-
Explanation
-
According to September 2014 estimates:
-
The population of Indonesia is approximately 250 million.
-
The population of Brazil is approximately 200 million.
-
The population of Russia is approximately 146 million.
-
The population of Germany is approximately 81 million.
-
-
-
-
-
-
Checkbox problems allow learners to select multiple options. Learners can see all the options along with the problem text.
-
-
- Urdu
- Finnish
- Marathi
- French
- Hungarian
-
-
Note: Make sure you select all of the correct options—there may be more than one!
-
-
-
Explanation
-
Urdu, Marathi, and French are all Indo-European languages, while Finnish and Hungarian are in the Uralic family.
-
-
-
-\
-`);
- });
-
- it('can separate other things based on ---', function() {
- const data = MarkdownEditingDescriptor.markdownToXml(`\
-Multiple choice problems allow learners to select only one option. Learners can see all the options along with the problem text.
-
----
-
->>Which of the following countries has the largest population?<<
-( ) Brazil {{ timely feedback -- explain why an almost correct answer is wrong }}
-( ) Germany
-(x) Indonesia
-( ) Russia
-
-[explanation]
-According to September 2014 estimates:
-The population of Indonesia is approximately 250 million.
-The population of Brazil is approximately 200 million.
-The population of Russia is approximately 146 million.
-The population of Germany is approximately 81 million.
-[explanation]\
-`);
- expect(data).toXMLEqual(`\
-
-
Multiple choice problems allow learners to select only one option. Learners can see all the options along with the problem text.
-
-
-
-
- Brazil timely feedback -- explain why an almost correct answer is wrong
-
- Germany
- Indonesia
- Russia
-
-
-
-
Explanation
-
According to September 2014 estimates:
-
The population of Indonesia is approximately 250 million.
-
The population of Brazil is approximately 200 million.
-
The population of Russia is approximately 146 million.
-
The population of Germany is approximately 81 million.
-
-
-
-\
-`);
- });
-
- it('can do separation if spaces are present around ---', function() {
- const data = MarkdownEditingDescriptor.markdownToXml(`\
->>The following languages are in the Indo-European family:||There are three correct choices.<<
-[x] Urdu
-[ ] Finnish
-[x] Marathi
-[x] French
-[ ] Hungarian
-
- ---
-
->>Which of the following countries has the largest population?||You have only choice.<<
-( ) Brazil {{ timely feedback -- explain why an almost correct answer is wrong }}
-( ) Germany
-(x) Indonesia
-( ) Russia\
-`);
- expect(data).toXMLEqual(`\
-
-
-
- There are three correct choices.
-
- Urdu
- Finnish
- Marathi
- French
- Hungarian
-
-
-
-
-
- You have only choice.
-
- Brazil
- timely feedback -- explain why an almost correct answer is wrong
-
- Germany
- Indonesia
- Russia
-
-
-\
-`);
- });
-
- it('can extract question description', function() {
- const data = MarkdownEditingDescriptor.markdownToXml(`\
->>The following languages are in the Indo-European family:||Choose wisely.<<
-[x] Urdu
-[ ] Finnish
-[x] Marathi
-[x] French
-[ ] Hungarian\
-`);
- expect(data).toXMLEqual(`\
-
-
-
- Choose wisely.
-
- Urdu
- Finnish
- Marathi
- French
- Hungarian
-
-
-\
-`);
- });
-
- it('can handle question and description spanned across multiple lines', function() {
- const data = MarkdownEditingDescriptor.markdownToXml(`\
->>The following languages
-are in the
-Indo-European family:
-||
-first second
-third
-<<
-[x] Urdu
-[ ] Finnish
-[x] Marathi\
-`);
- expect(data).toXMLEqual(`\
-
-
-
- first second third
-
- Urdu
- Finnish
- Marathi
-
-
-\
-`);
- });
-
- it('will not add empty description', function() {
- const data = MarkdownEditingDescriptor.markdownToXml(`\
->>The following languages are in the Indo-European family:||<<
-[x] Urdu
-[ ] Finnish\
-`);
- expect(data).toXMLEqual(`\
-
-
-
-
- Urdu
- Finnish
-
-
-\
-`);
- });
-
- it('should throw error if an option does not have any text associated with it', function() {
- let problemContent = `\
->>The following languages are in the Indo-European family:||<<
-[ ]
-[x] Urdu
-[ ] Finnish\
-`
- expect(function(){ MarkdownEditingDescriptor.markdownToXml(problemContent); }).toThrow(
- new Error(gettext("An answer option has been left blank. Please review and edit the component."))
- );
-
- problemContent = `\
->>The following languages are in the Indo-European family:||<<
-( )
-(x) Urdu
-( ) Finnish\
-`
- expect(function(){ MarkdownEditingDescriptor.markdownToXml(problemContent); }).toThrow(
- new Error(gettext("An answer option has been left blank. Please review and edit the component."))
- );
- });
- });
-});
diff --git a/xmodule/js/spec/problem/edit_spec_hint.js b/xmodule/js/spec/problem/edit_spec_hint.js
deleted file mode 100644
index 419421e26aff..000000000000
--- a/xmodule/js/spec/problem/edit_spec_hint.js
+++ /dev/null
@@ -1,1029 +0,0 @@
-// This file tests the parsing of extended-hints, double bracket sections {{ .. }}
-// for all sorts of markdown.
-describe('Markdown to xml extended hint dropdown', function() {
- it('produces xml', function() {
- const data = MarkdownEditingDescriptor.markdownToXml(`\
-Translation between Dropdown and ________ is straightforward.
-
-[[
- (Multiple Choice) {{ Good Job::Yes, multiple choice is the right answer. }}
- Text Input {{ No, text input problems don't present options. }}
- Numerical Input {{ No, numerical input problems don't present options. }}
-]]
-
-
-
-Clowns have funny _________ to make people laugh.
-
-[[
- dogs {{ NOPE::Not dogs, not cats, not toads }}
- (FACES) {{ With lots of makeup, doncha know?}}
-
- money {{ Clowns don't have any money, of course }}
- donkeys {{don't be an ass.}}
- -no hint-
-]]
-\
-`);
- expect(data).toXMLEqual(`\
-
-
Translation between Dropdown and ________ is straightforward.
-
-
-
-
-
-
-
-
Clowns have funny _________ to make people laugh.
-
-
-
-
-
-
-
-
-
-\
-`);
- });
-
- it('produces xml with demand hint', function() {
- const data = MarkdownEditingDescriptor.markdownToXml(`\
-Translation between Dropdown and ________ is straightforward.
-
-[[
- (Right) {{ Good Job::yes }}
- Wrong 1 {{no}}
- Wrong 2 {{ Label::no }}
-]]
-
-|| 0) zero ||
-|| 1) one ||
-|| 2) two ||\
-`);
- expect(data).toXMLEqual(`\
-
-
-
Translation between Dropdown and ________ is straightforward.
-
-
-
-
-
-
-
-
- 0) zero
- 1) one
- 2) two
-
-\
-`);
- });
-
- it('produces xml with single-line markdown syntax', function() {
- const data = MarkdownEditingDescriptor.markdownToXml(`\
-A Question ________ is answered.
-
-[[(Right), Wrong 1, Wrong 2]]
-|| 0) zero ||
-|| 1) one ||\
-`);
- expect(data).toXMLEqual(`\
-
-
-
A Question ________ is answered.
-
-
-
-
- 0) zero
- 1) one
-
-\
-`);
- });
-
- it('produces xml with fewer newlines', function() {
- const data = MarkdownEditingDescriptor.markdownToXml(`\
->>q1<<
-[[ (aa) {{ hint1 }}
- bb
- cc {{ hint2 }} ]]\
-`);
- expect(data).toXMLEqual(`\
-
-
-
-
-
-
-
-
-
-
-
-\
-`);
- });
-
- it('produces xml even with lots of whitespace', function() {
- const data = MarkdownEditingDescriptor.markdownToXml(`\
->>q1<<
-[[
-
-
- aa {{ hint1 }}
-
- bb {{ hint2 }}
- (cc)
-
- ]]\
-`);
- expect(data).toXMLEqual(`\
-
-
-
-
-
-
-
-
-
-
-
-\
-`);
- });
-});
-
-describe('Markdown to xml extended hint checkbox', function() {
- it('produces xml', function() {
- const data = MarkdownEditingDescriptor.markdownToXml(`\
->>Select all the fruits from the list<<
-
-[x] Apple {{ selected: You're right that apple is a fruit. }, {unselected: Remember that apple is also a fruit.}}
-[ ] Mushroom {{U: You're right that mushrooms aren't fruit}, { selected: Mushroom is a fungus, not a fruit.}}
-[x] Grape {{ selected: You're right that grape is a fruit }, {unselected: Remember that grape is also a fruit.}}
-[ ] Mustang
-[ ] Camero {{S:I don't know what a Camero is but it isn't a fruit.},{U:What is a camero anyway?}}
-
-
-{{ ((A*B)) You're right that apple is a fruit, but there's one you're missing. Also, mushroom is not a fruit.}}
-{{ ((B*C)) You're right that grape is a fruit, but there's one you're missing. Also, mushroom is not a fruit. }}
-
-
->>Select all the vegetables from the list<<
-
-[ ] Banana {{ selected: No, sorry, a banana is a fruit. }, {unselected: poor banana.}}
-[ ] Ice Cream
-[ ] Mushroom {{U: You're right that mushrooms aren't vegetables.}, { selected: Mushroom is a fungus, not a vegetable.}}
-[x] Brussel Sprout {{S: Brussel sprouts are vegetables.}, {u: Brussel sprout is the only vegetable in this list.}}
-
-
-{{ ((A*B)) Making a banana split? }}
-{{ ((B*D)) That will make a horrible dessert: a brussel sprout split? }}\
-`);
- expect(data).toXMLEqual(`\
-
-
-
-
- Apple
- You're right that apple is a fruit.
- Remember that apple is also a fruit.
-
- Mushroom
- Mushroom is a fungus, not a fruit.
- You're right that mushrooms aren't fruit
-
- Grape
- You're right that grape is a fruit
- Remember that grape is also a fruit.
-
- Mustang
- Camero
- I don't know what a Camero is but it isn't a fruit.
- What is a camero anyway?
-
- You're right that apple is a fruit, but there's one you're missing. Also, mushroom is not a fruit.
- You're right that grape is a fruit, but there's one you're missing. Also, mushroom is not a fruit.
-
-
-
-
-
-
- Banana
- No, sorry, a banana is a fruit.
- poor banana.
-
- Ice Cream
- Mushroom
- Mushroom is a fungus, not a vegetable.
- You're right that mushrooms aren't vegetables.
-
- Brussel Sprout
- Brussel sprouts are vegetables.
- Brussel sprout is the only vegetable in this list.
-
- Making a banana split?
- That will make a horrible dessert: a brussel sprout split?
-
-
-\
-`);
- });
-
- it('produces xml also with demand hints', function() {
- const data = MarkdownEditingDescriptor.markdownToXml(`\
->>Select all the fruits from the list<<
-
-[x] Apple {{ selected: You're right that apple is a fruit. }, {unselected: Remember that apple is also a fruit.}}
-[ ] Mushroom {{U: You're right that mushrooms aren't fruit}, { selected: Mushroom is a fungus, not a fruit.}}
-[x] Grape {{ selected: You're right that grape is a fruit }, {unselected: Remember that grape is also a fruit.}}
-[ ] Mustang
-[ ] Camero {{S:I don't know what a Camero is but it isn't a fruit.},{U:What is a camero anyway?}}
-
-{{ ((A*B)) You're right that apple is a fruit, but there's one you're missing. Also, mushroom is not a fruit.}}
-{{ ((B*C)) You're right that grape is a fruit, but there's one you're missing. Also, mushroom is not a fruit.}}
-
->>Select all the vegetables from the list<<
-
-[ ] Banana {{ selected: No, sorry, a banana is a fruit. }, {unselected: poor banana.}}
-[ ] Ice Cream
-[ ] Mushroom {{U: You're right that mushrooms aren't vegatbles}, { selected: Mushroom is a fungus, not a vegetable.}}
-[x] Brussel Sprout {{S: Brussel sprouts are vegetables.}, {u: Brussel sprout is the only vegetable in this list.}}
-
-{{ ((A*B)) Making a banana split? }}
-{{ ((B*D)) That will make a horrible dessert: a brussel sprout split? }}
-
-|| Hint one.||
-|| Hint two. ||
-|| Hint three. ||\
-`);
- expect(data).toXMLEqual(`\
-
-
-
-
- Apple
- You're right that apple is a fruit.
- Remember that apple is also a fruit.
-
- Mushroom
- Mushroom is a fungus, not a fruit.
- You're right that mushrooms aren't fruit
-
- Grape
- You're right that grape is a fruit
- Remember that grape is also a fruit.
-
- Mustang
- Camero
- I don't know what a Camero is but it isn't a fruit.
- What is a camero anyway?
-
- You're right that apple is a fruit, but there's one you're missing. Also, mushroom is not a fruit.
- You're right that grape is a fruit, but there's one you're missing. Also, mushroom is not a fruit.
-
-
-
-
-
-
- Banana
- No, sorry, a banana is a fruit.
- poor banana.
-
- Ice Cream
- Mushroom
- Mushroom is a fungus, not a vegetable.
- You're right that mushrooms aren't vegatbles
-
- Brussel Sprout
- Brussel sprouts are vegetables.
- Brussel sprout is the only vegetable in this list.
-
- Making a banana split?
- That will make a horrible dessert: a brussel sprout split?
-
-
-
-
- Hint one.
- Hint two.
- Hint three.
-
-\
-`);
- });
-});
-
-
-describe('Markdown to xml extended hint multiple choice', function() {
- it('produces xml', function() {
- const data = MarkdownEditingDescriptor.markdownToXml(`\
->>Select the fruit from the list<<
-
-() Mushroom {{ Mushroom is a fungus, not a fruit.}}
-() Potato
-(x) Apple {{ OUTSTANDING::Apple is indeed a fruit.}}
-
->>Select the vegetables from the list<<
-
-() Mushroom {{ Mushroom is a fungus, not a vegetable.}}
-(x) Potato {{ Potato is a root vegetable. }}
-() Apple {{ OOPS::Apple is a fruit.}}\
-`);
- expect(data).toXMLEqual(`\
-
-
-
-
- Mushroom
- Mushroom is a fungus, not a fruit.
-
- Potato
- Apple
- Apple is indeed a fruit.
-
-
-
-
-
-
-
- Mushroom
- Mushroom is a fungus, not a vegetable.
-
- Potato
- Potato is a root vegetable.
-
- Apple
- Apple is a fruit.
-
-
-
-\
-`);
- });
-
- it('produces xml with demand hints', function() {
- const data = MarkdownEditingDescriptor.markdownToXml(`\
->>Select the fruit from the list<<
-
-() Mushroom {{ Mushroom is a fungus, not a fruit.}}
-() Potato
-(x) Apple {{ OUTSTANDING::Apple is indeed a fruit.}}
-
-|| 0) spaces on previous line. ||
-|| 1) roses are red. ||
-
->>Select the vegetables from the list<<
-
-() Mushroom {{ Mushroom is a fungus, not a vegetable.}}
-(x) Potato {{ Potato is a root vegetable. }}
-() Apple {{ OOPS::Apple is a fruit.}}
-
-|| 2) where are the lions? ||
-\
-`);
- expect(data).toXMLEqual(`\
-
-
-
-
- Mushroom
- Mushroom is a fungus, not a fruit.
-
- Potato
- Apple
- Apple is indeed a fruit.
-
-
-
-
-
-
-
- Mushroom
- Mushroom is a fungus, not a vegetable.
-
- Potato
- Potato is a root vegetable.
-
- Apple
- Apple is a fruit.
-
-
-
-
-
- 0) spaces on previous line.
- 1) roses are red.
- 2) where are the lions?
-
-\
-`);
- });
-});
-
-
-describe('Markdown to xml extended hint text input', function() {
- it('produces xml', function() {
- const data = MarkdownEditingDescriptor.markdownToXml(`>>In which country would you find the city of Paris?<<
-= France {{ BRAVO::Viva la France! }}
-\
-`);
- expect(data).toXMLEqual(`\
-
-
-
-Viva la France!
-
-
-
-
-\
-`);
- });
-
- it('produces xml with or=', function() {
- const data = MarkdownEditingDescriptor.markdownToXml(`>>Where Paris?<<
-= France {{ BRAVO::hint1}}
-or= USA {{ meh::hint2 }}
-\
-`);
- expect(data).toXMLEqual(`\
-
-
-
-hint1
- hint2
-
-
-
-
-
-\
-`);
- });
-
- it('produces xml with not=', function() {
- const data = MarkdownEditingDescriptor.markdownToXml(`>>Revenge is a dish best served<<
-= cold {{khaaaaaan!}}
-not= warm {{feedback2}}
-\
-`);
- expect(data).toXMLEqual(`\
-
-
-
-khaaaaaan!
- feedback2
-
-
-
-
-\
-`);
- });
-
- it('produces xml with s=', function() {
- const data = MarkdownEditingDescriptor.markdownToXml(`>>q<<
-s= 2 {{feedback1}}
-\
-`);
- expect(data).toXMLEqual(`\
-
-
-
-feedback1
-
-
-
-
-\
-`);
- });
-
- it('produces xml with = and or= and not=', function() {
- const data = MarkdownEditingDescriptor.markdownToXml(`>>q<<
-= aaa
-or= bbb {{feedback1}}
-not= no {{feedback2}}
-or= ccc
-\
-`);
- expect(data).toXMLEqual(`\
-
-
-
-feedback1
-
- feedback2
-
-
-
-
-
-\
-`);
- });
-
- it('produces xml with s= and or=', function() {
- const data = MarkdownEditingDescriptor.markdownToXml(`>>q<<
-s= 2 {{feedback1}}
-or= bbb {{feedback2}}
-or= ccc
-\
-`);
- expect(data).toXMLEqual(`\
-
-
-
-feedback1
- feedback2
-
-
-
-
-
-
-\
-`);
- });
-
- it('produces xml with each = making a new question', function() {
- const data = MarkdownEditingDescriptor.markdownToXml(`\
->>q<<
-= aaa
-or= bbb
-s= ccc\
-`);
- expect(data).toXMLEqual(`\
-
-
-
-
-
-
-
-
-
-\
-`);
- });
-
- it('produces xml with each = making a new question amid blank lines and paragraphs', function() {
- const data = MarkdownEditingDescriptor.markdownToXml(`\
-paragraph
->>q<<
-= aaa
-
-or= bbb
-s= ccc
-
-paragraph 2
-\
-`);
- expect(data).toXMLEqual(`\
-
-
paragraph
-
-
-
-
-
-
-
-
-
paragraph 2
-\
-`);
- });
-
- it('produces xml without a question when or= is just hung out there by itself', function() {
- const data = MarkdownEditingDescriptor.markdownToXml(`\
-paragraph
->>q<<
-or= aaa
-paragraph 2
-\
-`);
- expect(data).toXMLEqual(`\
-
-
paragraph
-
-
or= aaa
-
paragraph 2
-\
-`);
- });
-
- it('produces xml with each = with feedback making a new question', function() {
- const data = MarkdownEditingDescriptor.markdownToXml(`\
->>q<<
-s= aaa
-or= bbb {{feedback1}}
-= ccc {{feedback2}}
-\
-`);
- expect(data).toXMLEqual(`\
-
-
-
-
- feedback1
-
-
-
-
- feedback2
-
-
-\
-`);
- });
-
- it('produces xml with demand hints', function() {
- const data = MarkdownEditingDescriptor.markdownToXml(`>>Where Paris?<<
-= France {{ BRAVO::hint1 }}
-
-|| There are actually two countries with cities named Paris. ||
-|| Paris is the capital of one of those countries. ||
-\
-`);
- expect(data).toXMLEqual(`\
-
-
-
-hint1
-
-
-
-
- There are actually two countries with cities named Paris.
- Paris is the capital of one of those countries.
-
-`);
- });
-});
-
-
-describe('Markdown to xml extended hint numeric input', function() {
- it('produces xml', function() {
- const data = MarkdownEditingDescriptor.markdownToXml(`\
->>Enter the numerical value of Pi:<<
-= 3.14159 +- .02 {{ Pie for everyone! }}
-
->>Enter the approximate value of 502*9:<<
-= 4518 +- 15% {{PIE:: No pie for you!}}
-
->>Enter the number of fingers on a human hand<<
-= 5
-\
-`);
- expect(data).toXMLEqual(`\
-
-
-
-
-
- Pie for everyone!
-
-
-
-
-
-
- No pie for you!
-
-
-
-
-
-
-\
-`);
- });
-
- // The output xml here shows some of the quirks of how historical markdown parsing does or does not put
- // in blank lines.
- it('numeric input with hints and demand hints', function() {
- const data = MarkdownEditingDescriptor.markdownToXml(`\
->>text1<<
-= 1 {{ hint1 }}
-|| hintA ||
->>text2<<
-= 2 {{ hint2 }}
-
-|| hintB ||
-\
-`);
- expect(data).toXMLEqual(`\
-
-
-
-
- hint1
-
-
-
-
- hint2
-
-
-
- hintA
- hintB
-
-\
-`);
- });
-});
-
-
-describe('Markdown to xml extended hint with multiline hints', () =>
- it('produces xml', function() {
- const data = MarkdownEditingDescriptor.markdownToXml(`\
->>Checkboxes<<
-
-[x] A {{
-selected: aaa },
-{unselected:bbb}}
-[ ] B {{U: c}, {
-selected: d.}}
-
-{{ ((A*B)) A*B hint}}
-
->>What is 1 + 1?<<
-= 2 {{ part one, and
- part two
- }}
-
->>hello?<<
-= hello {{
-hello
-hint
-}}
-
->>multiple choice<<
-(x) AA{{hint1}}
-() BB {{
- hint2
-}}
-( ) CC {{ hint3
-}}
-
->>dropdown<<
-[[
- W1 {{
- no }}
- W2 {{
- nope}}
- (C1) {{ yes
- }}
-]]
-
-|| aaa ||
-||bbb||
-|| ccc ||
-\
-`);
- expect(data).toXMLEqual(`\
-
-
-
-
- A
- aaa
- bbb
-
- B
- d.
- c
-
- A*B hint
-
-
-
-
-
-
- part one, and part two
-
-
-
-
- hello hint
-
-
-
-
-
-
- AA
- hint1
-
- BB
- hint2
-
- CC
- hint3
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- aaa
- bbb
- ccc
-
-\
-`);
- })
-);
-
-describe('Markdown to xml extended hint with tricky syntax cases', function() {
- it('produces xml with unicode', function() {
- const data = MarkdownEditingDescriptor.markdownToXml(`\
->>á and Ø<<
-
-(x) Ø{{Ø}}
-() BB
-
-|| Ø ||
-\
-`);
- expect(data).toXMLEqual(`\
-
-
-
-
- Ø
- Ø
-
- BB
-
-
-
-
- Ø
-
-\
-`);
- });
-
- it('produces xml with quote-type characters', function() {
- const data = MarkdownEditingDescriptor.markdownToXml(`\
->>"quotes" aren't \`fun\`<<
-() "hello" {{ isn't }}
-(x) "isn't" {{ "hello" }}
-\
-`);
- expect(data).toXMLEqual(`\
-
-
-
-
- "hello"
- isn't
-
- "isn't"
- "hello"
-
-
-
-\
-`);
- });
-
- it('produces xml with almost but not quite multiple choice syntax', function() {
- const data = MarkdownEditingDescriptor.markdownToXml(`\
->>q1<<
-this (x)
-() a {{ (hint) }}
-(x) b
-that (y)\
-`);
- expect(data).toXMLEqual(`\
-
-
-
-
this (x)
-
- a (hint)
-
- b
-
-
that (y)
-
-
-
-\
-`);
- });
-
- // An incomplete checkbox hint passes through to cue the author
- it('produce xml with almost but not quite checkboxgroup syntax', function() {
- const data = MarkdownEditingDescriptor.markdownToXml(`\
->>q1<<
-this [x]
-[ ] a [square]
-[x] b {{ this hint passes through }}
-that []\
-`);
- expect(data).toXMLEqual(`\
-
-
-
-
this [x]
-
- a [square]
- b {{ this hint passes through }}
-
-
that []
-
-
-
-\
-`);
- });
-
- // It's sort of a pain to edit DOS line endings without some editor or other "fixing" them
- // for you. Therefore, we construct DOS line endings on the fly just for the test.
- it('produces xml with DOS \r\n line endings', function() {
- let markdown = `\
->>q22<<
-
-[[
- (x) {{ hintx
- these
- span
- }}
-
- yy {{ meh::hinty }}
- zzz {{ hintz }}
-]]\
-`;
- markdown = markdown.replace(/\n/g, '\r\n'); // make DOS line endings
- const data = MarkdownEditingDescriptor.markdownToXml(markdown);
- expect(data).toXMLEqual(`\
-
-
-
-
-
-
-
-
-
-
-
-\
-`);
- });
-});
diff --git a/xmodule/js/src/problem/.gitignore b/xmodule/js/src/problem/.gitignore
deleted file mode 100644
index db7cd1fec1d9..000000000000
--- a/xmodule/js/src/problem/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-!edit.js
diff --git a/xmodule/js/src/problem/edit.js b/xmodule/js/src/problem/edit.js
deleted file mode 100644
index 18e49085f3b5..000000000000
--- a/xmodule/js/src/problem/edit.js
+++ /dev/null
@@ -1,905 +0,0 @@
-/* global CodeMirror, _, XModule */
-// no-useless-escape disabled because of warnings in regexp expressions within the
-// "toXML" code. When the "useless escapes" were removed, some of the unit tests
-// failed, but only in Jenkins, indicating browser-specific behavior.
-/* eslint no-useless-escape: 0 */
-
-(function () {
- "use strict";
-
- var hasPropsHelper = {}.hasOwnProperty,
- extendsHelper = function (child, parent) {
- // This helper method was generated by CoffeeScript. Suppressing eslint warnings.
- var key;
- for (key in parent) {
- // eslint-disable-line no-restricted-syntax
- if (hasPropsHelper.call(parent, key)) {
- child[key] = parent[key]; // eslint-disable-line no-param-reassign
- }
- }
- function ctor() {
- this.constructor = child;
- }
-
- ctor.prototype = parent.prototype;
- child.prototype = new ctor(); // eslint-disable-line no-param-reassign
- child.__super__ = parent.prototype; // eslint-disable-line no-param-reassign, no-underscore-dangle
- return child;
- };
-
- this.MarkdownEditingDescriptor = (function (_super) {
- // The style of these declarations come from CoffeeScript. Rather than rewriting them,
- // the eslint warnings are being suppressed.
- extendsHelper(MarkdownEditingDescriptor, _super); // eslint-disable-line no-use-before-define
-
- MarkdownEditingDescriptor.multipleChoiceTemplate =
- "( ) " + // eslint-disable-line no-use-before-define
- gettext("incorrect") +
- "\n( ) " +
- gettext("incorrect") +
- "\n(x) " +
- gettext("correct") +
- "\n";
-
- MarkdownEditingDescriptor.checkboxChoiceTemplate =
- "[x] " + // eslint-disable-line no-use-before-define
- gettext("correct") +
- "\n[ ] incorrect\n[x] correct\n";
-
- MarkdownEditingDescriptor.stringInputTemplate =
- "= " + // eslint-disable-line no-use-before-define
- gettext("answer") +
- "\n";
-
- MarkdownEditingDescriptor.numberInputTemplate =
- "= " + // eslint-disable-line no-use-before-define
- gettext("answer") +
- " +- 0.001%\n";
-
- MarkdownEditingDescriptor.selectTemplate =
- "[[" + // eslint-disable-line no-use-before-define
- gettext("incorrect") +
- ", (" +
- gettext("correct") +
- "), " +
- gettext("incorrect") +
- "]]\n";
-
- MarkdownEditingDescriptor.headerTemplate =
- "" + // eslint-disable-line no-use-before-define
- gettext("Header") +
- "\n=====\n";
-
- MarkdownEditingDescriptor.explanationTemplate =
- "[explanation]\n" + // eslint-disable-line no-use-before-define
- gettext("Short explanation") +
- "\n[explanation]\n";
-
- function MarkdownEditingDescriptor(element) {
- var that = this;
- this.onToolbarButton = function () {
- return MarkdownEditingDescriptor.prototype.onToolbarButton.apply(that, arguments);
- };
- this.onShowXMLButton = function () {
- return MarkdownEditingDescriptor.prototype.onShowXMLButton.apply(that, arguments);
- };
- this.element = element;
- if ($(".markdown-box", this.element).length !== 0) {
- this.markdown_editor = CodeMirror.fromTextArea($(".markdown-box", element)[0], {
- lineWrapping: true,
- mode: null,
- });
- this.setCurrentEditor(this.markdown_editor);
- // Add listeners for toolbar buttons (only present for markdown editor)
- this.element.on("click", ".xml-tab", this.onShowXMLButton);
- this.element.on("click", ".format-buttons button", this.onToolbarButton);
- // Hide the XML text area
- $(this.element.find(".xml-box")).hide();
- } else {
- this.createXMLEditor();
- }
- }
-
- /*
- Creates the XML Editor and sets it as the current editor. If text is passed in,
- it will replace the text present in the HTML template.
-
- text: optional argument to override the text passed in via the HTML template
- */
- MarkdownEditingDescriptor.prototype.createXMLEditor = function (text) {
- this.xml_editor = CodeMirror.fromTextArea($(".xml-box", this.element)[0], {
- mode: "xml",
- lineNumbers: true,
- lineWrapping: true,
- });
- if (text) {
- this.xml_editor.setValue(text);
- }
- this.setCurrentEditor(this.xml_editor);
- $(this.xml_editor.getWrapperElement()).toggleClass("CodeMirror-advanced");
- // Need to refresh to get line numbers to display properly.
- this.xml_editor.refresh();
- };
-
- /*
- User has clicked to show the XML editor. Before XML editor is swapped in,
- the user will need to confirm the one-way conversion.
- */
- MarkdownEditingDescriptor.prototype.onShowXMLButton = function (e) {
- e.preventDefault();
- if (this.confirmConversionToXml()) {
- this.createXMLEditor(MarkdownEditingDescriptor.markdownToXml(this.markdown_editor.getValue()));
- this.xml_editor.setCursor(0);
- // Hide markdown-specific toolbar buttons
- $(this.element.find(".editor-bar")).hide();
- }
- };
-
- /*
- Have the user confirm the one-way conversion to XML.
- Returns true if the user clicked OK, else false.
- */
- MarkdownEditingDescriptor.prototype.confirmConversionToXml = function () {
- return confirm(
- gettext(
- "If you use the Advanced Editor, this problem will be converted to XML and you will not be able to return to the Simple Editor Interface.\n\nProceed to the Advanced Editor and convert this problem to XML?",
- ),
- ); // eslint-disable-line max-len, no-alert
- };
-
- /*
- Event listener for toolbar buttons (only possible when markdown editor is visible).
- */
- MarkdownEditingDescriptor.prototype.onToolbarButton = function (e) {
- var revisedSelection, selection;
- e.preventDefault();
- selection = this.markdown_editor.getSelection();
- revisedSelection = null;
- switch ($(e.currentTarget).attr("class")) {
- case "multiple-choice-button":
- revisedSelection = MarkdownEditingDescriptor.insertMultipleChoice(selection);
- break;
- case "string-button":
- revisedSelection = MarkdownEditingDescriptor.insertStringInput(selection);
- break;
- case "number-button":
- revisedSelection = MarkdownEditingDescriptor.insertNumberInput(selection);
- break;
- case "checks-button":
- revisedSelection = MarkdownEditingDescriptor.insertCheckboxChoice(selection);
- break;
- case "dropdown-button":
- revisedSelection = MarkdownEditingDescriptor.insertSelect(selection);
- break;
- case "header-button":
- revisedSelection = MarkdownEditingDescriptor.insertHeader(selection);
- break;
- case "explanation-button":
- revisedSelection = MarkdownEditingDescriptor.insertExplanation(selection);
- break;
- default:
- break;
- }
- if (revisedSelection !== null) {
- this.markdown_editor.replaceSelection(revisedSelection);
- this.markdown_editor.focus();
- }
- };
-
- /*
- Stores the current editor and hides the one that is not displayed.
- */
- MarkdownEditingDescriptor.prototype.setCurrentEditor = function (editor) {
- if (this.current_editor) {
- $(this.current_editor.getWrapperElement()).hide();
- }
- this.current_editor = editor;
- $(this.current_editor.getWrapperElement()).show();
- return $(this.current_editor).focus();
- };
-
- /*
- Called when save is called. Listeners are unregistered because editing the block again will
- result in a new instance of the descriptor. Note that this is NOT the case for cancel--
- when cancel is called the instance of the descriptor is reused if edit is selected again.
- */
- MarkdownEditingDescriptor.prototype.save = function () {
- this.element.off("click", ".xml-tab", this.changeEditor);
- this.element.off("click", ".format-buttons button", this.onToolbarButton);
- if (this.current_editor === this.markdown_editor) {
- return {
- data: MarkdownEditingDescriptor.markdownToXml(this.markdown_editor.getValue()),
- metadata: {
- markdown: this.markdown_editor.getValue(),
- },
- };
- } else {
- return {
- data: this.xml_editor.getValue(),
- nullout: ["markdown"],
- };
- }
- };
-
- MarkdownEditingDescriptor.insertMultipleChoice = function (selectedText) {
- return MarkdownEditingDescriptor.insertGenericChoice(
- selectedText,
- "(",
- ")",
- MarkdownEditingDescriptor.multipleChoiceTemplate,
- );
- };
-
- MarkdownEditingDescriptor.insertCheckboxChoice = function (selectedText) {
- return MarkdownEditingDescriptor.insertGenericChoice(
- selectedText,
- "[",
- "]",
- MarkdownEditingDescriptor.checkboxChoiceTemplate,
- );
- };
-
- MarkdownEditingDescriptor.insertGenericChoice = function (selectedText, choiceStart, choiceEnd, template) {
- var cleanSelectedText, line, lines, revisedLines, i, len;
- if (selectedText.length > 0) {
- // Replace adjacent newlines with a single newline, strip any trailing newline
- cleanSelectedText = selectedText.replace(/\n+/g, "\n").replace(/\n$/, "");
- lines = cleanSelectedText.split("\n");
- revisedLines = "";
- for (i = 0, len = lines.length; i < len; i++) {
- line = lines[i];
- revisedLines += choiceStart;
- // a stand alone x before other text implies that this option is "correct"
- if (/^\s*x\s+(\S)/i.test(line)) {
- // Remove the x and any initial whitespace as long as there's more text on the line
- line = line.replace(/^\s*x\s+(\S)/i, "$1");
- revisedLines += "x";
- } else {
- revisedLines += " ";
- }
- revisedLines += choiceEnd + " " + line + "\n";
- }
- return revisedLines;
- } else {
- return template;
- }
- };
-
- MarkdownEditingDescriptor.insertStringInput = function (selectedText) {
- return MarkdownEditingDescriptor.insertGenericInput(
- selectedText,
- "= ",
- "",
- MarkdownEditingDescriptor.stringInputTemplate,
- );
- };
-
- MarkdownEditingDescriptor.insertNumberInput = function (selectedText) {
- return MarkdownEditingDescriptor.insertGenericInput(
- selectedText,
- "= ",
- "",
- MarkdownEditingDescriptor.numberInputTemplate,
- );
- };
-
- MarkdownEditingDescriptor.insertSelect = function (selectedText) {
- return MarkdownEditingDescriptor.insertGenericInput(
- selectedText,
- "[[",
- "]]",
- MarkdownEditingDescriptor.selectTemplate,
- );
- };
-
- MarkdownEditingDescriptor.insertHeader = function (selectedText) {
- return MarkdownEditingDescriptor.insertGenericInput(
- selectedText,
- "",
- "\n====\n",
- MarkdownEditingDescriptor.headerTemplate,
- );
- };
-
- MarkdownEditingDescriptor.insertExplanation = function (selectedText) {
- return MarkdownEditingDescriptor.insertGenericInput(
- selectedText,
- "[explanation]\n",
- "\n[explanation]",
- MarkdownEditingDescriptor.explanationTemplate,
- );
- };
-
- MarkdownEditingDescriptor.insertGenericInput = function (selectedText, lineStart, lineEnd, template) {
- if (selectedText.length > 0) {
- return lineStart + selectedText + lineEnd;
- } else {
- return template;
- }
- };
-
- MarkdownEditingDescriptor.markdownToXml = function (markdown) {
- var demandHintTags = [],
- finalDemandHints,
- finalXml,
- responseTypesMarkdown,
- responseTypesXML,
- toXml;
- toXml = function (partialMarkdown) {
- var xml = partialMarkdown,
- i,
- splits,
- makeParagraph,
- serializer,
- responseType,
- $xml,
- responseTypesSelector,
- inputtype,
- beforeInputtype,
- extractHint,
- demandhints;
- var responseTypes = [
- "optionresponse",
- "multiplechoiceresponse",
- "stringresponse",
- "numericalresponse",
- "choiceresponse",
- ];
-
- // fix DOS \r\n line endings to look like \n
- xml = xml.replace(/\r\n/g, "\n");
-
- // replace headers
- xml = xml.replace(/(^.*?$)(?=\n\=\=+$)/gm, '
$1
');
- xml = xml.replace(/\n^\=\=+$/gm, "");
-
- // extract question and description(optional)
- // >>question||description<< converts to
- // description
- xml = xml.replace(/>>([^]+?)<" + result[0] + "\n"; // xss-lint: disable=javascript-concat-html
-
- // don't add empty tag
- if (result.length === 1 || !result[1]) {
- return label;
- }
-
- return label + "" + result[1] + "\n"; // xss-lint: disable=javascript-concat-html
- });
-
- // Pull out demand hints, || a hint ||
- demandhints = "";
- xml = xml.replace(/(^\s*\|\|.*?\|\|\s*$\n?)+/gm, function (match) {
- // $\n
- var inner,
- options = match.split("\n");
- for (i = 0; i < options.length; i += 1) {
- inner = /\s*\|\|(.*?)\|\|/.exec(options[i]);
- if (inner) {
- demandhints += " " + inner[1].trim() + "\n"; // xss-lint: disable=javascript-concat-html
- }
- }
- return "";
- });
-
- // replace \n+whitespace within extended hint {{ .. }}, by a space, so the whole
- // hint sits on one line.
- // This is the one instance of {{ ... }} matching that permits \n
- xml = xml.replace(/{{(.|\n)*?}}/gm, function (match) {
- return match.replace(/\r?\n( |\t)*/g, " ");
- });
-
- // Function used in many places to extract {{ label:: a hint }}.
- // Returns a little hash with various parts of the hint:
- // hint: the hint or empty, nothint: the rest
- // labelassign: javascript assignment of label attribute, or empty
- extractHint = function (inputText, detectParens) {
- var text = inputText,
- curly = /\s*{{(.*?)}}/.exec(text),
- hint = "",
- label = "",
- parens = false,
- labelassign = "",
- labelmatch;
- if (curly) {
- text = text.replace(curly[0], "");
- hint = curly[1].trim();
- labelmatch = /^(.*?)::/.exec(hint);
- if (labelmatch) {
- hint = hint.replace(labelmatch[0], "").trim();
- label = labelmatch[1].trim();
- labelassign = ' label="' + label + '"';
- }
- }
- if (detectParens) {
- if (text.length >= 2 && text[0] === "(" && text[text.length - 1] === ")") {
- text = text.substring(1, text.length - 1);
- parens = true;
- }
- }
- return {
- nothint: text,
- hint: hint,
- label: label,
- parens: parens,
- labelassign: labelassign,
- };
- };
-
- // replace selects
- // [[ a, b, (c) ]]
- // [[
- // a
- // b
- // (c)
- // ]]
- //
- //
- // \n\n"; // xss-lint: disable=javascript-concat-html
- }
-
- // new style [[ many-lines ]]
- lines = group1.split("\n");
- optionlines = "";
- for (i = 0; i < lines.length; i++) {
- line = lines[i].trim();
- if (line.length > 0) {
- textHint = extractHint(line, true);
- if (!textHint.nothint) {
- throw new Error(gettext("An answer option has been left blank. Please review and edit the component."));
- }
- correctstr = ' correct="' + (textHint.parens ? "True" : "False") + '"';
- hintstr = "";
- if (textHint.hint) {
- label = textHint.label;
- if (label) {
- label = ' label="' + label + '"';
- }
-
- hintstr = " " + textHint.hint + ""; // xss-lint: disable=javascript-concat-html
- }
-
- optionlines += " \n"; // xss-lint: disable=javascript-concat-html
- }
- }
-
- return "\n\n \n" + optionlines + " \n\n\n"; // xss-lint: disable=javascript-concat-html
- });
-
- // multiple choice questions
- //
- xml = xml.replace(/(^\s*\(.{0,3}\).*?$\n*)+/gm, function (match) {
- var choices = "",
- shuffle = false,
- options = match.split("\n"),
- value,
- inparens,
- correct,
- fixed,
- hint,
- result;
- for (i = 0; i < options.length; i++) {
- options[i] = options[i].trim(); // trim off leading/trailing whitespace
- if (options[i].length > 0) {
- value = options[i].split(/^\s*\(.{0,3}\)\s*/)[1];
- if (!value) {
- throw new Error(gettext("An answer option has been left blank. Please review and edit the component."));
- }
- inparens = /^\s*\((.{0,3})\)\s*/.exec(options[i])[1];
- correct = /x/i.test(inparens);
- fixed = "";
- if (/@/.test(inparens)) {
- fixed = ' fixed="true"';
- }
- if (/!/.test(inparens)) {
- shuffle = true;
- }
-
- hint = extractHint(value);
- if (hint.hint) {
- value = hint.nothint;
-
- value = value + " " + hint.hint + ""; // xss-lint: disable=javascript-concat-html
- }
-
- choices += ' " + value + "\n"; // xss-lint: disable=javascript-concat-html
- }
- }
- result = "\n";
- if (shuffle) {
- result += ' \n';
- } else {
- result += ' \n';
- }
- result += choices;
- result += " \n";
- result += "\n\n";
- return result;
- });
-
- // group check answers
- // [.] with {{...}} lines mixed in
- xml = xml.replace(/(^\s*((\[.?\])|({{.*?}})).*?$\n*)+/gm, function (match) {
- var groupString = "\n",
- options = match.split("\n"),
- value,
- correct,
- abhint,
- endHints,
- hintbody,
- hint,
- inner,
- select,
- hints;
-
- groupString += " \n";
- endHints = ""; // save these up to emit at the end
-
- for (i = 0; i < options.length; i += 1) {
- if (options[i].trim().length > 0) {
- // detect the {{ ((A*B)) ...}} case first
- // emits: AB hint
-
- abhint = /^\s*{{\s*\(\((.*?)\)\)(.*?)}}/.exec(options[i]);
- if (abhint) {
- // lone case of hint text processing outside of extractHint, since syntax here is unique
- hintbody = abhint[2];
- hintbody = hintbody.replace("&lf;", "\n").trim();
-
- endHints += ' ' + hintbody + "\n"; // xss-lint: disable=javascript-concat-html
- // eslint-disable-next-line no-continue
- continue; // bail
- }
-
- value = options[i].split(/^\s*\[.?\]\s*/)[1];
- if (!value) {
- throw new Error(gettext("An answer option has been left blank. Please review and edit the component."));
- }
- correct = /^\s*\[x\]/i.test(options[i]);
- hints = "";
- // {{ selected: You’re right that apple is a fruit. },
- // {unselected: Remember that apple is also a fruit.}}
- hint = extractHint(value);
- if (hint.hint) {
- inner = "{" + hint.hint + "}"; // parsing is easier if we put outer { } back
-
- // include \n since we are downstream of extractHint()
- select = /{\s*(s|selected):((.|\n)*?)}/i.exec(inner);
- // checkbox choicehints get their own line, since there can be two of them
- // You’re right that apple is a fruit.
- if (select) {
- hints += '\n ' + select[2].trim() + ""; // xss-lint: disable=javascript-concat-html
- }
- select = /{\s*(u|unselected):((.|\n)*?)}/i.exec(inner);
- if (select) {
- hints += '\n ' + select[2].trim() + ""; // xss-lint: disable=javascript-concat-html
- }
-
- // Blank out the original text only if the specific "selected" syntax is found
- // That way, if the user types it wrong, at least they can see it's not processed.
- if (hints) {
- value = hint.nothint;
- }
- }
-
- groupString += ' ' + value + hints + "\n"; // xss-lint: disable=javascript-concat-html
- }
- }
-
- groupString += endHints;
- groupString += " \n";
- groupString += "\n\n";
-
- return groupString;
- });
-
- // replace string and numerical, numericalresponse, stringresponse
- // A fine example of the function-composition programming style.
- xml = xml.replace(/(^s?\=\s*(.*?$)(\n*(or|not)\=\s*(.*?$))*)+/gm, function (match, p) {
- // Line split here, trim off leading xxx= in each function
- var answersList = p.split("\n"),
- isRangeToleranceCase = function (answer) {
- return _.contains(["[", "("], answer[0]) && _.contains(["]", ")"], answer[answer.length - 1]);
- },
- checkIsNumeric = function (stringValue) {
- // remove OLX feedback
- if (stringValue.indexOf("{{") !== -1 && stringValue.indexOf("}}") !== -1) {
- stringValue = stringValue.replace(/{{[\s\S]*?}}/g, "").trim();
- }
- // allow for "e" for scientific notation, otherwise, exclude letters
- if (stringValue.match(/[a-df-z]/i)) {
- return false;
- }
- return !isNaN(parseFloat(stringValue));
- },
- getAnswerData = function (answerValue) {
- var answerData = {},
- answerParams = /(.*?)\+\-\s*(.*?$)/.exec(answerValue);
- if (answerParams) {
- answerData.answer = answerParams[1].replace(/\s+/g, ""); // inputs like 5*2 +- 10
- answerData.default = answerParams[2];
- } else {
- answerData.answer = answerValue.replace(/\s+/g, ""); // inputs like 5*2
- }
- return answerData;
- },
- processNumericalResponse = function (answerValues) {
- var firstAnswer,
- answerData,
- numericalResponseString,
- additionalAnswerString,
- textHint,
- hintLine,
- additionalTextHint,
- additionalHintLine,
- orMatch,
- hasTolerance;
-
- // First string case is s?= [e.g. = 100]
- firstAnswer = answerValues[0].replace(/^\=\s*/, "");
-
- // If answer is not numerical
- if (!checkIsNumeric(firstAnswer) && !isRangeToleranceCase(firstAnswer)) {
- return false;
- }
-
- textHint = extractHint(firstAnswer);
- hintLine = "";
- if (textHint.hint) {
- firstAnswer = textHint.nothint;
-
- hintLine = " " + textHint.hint + "\n"; // xss-lint: disable=javascript-concat-html
- }
-
- // Range case
- if (isRangeToleranceCase(firstAnswer)) {
- // [5, 7) or (5, 7), or (1.2345 * (2+3), 7*4 ] - range tolerance case
- // = (5*2)*3 should not be used as range tolerance
-
- numericalResponseString = '\n'; // xss-lint: disable=javascript-concat-html
- } else {
- answerData = getAnswerData(firstAnswer);
-
- numericalResponseString = '\n'; // xss-lint: disable=javascript-concat-html
- if (answerData.default) {
- numericalResponseString +=
- ' \n'; // xss-lint: disable=javascript-concat-html
- }
- }
-
- // Additional answer case or= [e.g. or= 10]
- // Since answerValues[0] is firstAnswer, so we will not include this in additional answers.
- additionalAnswerString = "";
- for (i = 1; i < answerValues.length; i++) {
- additionalHintLine = "";
- additionalTextHint = extractHint(answerValues[i]);
- orMatch = /^or\=\s*(.*)/.exec(additionalTextHint.nothint);
- if (orMatch) {
- hasTolerance = /(.*?)\+\-\s*(.*?$)/.exec(orMatch[1]);
- // Do not add additional_answer if additional answer is not numerical (eg. or= ABC)
- // or contains range tolerance case (eg. or= (5,7)
- // or has tolerance (eg. or= 10 +- 0.02)
- if (isNaN(parseFloat(orMatch[1])) || isRangeToleranceCase(orMatch[1]) || hasTolerance) {
- // eslint-disable-next-line no-continue
- continue;
- }
-
- if (additionalTextHint.hint) {
- additionalHintLine =
- "" + // xss-lint: disable=javascript-concat-html
- additionalTextHint.hint + // xss-lint: disable=javascript-concat-html
- ""; // xss-lint: disable=javascript-concat-html
- }
-
- additionalAnswerString += ' '; // xss-lint: disable=javascript-concat-html
- additionalAnswerString += additionalHintLine;
- additionalAnswerString += "\n";
- }
- }
-
- // Add additional answers string to numerical problem string.
- if (additionalAnswerString) {
- numericalResponseString += additionalAnswerString;
- }
-
- numericalResponseString += " \n";
- numericalResponseString += hintLine;
- numericalResponseString += "\n\n";
-
- return numericalResponseString;
- },
- processStringResponse = function (values) {
- var firstAnswer, textHint, typ, string, orMatch, notMatch;
- // First string case is s?=
- firstAnswer = values.shift();
- firstAnswer = firstAnswer.replace(/^s?\=\s*/, "");
- textHint = extractHint(firstAnswer);
- firstAnswer = textHint.nothint;
- typ = ' type="ci"';
- if (firstAnswer[0] === "|") {
- // this is regexp case
- typ = ' type="ci regexp"';
- firstAnswer = firstAnswer.slice(1).trim();
- }
-
- string = '\n"; // xss-lint: disable=javascript-concat-html
- if (textHint.hint) {
- string += " " + textHint.hint + "\n"; // xss-lint: disable=javascript-concat-html
- }
-
- // Subsequent cases are not= or or=
- for (i = 0; i < values.length; i += 1) {
- textHint = extractHint(values[i]);
- notMatch = /^not\=\s*(.*)/.exec(textHint.nothint);
- if (notMatch) {
- string +=
- ' " + // xss-lint: disable=javascript-concat-html
- textHint.hint + // xss-lint: disable=javascript-concat-html
- "\n"; // xss-lint: disable=javascript-concat-html
-
- // eslint-disable-next-line no-continue
- continue;
- }
- orMatch = /^or\=\s*(.*)/.exec(textHint.nothint);
- if (orMatch) {
- // additional_answer with answer= attribute
-
- string += ' '; // xss-lint: disable=javascript-concat-html
- if (textHint.hint) {
- string += "" + textHint.hint + ""; // xss-lint: disable=javascript-concat-html
- }
- string += "\n";
- }
- }
-
- string += ' \n\n\n';
-
- return string;
- };
-
- return processNumericalResponse(answersList) || processStringResponse(answersList);
- });
-
- // replace explanations
- xml = xml.replace(/\[explanation\]\n?([^\]]*)\[\/?explanation\]/gim, function (match, p1) {
- return (
- '\n
"; // xss-lint: disable=javascript-concat-html
- });
-
- // split scripts and preformatted sections, and wrap paragraphs
- splits = xml.split(/(<\/?(?:script|pre|label|description)[^>]*>)/gi);
-
- // Wrap a string by
tag when line is not already wrapped by another tag
- // true when line is not already wrapped by another tag false otherwise
- makeParagraph = true;
-
- for (i = 0; i < splits.length; i += 1) {
- if (/\<(script|pre|label|description)/.test(splits[i])) {
- makeParagraph = false;
- }
-
- if (makeParagraph) {
- splits[i] = splits[i].replace(/(^(?!\s*\<|$).*$)/gm, "
$1
");
- }
-
- if (/\<\/(script|pre|label|description)/.test(splits[i])) {
- makeParagraph = true;
- }
- }
-
- xml = splits.join("");
-
- // rid white space
- xml = xml.replace(/\n\n\n/g, "\n");
-
- // if we've come across demand hints, wrap in at the end
- if (demandhints) {
- demandHintTags.push(demandhints);
- }
-
- // make selector to search responsetypes in xml
- responseTypesSelector = responseTypes.join(", ");
-
- // make temporary xml
-
- $xml = $($.parseXML("" + xml + "")); // xss-lint: disable=javascript-concat-html
- responseType = $xml.find(responseTypesSelector);
-
- // convert if there is only one responsetype
- if (responseType.length === 1) {
- inputtype = responseType[0].firstElementChild;
- // used to decide whether an element should be placed before or after an inputtype
- beforeInputtype = true;
-
- _.each($xml.find("prob").children(), function (child) {
- // we don't want to add the responsetype again into new xml
- if (responseType[0].nodeName === child.nodeName) {
- beforeInputtype = false;
- return;
- }
-
- if (beforeInputtype) {
- // xss-lint: disable=javascript-jquery-insert-into-target
- responseType[0].insertBefore(child, inputtype);
- } else {
- responseType[0].appendChild(child);
- }
- });
- serializer = new XMLSerializer();
-
- xml = serializer.serializeToString(responseType[0]);
-
- // remove xmlns attribute added by the serializer
- xml = xml.replace(/\sxmlns=['"].*?['"]/gi, "");
-
- // XMLSerializer messes the indentation of XML so add newline
- // at the end of each ending tag to make the xml looks better
- xml = xml.replace(/(\<\/.*?\>)(\<.*?\>)/gi, "$1\n$2");
- }
-
- // remove class attribute added on
You can use this template as a guide to the simple editor markdown and OLX markup to use for checkboxes problems. Edit this component to replace this template with your own assessment.
-
- You can add an optional tip or note related to the prompt like this.
-
- a correct answer
- an incorrect answer
- an incorrect answer
- a correct answer
-
-
-
diff --git a/xmodule/templates/problem/checkboxes_response_hint.yaml b/xmodule/templates/problem/checkboxes_response_hint.yaml
deleted file mode 100644
index 05c0a431ad56..000000000000
--- a/xmodule/templates/problem/checkboxes_response_hint.yaml
+++ /dev/null
@@ -1,51 +0,0 @@
----
-metadata:
- display_name: Checkboxes with Hints and Feedback
- markdown: |
-
- You can use this template as a guide to the simple editor markdown and OLX markup to use for checkboxes with hints and feedback problems. Edit this component to replace this template with your own assessment.
-
- >>Add the question text, or prompt, here. This text is required.||You can add an optional tip or note related to the prompt like this.<<
-
- [x] a correct answer {{ selected: You can specify optional feedback that appears after the learner selects and submits this answer. }, { unselected: You can specify optional feedback that appears after the learner clears and submits this answer.}}
- [ ] an incorrect answer
- [ ] an incorrect answer {{ selected: You can specify optional feedback for none, all, or a subset of the answers. }, { unselected: You can specify optional feedback for selected answers, cleared answers, or both.}}
- [x] a correct answer
-
-
- {{ ((A B D)) You can specify optional feedback for a combination of answers which appears after the specified set of answers is submitted. }}
- {{ ((A B C D)) You can specify optional feedback for one, several, or all answer combinations. }}
-
- ||You can add an optional hint like this. Problems that have a hint include a hint button, and this text appears the first time learners select the button.||
- ||If you add more than one hint, a different hint appears each time learners select the hint button.||
-
-hinted: true
-data: |
-
-
-
You can use this template as a guide to the simple editor markdown and OLX markup to use for checkboxes with hints and feedback problems. Edit this component to replace this template with your own assessment.
-
- You can add an optional tip or note related to the prompt like this.
-
- a correct answer
- You can specify optional feedback that appears after the learner selects and submits this answer.
- You can specify optional feedback that appears after the learner clears and submits this answer.
-
- an incorrect answer
-
- an incorrect answer
- You can specify optional feedback for none, all, or a subset of the answers.
- You can specify optional feedback for selected answers, cleared answers, or both.
-
- a correct answer
-
- You can specify optional feedback for a combination of answers which appears after the specified set of answers is submitted.
- You can specify optional feedback for one, several, or all answer combinations.
-
-
-
-
- You can add an optional hint like this. Problems that have a hint include a hint button, and this text appears the first time learners select the button.
- If you add more than one hint, a different hint appears each time learners select the hint button.
-
-
diff --git a/xmodule/templates/problem/circuitschematic.yaml b/xmodule/templates/problem/circuitschematic.yaml
deleted file mode 100644
index 8d25c17dd4b9..000000000000
--- a/xmodule/templates/problem/circuitschematic.yaml
+++ /dev/null
@@ -1,89 +0,0 @@
----
-metadata:
- display_name: Circuit Schematic Builder
- markdown: !!null
-data: |
-
-
- Circuit schematic problems allow students to create virtual circuits by
- arranging elements such as voltage sources, capacitors, resistors, and
- MOSFETs on an interactive grid. The system evaluates a DC, AC, or
- transient analysis of the circuit.
-
- When you add the problem, be sure to select Settings
- to specify a Display Name and other values that apply.
-
-
You can use the following example problems as models.
-
-
-
Make a voltage divider that splits the provided voltage evenly.
-
-
-
-
- dc_value = "dc analysis not found"
- for response in submission[0]:
- if response[0] == 'dc':
- for node in response[1:]:
- dc_value = node['output']
-
- if dc_value == .5:
- correct = ['correct']
- else:
- correct = ['incorrect']
-
-
-
-
Explanation
-
- You can form a voltage divider that evenly divides the input
- voltage with two identically valued resistors, with the sampled
- voltage taken in between the two.
-
-
-
-
-
-
-
-
Make a high-pass filter.
-
-
-
-
- ac_values = None
- for response in submission[0]:
- if response[0] == 'ac':
- for node in response[1:]:
- ac_values = node['NodeA']
- print("the ac analysis value:", ac_values)
- if ac_values == None:
- correct = ['incorrect']
- elif ac_values[0][1] < ac_values[1][1]:
- correct = ['correct']
- else:
- correct = ['incorrect']
-
-
-
-
Explanation
-
- You can form a simple high-pass filter without any further
- constraints by simply putting a resistor in series with a
- capacitor. The actual values of the components do not really
- matter in this problem.
-
- In custom Python-evaluated input (also called "write-your-own-grader"
- problems), the grader uses a Python script that you create and embed in
- the problem to evaluate a learner's response or provide hints. These
- problems can be any type. Numerical input and text input problems are
- the most common write-your-own-grader problems.
-
-
- You can use script tag format or answer tag format to create these problems.
-
-
- You can create custom Python-evaluated input problems that provide
- partial credit or that randomize variables in the Python code. You can
- also add images to the solution by using an HTML "img" tag. Note that
- the "img" tag must be between the "div" tags that are inside the
- "solution" tags, and that learners do not see these images until they
- click the "Show Answer" button.
-
You can use this template as a guide to the OLX markup to use for math expression problems. Edit this component to replace the example with your own assessment.
-
- You can add an optional tip or note related to the prompt like this. Example: To test this example, the correct answer is R_1*R_2/R_3
-
-
-
-
diff --git a/xmodule/templates/problem/imageresponse.yaml b/xmodule/templates/problem/imageresponse.yaml
deleted file mode 100644
index 2dab2208f20a..000000000000
--- a/xmodule/templates/problem/imageresponse.yaml
+++ /dev/null
@@ -1,30 +0,0 @@
----
-metadata:
- display_name: Image Mapped Input
- markdown: !!null
-data: |
-
-
- In an image mapped input problem, also known as a "pointing on a picture" problem, students click inside a defined region in an image. You define this region by including coordinates in the body of the problem. You can define one rectangular region,
- multiple rectangular regions, or one non-rectangular region. For more information, see
- Image Mapped Input Problem
- in
- Building and Running an Open edX Course.
-
-
When you add the problem, be sure to select
- Settings
- to specify a
- Display Name
- and other values that apply.
-
You can use the following example problem as a model.
-
-
What country is home to the Great Pyramid of Giza as well as the cities of Cairo and Memphis? Click the country on the map below.
-
-
-
-
Explanation
-
Egypt is home to not only the Pyramids, Cairo, and Memphis, but also the Sphinx and the ancient Royal Library of Alexandria.
- In these problems (also called custom JavaScript problems or JS Input
- problems), you add a problem or tool that uses JavaScript in Studio.
- Studio embeds the problem in an IFrame so that your learners can
- interact with it in the LMS. You can grade your learners' work using
- JavaScript and some basic Python, and the grading is integrated into the
- edX grading system.
-
-
- The JS Input problem that you create must use HTML, JavaScript, and
- cascading style sheets (CSS). You can use any application creation tool,
- such as the Google Web Toolkit (GWT), to create your JS Input problem.
-
- When you add the problem, be sure to select Settings
- to specify a Display Name and other values that apply.
- Also, be sure to specify a title attribute on the jsinput tag;
- this title is used for the title attribute on the generated IFrame. Generally,
- the title attribute on the IFrame should match the title tag of the HTML hosted
- within the IFrame, which is specified by the html_file attribute.
-
-
You can use the following example problem as a model.
-
-
-
-
This is paragraph text displayed before the IFrame.
-
-
-
diff --git a/xmodule/templates/problem/latex_problem.yaml b/xmodule/templates/problem/latex_problem.yaml
deleted file mode 100644
index d25860a19686..000000000000
--- a/xmodule/templates/problem/latex_problem.yaml
+++ /dev/null
@@ -1,247 +0,0 @@
----
-metadata:
- display_name: Problem Written in LaTeX
- source_code: |
- % Nearly any kind of edX problem can be authored using LaTeX as
- % the source language. Write LaTeX as usual, including equations. The
- % key feature is the \edXabox{} macro, which specifies an "answer
- % box" that queries students for a response, and specifies what the
- % expected (correct) answer is.
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- \subsection{Example "option" problem}
-
- Which of the following countries celebrates its independence on August 15?
-
- \edXabox{options='India','Spain','China','Bermuda' expect='India'}
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- \subsection{Example "multiple choice" problem}
-
- Which of the following countries has the largest population?
-
- \edXabox{ type="multichoice" expect="Indonesia" options="Brazil","Germany","Indonesia","Russia" }
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- \subsection{Example "symbolic" problem}
-
- What is Einstein's equation for the energy equivalent of a mass $m$?
-
- \edXabox{type='symbolic' size='90' expect='m*c^2' }
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- \subsection{Example "numerical" problem}
-
- Estimate the energy savings (in J/y) if all the people
- ($3\times 10^8$) in the U.~S. switched from U.~S. code to low-flow
- shower heads.
-
- \edXinline{Energy saved = }\edXabox{expect="0.52" type="numerical" tolerance='0.02' inline='1' } %
- \edXinline{~EJ/year}
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- \subsection{Example "string response" problem}
-
- What was the first post-secondary school in China to allow both male and female students?
-
- \edXabox{ type="string" expect="Nanjing Higher Normal Institute" options="ci" }
-
- You can include an explanation of the answer by using the edXsolution
- macro. Click "Show Answer" to see the explanation.
-
- \begin{edXsolution}
- Nanjing Higher Normal Institute first admitted female students in 1920.
- \end{edXsolution}
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- \subsection{Example "custom response" problem}
-
- In this problem, a custom Python script determines if the answer is correct.
-
- \begin{edXscript}
- def sumtest(expect,ans):
- (a1,a2) = map(float,eval(ans))
- return (a1+a2)==10
- \end{edXscript}
-
- Enter a Python list of two numbers that sum to 10. For example, your answer might be [9,1] or [4,6].
-
- \edXabox{expect="[1,9]" type="custom" cfn="sumtest"}
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- \subsection{Example image}
-
- Include an image by using the following macro:
-
- \edXxml{}
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- \subsection{Example show/hide explanation}
-
- You can provide additional information that only appears at certain times by including a "showhide" flag.
-
- \edXshowhide{sh1}{More explanation}{This is a hidden explanation. It
- can contain equations, such as $\alpha = \frac{2}{\sqrt{1+\gamma}}$ }.
-
- This is additional text after the hidden explanation.
- markdown: !!null
-
-data: |
-
-
-
- If you have a problem that is already written in LaTeX, you can use this problem type to
- easily convert your code into XML. After you paste your code into the LaTeX editor,
- you only need to make a few minor adjustments.
-
This is a hidden explanation. It can contain equations, such as [mathjaxinline]\alpha = \frac{2}{\sqrt {1+\gamma }}[/mathjaxinline].
-
This is additional text after the hidden explanation.
-
-
-
-
-
-
diff --git a/xmodule/templates/problem/multiplechoice.yaml b/xmodule/templates/problem/multiplechoice.yaml
deleted file mode 100644
index 9532ea3166ac..000000000000
--- a/xmodule/templates/problem/multiplechoice.yaml
+++ /dev/null
@@ -1,26 +0,0 @@
----
-metadata:
- display_name: Multiple Choice
- markdown: |
-
- You can use this template as a guide to the simple editor markdown and OLX markup to use for multiple choice problems. Edit this component to replace this template with your own assessment.
-
- >>Add the question text, or prompt, here. This text is required.||You can add an optional tip or note related to the prompt like this. <<
-
- ( ) an incorrect answer
- (x) the correct answer
- ( ) an incorrect answer
-
-data: |
-
-
-
You can use this template as a guide to the simple editor markdown and OLX markup to use for multiple choice problems. Edit this component to replace this template with your own assessment.
-
- You can add an optional tip or note related to the prompt like this.
-
- an incorrect answer
- the correct answer
- an incorrect answer
-
-
-
diff --git a/xmodule/templates/problem/multiplechoice_hint.yaml b/xmodule/templates/problem/multiplechoice_hint.yaml
deleted file mode 100644
index ec5d11378823..000000000000
--- a/xmodule/templates/problem/multiplechoice_hint.yaml
+++ /dev/null
@@ -1,40 +0,0 @@
----
-metadata:
- display_name: Multiple Choice with Hints and Feedback
- markdown: |
-
- You can use this template as a guide to the simple editor markdown and OLX markup to use for multiple choice with hints and feedback problems. Edit this component to replace this template with your own assessment.
-
- >>Add the question text, or prompt, here. This text is required.||You can add an optional tip or note related to the prompt like this. <<
-
- ( ) an incorrect answer {{You can specify optional feedback like this, which appears after this answer is submitted.}}
- (x) the correct answer
- ( ) an incorrect answer {{You can specify optional feedback for none, a subset, or all of the answers.}}
-
- ||You can add an optional hint like this. Problems that have a hint include a hint button, and this text appears the first time learners select the button.||
- ||If you add more than one hint, a different hint appears each time learners select the hint button.||
-
-hinted: true
-data: |
-
-
-
You can use this template as a guide to the simple editor markdown and OLX markup to use for multiple choice with hints and feedback problems. Edit this component to replace this template with your own assessment.
-
- You can add an optional tip or note related to the prompt like this.
-
- an incorrect answer
- You can specify optional feedback like this, which appears after this answer is submitted.
-
- the correct answer
-
- an incorrect answer
- You can specify optional feedback for none, a subset, or all of the answers.
-
-
-
-
-
- You can add an optional hint like this. Problems that have a hint include a hint button, and this text appears the first time learners select the button.
- If you add more than one hint, a different hint appears each time learners select the hint button.
-
-
diff --git a/xmodule/templates/problem/numericalresponse.yaml b/xmodule/templates/problem/numericalresponse.yaml
deleted file mode 100644
index fc6a95038ca7..000000000000
--- a/xmodule/templates/problem/numericalresponse.yaml
+++ /dev/null
@@ -1,20 +0,0 @@
----
-metadata:
- display_name: Numerical Input
- markdown: |
- You can use this template as a guide to the simple editor markdown and OLX markup to use for numerical input problems. Edit this component to replace this template with your own assessment.
-
- >>Add the question text, or prompt, here. This text is required.||You can add an optional tip or note related to the prompt like this. <<
-
- = 100 +-5
-
-data: |
-
-
-
You can use this template as a guide to the simple editor markdown and OLX markup to use for numerical input problems. Edit this component to replace this template with your own assessment.
-
- You can add an optional tip or note related to the prompt like this.
-
-
-
-
diff --git a/xmodule/templates/problem/numericalresponse_hint.yaml b/xmodule/templates/problem/numericalresponse_hint.yaml
deleted file mode 100644
index 9b874d329929..000000000000
--- a/xmodule/templates/problem/numericalresponse_hint.yaml
+++ /dev/null
@@ -1,29 +0,0 @@
----
-metadata:
- display_name: Numerical Input with Hints and Feedback
- markdown: |
- You can use this template as a guide to the simple editor markdown and OLX markup to use for numerical input with hints and feedback problems. Edit this component to replace this template with your own assessment.
-
- >>Add the question text, or prompt, here. This text is required.||You can add an optional tip or note related to the prompt like this. <<
-
- = 100 +-5 {{You can specify optional feedback like this, which appears after this answer is submitted.}}
-
- ||You can add an optional hint like this. Problems that have a hint include a hint button, and this text appears the first time learners select the button.||
- ||If you add more than one hint, a different hint appears each time learners select the hint button.||
-
-hinted: true
-data: |
-
-
-
You can use this template as a guide to the simple editor markdown and OLX markup to use for numerical input with hints and feedback problems. Edit this component to replace this template with your own assessment.
-
- You can add an optional tip or note related to the prompt like this.
-
-
- You can specify optional feedback like this, which appears after this answer is submitted.
-
-
- You can add an optional hint like this. Problems that have a hint include a hint button, and this text appears the first time learners select the button.
- If you add more than one hint, a different hint appears each time learners select the hint button.
-
-
diff --git a/xmodule/templates/problem/optionresponse.yaml b/xmodule/templates/problem/optionresponse.yaml
deleted file mode 100644
index 1eb2e6b41ef8..000000000000
--- a/xmodule/templates/problem/optionresponse.yaml
+++ /dev/null
@@ -1,24 +0,0 @@
----
-metadata:
- display_name: Dropdown
- markdown: |
- You can use this template as a guide to the simple editor markdown and OLX markup to use for dropdown problems. Edit this component to replace this template with your own assessment.
- >>Add the question text, or prompt, here. This text is required.||You can add an optional tip or note related to the prompt like this. <<
- [[
- an incorrect answer
- (the correct answer)
- an incorrect answer
- ]]
-data: |
-
-
-
You can use this template as a guide to the simple editor markdown and OLX markup to use for dropdown problems. Edit this component to replace this template with your own assessment.
-
- You can add an optional tip or note related to the prompt like this.
-
-
-
-
-
-
-
diff --git a/xmodule/templates/problem/optionresponse_hint.yaml b/xmodule/templates/problem/optionresponse_hint.yaml
deleted file mode 100644
index e963cc3c99b5..000000000000
--- a/xmodule/templates/problem/optionresponse_hint.yaml
+++ /dev/null
@@ -1,33 +0,0 @@
----
-metadata:
- display_name: Dropdown with Hints and Feedback
- markdown: |
- You can use this template as a guide to the simple editor markdown and OLX markup to use for dropdown with hints and feedback problems. Edit this component to replace this template with your own assessment.
- >>Add the question text, or prompt, here. This text is required.||You can add an optional tip or note related to the prompt like this. <<
- [[
- an incorrect answer {{You can specify optional feedback like this, which appears after this answer is submitted.}}
- (the correct answer)
- an incorrect answer {{You can specify optional feedback for none, a subset, or all of the answers.}}
- ]]
-
- ||You can add an optional hint like this. Problems that have a hint include a hint button, and this text appears the first time learners select the button.||
- ||If you add more than one hint, a different hint appears each time learners select the hint button.||
-
-hinted: true
-data: |
-
-
-
You can use this template as a guide to the simple editor markdown and OLX markup to use for dropdown with hints and feedback problems. Edit this component to replace this template with your own assessment.
-
- You can add an optional tip or note related to the prompt like this.
-
-
-
-
-
-
-
- You can add an optional hint like this. Problems that have a hint include a hint button, and this text appears the first time learners select the button.
- If you add more than one hint, a different hint appears each time learners select the hint button.
-
-
diff --git a/xmodule/templates/problem/problem_with_hint.yaml b/xmodule/templates/problem/problem_with_hint.yaml
deleted file mode 100644
index aebae48f9584..000000000000
--- a/xmodule/templates/problem/problem_with_hint.yaml
+++ /dev/null
@@ -1,43 +0,0 @@
----
-metadata:
- display_name: Problem with Adaptive Hint
- markdown: !!null
-data: |
-
-
-
Problem With Adaptive Hint
-
This problem demonstrates a question with hints, based on using the hintfn method.
-
-
-
-
-
-
-
-
-
diff --git a/xmodule/templates/problem/problem_with_hint_in_latex.yaml b/xmodule/templates/problem/problem_with_hint_in_latex.yaml
deleted file mode 100644
index 809b83f4a357..000000000000
--- a/xmodule/templates/problem/problem_with_hint_in_latex.yaml
+++ /dev/null
@@ -1,88 +0,0 @@
----
-metadata:
- display_name: Problem with Adaptive Hint in Latex
- source_code: |
- \subsection{Problem With Adaptive Hint}
-
- % Adaptive hints are messages provided to students which depend on
- % student input. These hints are produced using a script embedded
- % within the problem (written in Python).
- %
- % Here is an example. This example uses LaTeX as a high-level
- % soure language for the problem. The problem can also be coded
- % directly in XML.
-
- This problem demonstrates a question with hints, based on using the
- {\tt hintfn} method.
-
- \begin{edXscript}
- def test_str(expect, ans):
- print(expect, ans)
- ans = ans.strip("'")
- ans = ans.strip('"')
- return expect == ans.lower()
-
- def hint_fn(answer_ids, student_answers, new_cmap, old_cmap):
- aid = answer_ids[0]
- ans = str(student_answers[aid]).lower()
- print('hint_fn called, ans=', ans)
- hint = ''
- if 'java' in ans:
- hint = 'that is only good for drinking'
- elif 'perl' in ans:
- hint = 'not that rich'
- elif 'pascal' in ans:
- hint = 'that is a beatnick language'
- elif 'fortran' in ans:
- hint = 'those were the good days'
- elif 'clu' in ans:
- hint = 'you must be invariant'
- if hint:
- hint = "Hint: {0}".format(hint)
- new_cmap.set_hint_and_mode(aid,hint,'always')
- \end{edXscript}
-
- What is the best programming language that exists today? You may
- enter your answer in upper or lower case, with or without quotes.
-
- \edXabox{type="custom" cfn='test_str' expect='python' hintfn='hint_fn'}
- markdown: !!null
-data: |
-
-
-
Problem With Adaptive Hint
-
This problem demonstrates a question with hints, based on using the hintfn method.
-
-
-
-
What is the best programming language that exists today? You may enter your answer in upper or lower case, with or without quotes.
-
-
-
-
-
diff --git a/xmodule/templates/problem/string_response.yaml b/xmodule/templates/problem/string_response.yaml
deleted file mode 100644
index 6e2180e0830c..000000000000
--- a/xmodule/templates/problem/string_response.yaml
+++ /dev/null
@@ -1,21 +0,0 @@
----
-metadata:
- display_name: Text Input
- markdown: |
- You can use this template as a guide to the simple editor markdown and OLX markup to use for text input problems. Edit this component to replace this template with your own assessment.
-
- >>Add the question text, or prompt, here. This text is required.||You can add an optional tip or note related to the prompt like this. <<
-
- = the correct answer
- or= optional acceptable variant of the correct answer
-
-data: |
-
-
-
You can use this template as a guide to the simple editor markdown and OLX markup to use for text input problems. Edit this component to replace this template with your own assessment.
-
- You can add an optional tip or note related to the prompt like this.
-
-
-
-
diff --git a/xmodule/templates/problem/string_response_hint.yaml b/xmodule/templates/problem/string_response_hint.yaml
deleted file mode 100644
index ac3bb2c1adab..000000000000
--- a/xmodule/templates/problem/string_response_hint.yaml
+++ /dev/null
@@ -1,33 +0,0 @@
----
-metadata:
- display_name: Text Input with Hints and Feedback
- markdown: |
-
- You can use this template as a guide to the simple editor markdown and OLX markup to use for text input with hints and feedback problems. Edit this component to replace this template with your own assessment.
-
- >>Add the question text, or prompt, here. This text is required.||You can add an optional tip or note related to the prompt like this. <<
-
- = the correct answer {{You can specify optional feedback like this, which appears after this answer is submitted.}}
- or= optional acceptable variant of the correct answer
- not= optional incorrect answer such as a frequent misconception {{You can specify optional feedback for none, a subset, or all of the answers.}}
-
- ||You can add an optional hint like this. Problems that have a hint include a hint button, and this text appears the first time learners select the button.||
- ||If you add more than one hint, a different hint appears each time learners select the hint button.||
-
-hinted: true
-data: |
-
-
-
You can use this template as a guide to the simple editor markdown and OLX markup to use for text input with hints and feedback problems. Edit this component to replace this template with your own assessment.
-
- You can add an optional tip or note related to the prompt like this.
- You can specify optional feedback like this, which appears after this answer is submitted.
-
- You can specify optional feedback for none, a subset, or all of the answers.
-
-
-
- You can add an optional hint like this. Problems that have a hint include a hint button, and this text appears the first time learners select the button.
- If you add more than one hint, a different hint appears each time learners select the hint button.
-
-