diff --git a/cms/djangoapps/pipeline_js/templates/xmodule.js b/cms/djangoapps/pipeline_js/templates/xmodule.js index 1b257bbd97..fb0c22d2c1 100644 --- a/cms/djangoapps/pipeline_js/templates/xmodule.js +++ b/cms/djangoapps/pipeline_js/templates/xmodule.js @@ -6,8 +6,9 @@ ## and attach them to the global context manually. define(["jquery", "underscore", "codemirror", "tinymce", "jquery.tinymce", "jquery.qtip", "jquery.scrollTo", "jquery.flot", - "jquery.cookie", "pretty-print", "utility"], - function($, _, CodeMirror) { + "jquery.cookie", + "utility"], + function($, _, CodeMirror, tinymce) { window.$ = $; window._ = _; require(['mathjax']); diff --git a/cms/static/cms/js/require-config.js b/cms/static/cms/js/require-config.js index 1755ac4bb4..ff7d342c25 100644 --- a/cms/static/cms/js/require-config.js +++ b/cms/static/cms/js/require-config.js @@ -28,7 +28,6 @@ 'mustache': 'js/vendor/mustache', 'codemirror': 'js/vendor/codemirror-compressed', 'codemirror/stex': 'js/vendor/CodeMirror/stex', - 'pretty-print': 'js/lib/pretty-print', 'jquery': 'common/js/vendor/jquery', 'jquery-migrate': 'common/js/vendor/jquery-migrate', 'jquery.ui': 'js/vendor/jquery-ui.min', diff --git a/common/lib/xmodule/xmodule/js/karma_xmodule.conf.js b/common/lib/xmodule/xmodule/js/karma_xmodule.conf.js index 40e05ada88..d08e3173a8 100644 --- a/common/lib/xmodule/xmodule/js/karma_xmodule.conf.js +++ b/common/lib/xmodule/xmodule/js/karma_xmodule.conf.js @@ -21,8 +21,7 @@ var options = { {pattern: 'common_static/coffee/src/ajax_prefix.js', included: true}, {pattern: 'common_static/common/js/vendor/underscore.js', included: true}, {pattern: 'common_static/common/js/vendor/backbone.js', included: true}, - {pattern: 'common_static/js/vendor/codemirror-compressed.js', included: true}, - {pattern: 'common_static/js/lib/pretty-print.js', included: true}, + {pattern: 'common_static/js/vendor/CodeMirror/codemirror.js', included: true}, {pattern: 'common_static/js/vendor/draggabilly.js'}, {pattern: 'common_static/common/js/vendor/jquery.js', included: true}, {pattern: 'common_static/common/js/vendor/jquery-migrate.js', included: true}, diff --git a/common/lib/xmodule/xmodule/js/spec/problem/edit_spec.coffee b/common/lib/xmodule/xmodule/js/spec/problem/edit_spec.coffee index 04e7044c7d..24cf3f3a82 100644 --- a/common/lib/xmodule/xmodule/js/spec/problem/edit_spec.coffee +++ b/common/lib/xmodule/xmodule/js/spec/problem/edit_spec.coffee @@ -5,7 +5,7 @@ describe 'MarkdownEditingDescriptor', -> @descriptor = new MarkdownEditingDescriptor($('.problem-editor')) saveResult = @descriptor.save() expect(saveResult.metadata.markdown).toEqual('markdown') - expect(saveResult.data).toEqual('\n

markdown

\n
') + expect(saveResult.data).toXMLEqual('\n

markdown

\n
') it 'clears markdown when xml editor is selected', -> loadFixtures 'problem-with-markdown.html' @descriptor = new MarkdownEditingDescriptor($('.problem-editor')) @@ -101,7 +101,7 @@ describe 'MarkdownEditingDescriptor', -> describe 'markdownToXml', -> it 'converts raw text to paragraph', -> data = MarkdownEditingDescriptor.markdownToXml('foo') - expect(data).toEqual('\n

foo

\n
') + expect(data).toXMLEqual('\n

foo

\n
') # test default templates it 'converts numerical response to xml', -> 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. @@ -133,7 +133,7 @@ describe 'MarkdownEditingDescriptor', -> If you look at your hand, you can count that you have five fingers. [Explanation] """) - expect(data).toEqual(""" + 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:

@@ -356,7 +356,7 @@ describe 'MarkdownEditingDescriptor', -> When the student is ready, the explanation appears. [Explanation] """) - expect(data).toEqual(""" + expect(data).toXMLEqual("""

bleh

@@ -680,7 +680,7 @@ describe 'MarkdownEditingDescriptor', -> Code should be nicely monospaced. [/code] """) - expect(data).toEqual(""" + expect(data).toXMLEqual("""

Not a header

A header

diff --git a/common/lib/xmodule/xmodule/js/spec/problem/edit_spec_hint.coffee b/common/lib/xmodule/xmodule/js/spec/problem/edit_spec_hint.coffee index 0808afd3a5..1a9b7aad97 100644 --- a/common/lib/xmodule/xmodule/js/spec/problem/edit_spec_hint.coffee +++ b/common/lib/xmodule/xmodule/js/spec/problem/edit_spec_hint.coffee @@ -25,7 +25,7 @@ describe 'Markdown to xml extended hint dropdown', -> ]] """) - expect(data).toEqual(""" + expect(data).toXMLEqual("""

Translation between Dropdown and ________ is straightforward.

diff --git a/common/lib/xmodule/xmodule/js/src/problem/edit.js b/common/lib/xmodule/xmodule/js/src/problem/edit.js index b0d6922596..0f8fc172db 100644 --- a/common/lib/xmodule/xmodule/js/src/problem/edit.js +++ b/common/lib/xmodule/xmodule/js/src/problem/edit.js @@ -1,4 +1,4 @@ -/* global CodeMirror, _, XModule, PrettyPrint */ +/* 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. @@ -819,8 +819,8 @@ } // make all responsetypes descendants of a single problem element // safe-lint: disable=javascript-concat-html - finalXml = '' + responseTypesXML.join('\n\n') + finalDemandHints + ''; - return PrettyPrint.xml(finalXml); + finalXml = '\n' + responseTypesXML.join('\n\n') + finalDemandHints + '\n'; + return finalXml; }; return MarkdownEditingDescriptor; diff --git a/common/static/js/lib/pretty-print.js b/common/static/js/lib/pretty-print.js deleted file mode 100644 index 9b2259c8a7..0000000000 --- a/common/static/js/lib/pretty-print.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* pretty-data - nodejs plugin to pretty-print or minify data in XML, JSON and CSS formats. -* -* Version - 0.40.0 -* Copyright (c) 2012 Vadim Kiryukhin -* vkiryukhin @ gmail.com -* http://www.eslinstructor.net/pretty-data/ -* -* -* Code extracted for xml formatting only -*/ - -/* eslint-disable */ - -(function (root, factory){ - if (typeof define === 'function' && define.amd) { - // AMD. Register as an anonymous module. - define([], function (){ - return (root.PrettyPrint = factory()); - }); - } else { - // Browser globals - root.PrettyPrint = factory(); - } -}(this, function () { - function PrettyPrint(){ - var maxdeep = 100, // nesting level - ix = 0; - - this.shift = ['\n']; // array of shifts - this.step = ' '; // 2 spaces - - // initialize array with shifts // - for (ix = 0; ix < maxdeep; ix++) { - this.shift.push(this.shift[ix] + this.step); - } - } - - PrettyPrint.prototype.xml = function (text) { - var ar = text.replace(/>\s{0,}<") - .replace(/