diff --git a/Changelog.md b/Changelog.md index 527dc1c3d4..e0cd5fa5ac 100644 --- a/Changelog.md +++ b/Changelog.md @@ -42,6 +42,7 @@ - Upgrade pdfjs-dist to v4.3.136 (#7113) - Fixed formatting of documentation repository on the PR template (#7120) - Switch from rails-sassc to cssbundling-rails for CSS asset management (#7121) +- Switch from SyntaxHighlighter to Prism for syntax highlighting (#7122) ## [v2.4.11] diff --git a/app/assets/javascripts/Annotations/text_annotation_manager.js b/app/assets/javascripts/Annotations/text_annotation_manager.js index e7ce8b0136..2a5dc6101d 100644 --- a/app/assets/javascripts/Annotations/text_annotation_manager.js +++ b/app/assets/javascripts/Annotations/text_annotation_manager.js @@ -1,6 +1,6 @@ /** * AnnotationManager subclass for plaintext files. Its constructor is given a list of DOM elements - * (one for each line of text in the file), that have been transformed through SyntaxHighlighter. + * (one for each line of text in the file), that have been transformed through syntax highlighting. */ class TextAnnotationManager extends AnnotationManager { constructor(source_nodes) { @@ -120,7 +120,7 @@ class TextAnnotationManager extends AnnotationManager { ); // If the entire line was selected through a triple-click, highlight the entire line. - if (mouse_anchor.nodeName === "LI" && mouse_focus.nodeName === "LI") { + if (mouse_anchor === mouse_focus && this.isSourceLineElement(mouse_focus)) { return { line_start: line_start, line_end: line_end, @@ -130,10 +130,10 @@ class TextAnnotationManager extends AnnotationManager { } // If we selected an entire line the above returns + 1, a fix follows - if (mouseSelection.anchorNode.nodeName === "LI") { + if (this.isSourceLineElement(mouseSelection.anchorNode)) { line_start--; } - if (mouseSelection.focusNode.nodeName === "LI") { + if (this.isSourceLineElement(mouseSelection.focusNode)) { line_end--; } @@ -213,13 +213,18 @@ class TextAnnotationManager extends AnnotationManager { }; } - // Given some node, traverses upwards until it finds the LI element that represents a line of code in SyntaxHighlighter. + // Given some node, traverses upwards until it finds the span element that represents a line of code. // This is useful for figuring out what text is currently selected, using window.getSelection().anchorNode / focusNode getRootFromSelection(node) { let current_node = node; - while (current_node !== null && current_node.tagName !== "LI") { + while (current_node !== null && !this.isSourceLineElement(current_node)) { current_node = current_node.parentNode; } return current_node; } + + // Returns whether node is an element representing a source line (after syntax highlighting has been applied). + isSourceLineElement(node) { + return node.tagName === "SPAN" && node.className.includes("source-line"); + } } diff --git a/app/assets/javascripts/Components/Result/text_viewer.jsx b/app/assets/javascripts/Components/Result/text_viewer.jsx index a3962c63c0..eadb5306a0 100644 --- a/app/assets/javascripts/Components/Result/text_viewer.jsx +++ b/app/assets/javascripts/Components/Result/text_viewer.jsx @@ -1,5 +1,6 @@ import React from "react"; import {render} from "react-dom"; +import Prism from "prismjs"; export class TextViewer extends React.PureComponent { constructor(props) { @@ -14,6 +15,7 @@ export class TextViewer extends React.PureComponent { } componentDidMount() { + this.highlight_root = this.raw_content.current.parentNode; if (this.props.content) { this.ready_annotations(); } @@ -42,29 +44,18 @@ export class TextViewer extends React.PureComponent { * 3. Scroll to line numbered this.props.focusLine */ ready_annotations = () => { - if (this.highlight_root !== null) { - this.highlight_root.remove(); - } + this.run_syntax_highlighting(); + if (this.annotation_manager !== null) { this.annotation_manager.annotation_text_displayer.hide(); } - const preElementName = this.raw_content.current.getAttribute("name"); - dp.SyntaxHighlighter.HighlightAll( - preElementName, - true /* showGutter */, - false /* showControls */ - ); - this.highlight_root = - this.raw_content.current.parentNode.getElementsByClassName("dp-highlighter")[0]; this.highlight_root.style.font_size = this.state.fontSize + "em"; if (this.props.resultView) { window.annotation_type = ANNOTATION_TYPES.CODE; - window.annotation_manager = new TextAnnotationManager( - this.highlight_root.children[1].children - ); + window.annotation_manager = new TextAnnotationManager(this.raw_content.current.children); this.annotation_manager = window.annotation_manager; } @@ -72,6 +63,69 @@ export class TextViewer extends React.PureComponent { this.scrollToLine(this.props.focusLine); }; + run_syntax_highlighting = () => { + Prism.highlightElement(this.raw_content.current, false); + let nodeLines = []; + let currLine = document.createElement("span"); + currLine.classList.add("source-line"); + for (let node of this.raw_content.current.childNodes) { + if (node.nodeType === Node.TEXT_NODE) { + // SourceCodeLine.glow assumes text nodes are wrapped in elements + let textContainer = document.createElement("span"); + let textNode = null; + if (node.textContent.includes("\n")) { + const splits = node.textContent.split("\n"); + for (let i = 0; i < splits.length - 1; i++) { + textNode = document.createTextNode(splits[i] + "\n"); + textContainer.appendChild(textNode); + currLine.appendChild(textContainer); + nodeLines.push(currLine); + currLine = document.createElement("span"); + currLine.classList.add("source-line"); + textContainer = document.createElement("span"); + } + textNode = document.createTextNode(splits[splits.length - 1]); + } else { + textNode = node.cloneNode(true); + } + textContainer.appendChild(textNode); + currLine.appendChild(textContainer); + } else { + if (node.textContent.includes("\n")) { + const splits = node.textContent.split("\n"); + let textContainer = document.createElement("span"); + textContainer.className = node.className; + let textNode = null; + for (let i = 0; i < splits.length - 1; i++) { + textNode = document.createTextNode(splits[i] + "\n"); + textContainer.appendChild(textNode); + currLine.appendChild(textContainer); + nodeLines.push(currLine); + currLine = document.createElement("span"); + currLine.classList.add("source-line"); + textContainer = document.createElement("span"); + textContainer.className = node.className; + } + textNode = document.createTextNode(splits[splits.length - 1]); + textContainer.appendChild(textNode); + currLine.appendChild(textContainer); + } else { + currLine.appendChild(node.cloneNode(true)); + } + } + } + if (currLine.textContent.length > 0) { + nodeLines.appendChild(currLine); + } + nodeLines.push(this.raw_content.current.lastChild.cloneNode(true)); + while (this.raw_content.current.firstChild) { + this.raw_content.current.removeChild(this.raw_content.current.lastChild); + } + for (let n of nodeLines) { + this.raw_content.current.appendChild(n); + } + }; + change_font_size = delta => { this.setState({font_size: Math.max(this.state.font_size + delta, 0.25)}); }; @@ -109,16 +163,12 @@ export class TextViewer extends React.PureComponent { return; } - const line = this.highlight_root.querySelector(`li:nth-of-type(${lineNumber})`); + const line = this.highlight_root.querySelector(`span.source-line:nth-of-type(${lineNumber})`); if (line) { line.scrollIntoView(); } }; - componentWillUnmount() { - document.querySelectorAll(".dp-highlighter").forEach(node => node.remove()); - } - copyToClipboard = () => { navigator.clipboard.writeText(this.props.content).then(() => { this.setState({copy_success: true}); @@ -142,13 +192,12 @@ export class TextViewer extends React.PureComponent { this.change_font_size(-0.25)}> -A - dp.sh.Toolbar.Command("About", this.highlight_root)}> - ? - -
-          {this.props.content}
+        
+          
+            {this.props.content}
+          
         
); diff --git a/app/assets/javascripts/Components/__tests__/text_viewer.test.jsx b/app/assets/javascripts/Components/__tests__/text_viewer.test.jsx new file mode 100644 index 0000000000..30b1e10bca --- /dev/null +++ b/app/assets/javascripts/Components/__tests__/text_viewer.test.jsx @@ -0,0 +1,24 @@ +import React from "react"; +import {render, screen, cleanup} from "@testing-library/react"; +import {TextViewer} from "../Result/text_viewer"; + +describe("TextViewer", () => { + let props; + + beforeEach(() => { + props = { + content: "def f(n: int) -> int:\n return n + 1\n", + annotations: [], + focusLine: null, + submission_file_id: 1, + }; + + render(); + }); + + afterEach(cleanup); + + it("should render its text content", () => { + expect(screen.getByText("def f(n: int) -> int:")).toBeInTheDocument(); + }); +}); diff --git a/app/assets/javascripts/Results/context_menu.js b/app/assets/javascripts/Results/context_menu.js index e4ec380d72..3e65c6869b 100644 --- a/app/assets/javascripts/Results/context_menu.js +++ b/app/assets/javascripts/Results/context_menu.js @@ -52,7 +52,7 @@ var annotation_context_menu = { title: I18n.t("edit"), cmd: "edit_annotation", action: function (event, ui) { - var clicked_element = $(ui.target); + var clicked_element = ui.target[0]; var annot_id = get_annotation_id(clicked_element); if (annot_id !== null && annot_id.length !== 0) { resultComponent.editAnnotation(annot_id); @@ -64,7 +64,7 @@ var annotation_context_menu = { title: I18n.t("delete"), cmd: "delete_annotation", action: function (event, ui) { - var clicked_element = $(ui.target); + var clicked_element = $(ui.target)[0]; var annot_id = get_annotation_id(clicked_element); if (annot_id !== null && annot_id.length !== 0) { resultComponent.removeAnnotation(annot_id); @@ -94,18 +94,20 @@ var annotation_context_menu = { }; function get_annotation_id(clicked_element) { - var annot_id = ""; if (annotation_type === ANNOTATION_TYPES.CODE) { - $.each(clicked_element[0].attributes, function (index, attr) { - if (attr.nodeName.toLowerCase().indexOf("data-annotationid") != -1) { - annot_id = attr.value; - // Continue iteration in case of multiple annotations + let curr = clicked_element; + while (curr !== null && curr.tagName === "SPAN") { + for (let attr in curr.dataset) { + if (attr.toLowerCase().startsWith("annotationid")) { + return curr.dataset[attr]; + } } - }); + curr = curr.parentNode; + } + return ""; } else { - annot_id = clicked_element.attr("id").replace("annotation_holder_", ""); + return clicked_element.attr("id").replace("annotation_holder_", ""); } - return annot_id; } $(document).contextmenu({ diff --git a/app/assets/javascripts/Results/main.js b/app/assets/javascripts/Results/main.js index e17234de38..7adf306ebe 100644 --- a/app/assets/javascripts/Results/main.js +++ b/app/assets/javascripts/Results/main.js @@ -2,9 +2,6 @@ //= require DropDownMenu/DropDownMenu //= require jquery.ui-contextmenu.min -// Syntax highlighting -//= require syntaxhighlighter - // Source code highlighting //= require Annotations/globals //= require Annotations/annotation_manager diff --git a/app/assets/stylesheets/common/SyntaxHighlighter.scss b/app/assets/stylesheets/common/SyntaxHighlighter.scss deleted file mode 100644 index 2c70bc1b00..0000000000 --- a/app/assets/stylesheets/common/SyntaxHighlighter.scss +++ /dev/null @@ -1,101 +0,0 @@ -@import 'mixins'; -@import 'constants'; - -.dp-highlighter { - display: flex; - flex-direction: column; - flex-grow: 1; - font: 1em $mono-fonts; - padding-bottom: 5px; - - /* Clear styles */ - a, - a:hover { - background: none; - border: 0; - margin: 0; - padding: 0; - } - - /* Actual styling */ - ol { - flex-grow: 1; - list-style: decimal outside; - margin: 0; - - li { - border-left: 1px solid $primary-two; - line-height: 1.25em; - padding-left: 10px; - } - } - - /* Language specific styles */ - .comment, - .comments { - background-color: inherit; - color: $comments; - } - - .string { - background-color: inherit; - color: $strings; - } - - .keyword { - background-color: inherit; - color: $key-words; - font-weight: bold; - } - - .preprocessor { - background-color: inherit; - color: $key-words; - } - - .source-code-glowing-1 { - background-color: $light-alert !important; - } - - .source-code-glowing-2 { - background-color: $severe-alert !important; - } - - .source-code-glowing-3 { - background-color: $alert !important; - } - - .remark { - background-color: $light-success !important; - } -} - -/* codeviewer toolbar */ -#codeviewer { - .toolbar { - background: $primary-two; - margin: 0 0 10px; - padding: 2px; - } - - .tools { - background-color: $background-main; - font: 0.825em $fonts; - padding: 5px 0; - text-align: right; - - a { - background-color: inherit; - color: $link; - font-size: 1.1em; - margin-right: 10px; - text-decoration: none; - } - - a:hover { - background-color: inherit; - color: $darker-orange; - text-decoration: none; - } - } -} diff --git a/app/assets/stylesheets/common/codeviewer.scss b/app/assets/stylesheets/common/codeviewer.scss new file mode 100644 index 0000000000..41919ea9fc --- /dev/null +++ b/app/assets/stylesheets/common/codeviewer.scss @@ -0,0 +1,67 @@ +@import 'mixins'; +@import 'constants'; + +/* codeviewer */ +#codeviewer { + .toolbar { + background: $primary-two; + margin: 0 0 10px; + padding: 2px; + } + + .tools { + background-color: $background-main; + font: 0.825em $fonts; + padding: 5px 0; + text-align: right; + + a { + background-color: inherit; + color: $link; + font-size: 1.1em; + margin-right: 10px; + text-decoration: none; + } + + a:hover { + background-color: inherit; + color: $darker-orange; + text-decoration: none; + } + } + + :not(pre) > code[class*='language-'], + pre[class*='language-'] { + background-color: unset; + margin-top: 0; + padding-top: 0; + } + + pre[class*='language-'] { + border: 0; + } + + .line-numbers > code[class*='language-'] { + padding-top: 2px; // Fix alignment of code and line numbers + } + + .line-numbers-rows { + border-right: 0; + } +} + +.source-code-glowing-1 { + background-color: $light-alert !important; +} + +.source-code-glowing-2 { + background-color: $severe-alert !important; +} + +.source-code-glowing-3 { + background-color: $alert !important; +} + +.remark { + background-color: $light-success !important; +} diff --git a/app/assets/stylesheets/entrypoints/result_main.scss b/app/assets/stylesheets/entrypoints/result_main.scss index 7c10ffed91..85018972b0 100644 --- a/app/assets/stylesheets/entrypoints/result_main.scss +++ b/app/assets/stylesheets/entrypoints/result_main.scss @@ -1,3 +1,3 @@ -@use 'common/SyntaxHighlighter'; +@use 'common/codeviewer'; @use 'context_menu'; @use 'grader'; diff --git a/app/javascript/application_webpack.js b/app/javascript/application_webpack.js index 838da9d344..c781360e39 100644 --- a/app/javascript/application_webpack.js +++ b/app/javascript/application_webpack.js @@ -54,6 +54,10 @@ import "javascripts/chart_config"; import flatpickr from "flatpickr"; window.flatpickr = flatpickr; +// prism +window.Prism = window.Prism || {}; +window.Prism.manual = true; + window.Routes = require("./routes"); // create a global icon for the help system diff --git a/app/javascript/dark_theme.js b/app/javascript/dark_theme.js new file mode 100644 index 0000000000..bb93775542 --- /dev/null +++ b/app/javascript/dark_theme.js @@ -0,0 +1,2 @@ +// Use this file to import vendored CSS for the light color theme +import "prismjs/themes/prism-twilight.min.css"; diff --git a/app/javascript/light_theme.js b/app/javascript/light_theme.js new file mode 100644 index 0000000000..30132a2224 --- /dev/null +++ b/app/javascript/light_theme.js @@ -0,0 +1,2 @@ +// Use this file to import vendored CSS for the light color theme +import "prismjs/themes/prism.min.css"; diff --git a/app/javascript/result.js b/app/javascript/result.js index 542da5f4e6..a762a6d85c 100644 --- a/app/javascript/result.js +++ b/app/javascript/result.js @@ -12,3 +12,4 @@ window.pdfjs = pdfjs; window.pdfjsViewer = pdfjsViewer; import "pdfjs-dist/web/pdf_viewer.css"; +import "prismjs/plugins/line-numbers/prism-line-numbers.css"; diff --git a/app/lib/file_helper.rb b/app/lib/file_helper.rb index d22072982f..8db5ccc159 100644 --- a/app/lib/file_helper.rb +++ b/app/lib/file_helper.rb @@ -12,15 +12,16 @@ module FileHelper '.rb' => 'ruby', '.py' => 'python', '.js' => 'javascript', + '.jsx' => 'jsx', '.html' => 'html', '.css' => 'css', '.c' => 'c', '.h' => 'c', - '.cpp' => 'c', + '.cpp' => 'cpp', '.hs' => 'haskell', '.scm' => 'scheme', '.ss' => 'scheme', - '.rkt' => 'scheme', + '.rkt' => 'racket', '.tex' => 'tex', '.jpeg' => 'image', '.jpg' => 'image', @@ -32,7 +33,14 @@ module FileHelper '.pdf' => 'pdf', '.ipynb' => 'jupyter-notebook', '.r' => 'r', - '.rmd' => 'rmarkdown', + '.rmd' => 'markdown', + '.md' => 'markdown', + '.sql' => 'sql', + '.csv' => 'csv', + '.json' => 'json', + '.sh' => 'sh', + '.cmake' => 'cmake', + '.make' => 'makefile', '.markusurl' => 'markusurl' }.freeze COMMENT_TO_SYNTAX = { '.java' => %w[/* */], @@ -57,10 +65,8 @@ def self.sanitize_file_name(file_name) ) end + # Return a file type based on the extension of +filename+. Used for syntax highlighting. def self.get_file_type(filename) - # This is where you can add more languages that SubmissionFile will - # recognize. It will return the name of the language, which - # SyntaxHighlighter can work with. extension = File.extname(filename).downcase if EXT_TO_TYPE.key?(extension) EXT_TO_TYPE[extension] diff --git a/app/views/layouts/_head.html.erb b/app/views/layouts/_head.html.erb index 64c5711902..06a249fa51 100644 --- a/app/views/layouts/_head.html.erb +++ b/app/views/layouts/_head.html.erb @@ -5,7 +5,13 @@ <%= csrf_meta_tags %> <%= csp_meta_tag %> <%= stylesheet_link_tag 'application' %> -<%= favicon_link_tag(@current_user&.theme == 'dark' ? 'favicon_dark.svg' : 'favicon.ico') %> +<% if @current_user&.theme == 'dark' %> + <%= stylesheet_link_tag 'dark_theme' %> + <%= favicon_link_tag 'favicon_dark.svg' %> +<% else %> + <%= stylesheet_link_tag 'light_theme' %> + <%= favicon_link_tag 'favicon.ico' %> +<% end %> <%= javascript_tag("const AUTH_TOKEN = document.querySelector('[name=\"csrf-token\"]').content;", nonce: true) if protect_against_forgery?%> <%= javascript_tag nonce: true do %> const MARKUS_VERSION = '<%= Rails.configuration.markus_version %>'; diff --git a/app/views/results/common/_syntax_highlighter_brushes.html.erb b/app/views/results/common/_syntax_highlighter_brushes.html.erb index 79d9f35366..bb6e27813d 100644 --- a/app/views/results/common/_syntax_highlighter_brushes.html.erb +++ b/app/views/results/common/_syntax_highlighter_brushes.html.erb @@ -10,6 +10,3 @@ 'Annotations/pdf_annotation_manager', 'Annotations/notebook_annotations', nonce: true %> - -<% # SYNTAX HIGHLIGHTER %> -<%= javascript_include_tag 'syntaxhighlighter', nonce: true %> diff --git a/babel.config.js b/babel.config.js index d50fcd92db..d01b1c0bab 100644 --- a/babel.config.js +++ b/babel.config.js @@ -45,6 +45,36 @@ module.exports = function (api) { regenerator: true, }, ], + [ + "prismjs", + { + languages: [ + "c", + "cmake", + "cpp", + "css", + "csv", + "haskell", + "html", + "java", + "javascript", + "json", + "jsx", + "makefile", + "markdown", + "python", + "r", + "racket", + "ruby", + "scheme", + "sh", + "sql", + "tex", + ], + plugins: ["line-numbers"], + css: false, + }, + ], ].filter(Boolean), sourceType: "unambiguous", }; diff --git a/package-lock.json b/package-lock.json index 963cfdd4b0..9cc3248383 100644 --- a/package-lock.json +++ b/package-lock.json @@ -30,6 +30,7 @@ "moment": "^2.30.1", "mousetrap": "^1.6.5", "pdfjs-dist": "^4.3.136", + "prismjs": "^1.29.0", "prop-types": "^15.8.1", "react": "^16.14.0", "react-chartjs-2": "^5.2.0", @@ -50,6 +51,7 @@ "@testing-library/react": "^12.1.5", "babel-jest": "^29.4.3", "babel-loader": "^9.1.3", + "babel-plugin-prismjs": "^2.1.0", "css-loader": "^7.1.1", "enzyme": "^3.11.0", "enzyme-adapter-react-16": "^1.15.8", @@ -4154,6 +4156,15 @@ "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" } }, + "node_modules/babel-plugin-prismjs": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/babel-plugin-prismjs/-/babel-plugin-prismjs-2.1.0.tgz", + "integrity": "sha512-ehzSKYfeAz4U78zi/sfwsjDPlq0LvDKxNefcZTJ/iKBu+plsHsLqZhUeGf1+82LAcA35UZGbU6ksEx2Utphc/g==", + "dev": true, + "peerDependencies": { + "prismjs": "^1.18.0" + } + }, "node_modules/babel-preset-current-node-syntax": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.1.tgz", @@ -9728,6 +9739,14 @@ "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", "dev": true }, + "node_modules/prismjs": { + "version": "1.29.0", + "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.29.0.tgz", + "integrity": "sha512-Kx/1w86q/epKcmte75LNrEoT+lX8pBpavuAbvJWRXar7Hz8jrtF+e3vY751p0R8H9HdArwaCTNDDzHg/ScJK1Q==", + "engines": { + "node": ">=6" + } + }, "node_modules/promise-polyfill": { "version": "8.2.3", "resolved": "https://registry.npmjs.org/promise-polyfill/-/promise-polyfill-8.2.3.tgz", @@ -14848,6 +14867,13 @@ "@babel/helper-define-polyfill-provider": "^0.6.1" } }, + "babel-plugin-prismjs": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/babel-plugin-prismjs/-/babel-plugin-prismjs-2.1.0.tgz", + "integrity": "sha512-ehzSKYfeAz4U78zi/sfwsjDPlq0LvDKxNefcZTJ/iKBu+plsHsLqZhUeGf1+82LAcA35UZGbU6ksEx2Utphc/g==", + "dev": true, + "requires": {} + }, "babel-preset-current-node-syntax": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.1.tgz", @@ -18917,6 +18943,11 @@ } } }, + "prismjs": { + "version": "1.29.0", + "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.29.0.tgz", + "integrity": "sha512-Kx/1w86q/epKcmte75LNrEoT+lX8pBpavuAbvJWRXar7Hz8jrtF+e3vY751p0R8H9HdArwaCTNDDzHg/ScJK1Q==" + }, "promise-polyfill": { "version": "8.2.3", "resolved": "https://registry.npmjs.org/promise-polyfill/-/promise-polyfill-8.2.3.tgz", diff --git a/package.json b/package.json index c91276643c..9689491d47 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "moment": "^2.30.1", "mousetrap": "^1.6.5", "pdfjs-dist": "^4.3.136", + "prismjs": "^1.29.0", "prop-types": "^15.8.1", "react": "^16.14.0", "react-chartjs-2": "^5.2.0", @@ -45,6 +46,7 @@ "@testing-library/react": "^12.1.5", "babel-jest": "^29.4.3", "babel-loader": "^9.1.3", + "babel-plugin-prismjs": "^2.1.0", "css-loader": "^7.1.1", "enzyme": "^3.11.0", "enzyme-adapter-react-16": "^1.15.8", diff --git a/spec/controllers/submissions_controller_spec.rb b/spec/controllers/submissions_controller_spec.rb index 0528109982..609cf36550 100644 --- a/spec/controllers/submissions_controller_spec.rb +++ b/spec/controllers/submissions_controller_spec.rb @@ -1763,7 +1763,7 @@ get_as instructor, :get_file, params: { course_id: course.id, id: submission.id, submission_file_id: submission_file.id } - expect(response.parsed_body['type']).to eq 'rmarkdown' + expect(response.parsed_body['type']).to eq 'markdown' end end diff --git a/vendor/assets/javascripts/syntaxhighlighter.js b/vendor/assets/javascripts/syntaxhighlighter.js deleted file mode 100644 index 6d184dfb40..0000000000 --- a/vendor/assets/javascripts/syntaxhighlighter.js +++ /dev/null @@ -1,2 +0,0 @@ -//= require syntaxhighlighter_lib/shCore -//= require_directory ./syntaxhighlighter_lib diff --git a/vendor/assets/javascripts/syntaxhighlighter_lib/shBrushCSharp.js b/vendor/assets/javascripts/syntaxhighlighter_lib/shBrushCSharp.js deleted file mode 100644 index b8beffb561..0000000000 --- a/vendor/assets/javascripts/syntaxhighlighter_lib/shBrushCSharp.js +++ /dev/null @@ -1,32 +0,0 @@ -dp.sh.Brushes.CSharp = function() -{ - var keywords = 'abstract as base bool break byte case catch char checked class const ' + - 'continue decimal default delegate do double else enum event explicit ' + - 'extern false finally fixed float for foreach get goto if implicit in int ' + - 'interface internal is lock long namespace new null object operator out ' + - 'override params private protected public readonly ref return sbyte sealed set ' + - 'short sizeof stackalloc static string struct switch this throw true try ' + - 'typeof uint ulong unchecked unsafe ushort using virtual void while'; - - this.regexList = [ - // There's a slight problem with matching single line comments and figuring out - // a difference between // and ///. Using lookahead and lookbehind solves the - // problem, unfortunately JavaScript doesn't support lookbehind. So I'm at a - // loss how to translate that regular expression to JavaScript compatible one. -// { regex: new RegExp('(? - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, version 3 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -dp.sh.Brushes.Haskell = function() -{ - - var keywords = 'case class data deriving do else if in infixl infixr instance let module of' + - 'primitive then type where import as hiding qualified newtype default'; - - var control = 'do if then else' - var syntax_operators = '=> -> <- :: \\'; - var prelude_funcs = '\\$! catch !! \\$ && \\+\\+ . =<< minBound maxBound succ pred toEnum fromEnum enumFrom enumFromThen enumFromTo enumFromThenTo == /= pi exp sqrt log \\*\\* \\(\\*\\*\\) logBase sin tan cos asin atan acos sinh tanh cosh asinh atanh acosh / recip fromRational quot rem div mod quotRem divMod toInteger \\(>>=\\) >>= \\(>>\\) >> return fail \\(\\+\\) \\+ \\(\\*\\) \\* \\(\\-\\) \\- negate abs signum fromInteger compare \\(<\\) < \\(>=\\) >= \\(>\\) > \\(<=\\) <= max min readsPrec readList floatRadix floatDigits floatRange decodeFloat encodeFloat exponent significand scaleFloat isNaN isInfinite isDenormalized isNegativeZero isIEEE atan2 properFraction truncate round ceiling floor showsPrec show showList \\(\\^\\) \\^ \\(\\^\\^\\) \\^\\^ all and any appendFile asTypeOf break concat concatMap const curry cycle drop dropWhile either elem error even filter flip foldl foldl1 foldr foldr1 fromIntegral fst gcd getChar getContents getLine head id init interact ioError iterate last lcm length lex lines lookup map mapM mapM_ maximum maybe minimum not notElem null odd or otherwise print product putChar putStr putStrLn read readFile readIO readLn readParen reads realToFrac repeat replicate reverse scanl scanl1 scanr scanr1 seq sequence sequence_ showChar showParen showString shows snd span splitAt subtract sum tail take takeWhile uncurry undefined unlines until unwords unzip unzip3 userError words writeFile zip zip3 zipWith zipWith3 \\(\\|\\|\\) \\|\\|' - var common_operators = "\\$ \\. >>= >> <\\$> <\\*> \\+\\+ \\+ \\- \\*"; - - this.regexList = [ - { regex: new RegExp('--.*$', 'gm'), css: 'comment' }, // one line comments - { regex: new RegExp('\{-[^]*?-}', 'gm'), css: 'comment' }, // multiline comments - { regex: dp.sh.RegexLib.DoubleQuotedString, css: 'string' }, // double quoted strings - { regex: dp.sh.RegexLib.SingleQuotedString, css: 'string' }, // single quoted strings - { regex: new RegExp(this.GetKeywords(keywords), 'g'), css: 'keyword' }, // keyword - { regex: new RegExp(this.GetKeywords(prelude_funcs), 'g'), css: 'keyword' }, // common operators - ]; - this.CssClass = 'dp-hs'; - this.style = '.haskell.syntax_operators { color: #993300; }' + - '.haskell.common_operators { color: #993300; }' + - '.haskell.type_constructors { font-style: italic; }'; -}; - -dp.sh.Brushes.Haskell.prototype = new dp.sh.Highlighter(); -dp.sh.Brushes.Haskell.Aliases = ['haskell','hs']; diff --git a/vendor/assets/javascripts/syntaxhighlighter_lib/shBrushJScript.js b/vendor/assets/javascripts/syntaxhighlighter_lib/shBrushJScript.js deleted file mode 100644 index 673d001a96..0000000000 --- a/vendor/assets/javascripts/syntaxhighlighter_lib/shBrushJScript.js +++ /dev/null @@ -1,22 +0,0 @@ -dp.sh.Brushes.JScript = function() -{ - var keywords = 'abstract boolean break byte case catch char class const continue debugger ' + - 'default delete do double else enum export extends false final finally float ' + - 'for function goto if implements import in instanceof int interface long native ' + - 'new null package private protected public return short static super switch ' + - 'synchronized this throw throws transient true try typeof var void volatile while with'; - - this.regexList = [ - { regex: dp.sh.RegexLib.SingleLineCComments, css: 'comment' }, // one line comments - { regex: dp.sh.RegexLib.MultiLineCComments, css: 'comment' }, // multiline comments - { regex: dp.sh.RegexLib.DoubleQuotedString, css: 'string' }, // double quoted strings - { regex: dp.sh.RegexLib.SingleQuotedString, css: 'string' }, // single quoted strings - { regex: new RegExp('^\\s*#.*', 'gm'), css: 'preprocessor' }, // preprocessor tags like #region and #endregion - { regex: new RegExp(this.GetKeywords(keywords), 'gm'), css: 'keyword' } // keywords - ]; - - this.CssClass = 'dp-c'; -} - -dp.sh.Brushes.JScript.prototype = new dp.sh.Highlighter(); -dp.sh.Brushes.JScript.Aliases = ['js', 'jscript', 'javascript']; diff --git a/vendor/assets/javascripts/syntaxhighlighter_lib/shBrushJava.js b/vendor/assets/javascripts/syntaxhighlighter_lib/shBrushJava.js deleted file mode 100644 index 9b1648bca5..0000000000 --- a/vendor/assets/javascripts/syntaxhighlighter_lib/shBrushJava.js +++ /dev/null @@ -1,28 +0,0 @@ -dp.sh.Brushes.Java = function() -{ - var keywords = 'abstract assert boolean break byte case catch char class const ' + - 'continue default do double else enum extends ' + - 'false final finally float for goto if implements import ' + - 'instanceof int interface long native new null ' + - 'package private protected public return ' + - 'short static strictfp super switch synchronized this throw throws true ' + - 'transient try void volatile while'; - - this.regexList = [ - { regex: dp.sh.RegexLib.SingleLineCComments, css: 'comment' }, // one line comments - { regex: dp.sh.RegexLib.MultiLineCComments, css: 'comment' }, // multiline comments - { regex: dp.sh.RegexLib.DoubleQuotedString, css: 'string' }, // strings - { regex: dp.sh.RegexLib.SingleQuotedString, css: 'string' }, // strings - { regex: new RegExp('\\b([\\d]+(\\.[\\d]+)?|0x[a-f0-9]+)\\b', 'gi'), css: 'number' }, // numbers - { regex: new RegExp('(?!\\@interface\\b)\\@[\\$\\w]+\\b', 'g'), css: 'annotation' }, // annotation @anno - { regex: new RegExp('\\@interface\\b', 'g'), css: 'keyword' }, // @interface keyword - { regex: new RegExp(this.GetKeywords(keywords), 'gm'), css: 'keyword' } // java keyword - ]; - - this.CssClass = 'dp-j'; - this.Style = '.dp-j .annotation { color: #646464; }' + - '.dp-j .number { color: #C00000; }'; -} - -dp.sh.Brushes.Java.prototype = new dp.sh.Highlighter(); -dp.sh.Brushes.Java.Aliases = ['java']; diff --git a/vendor/assets/javascripts/syntaxhighlighter_lib/shBrushLatex.js b/vendor/assets/javascripts/syntaxhighlighter_lib/shBrushLatex.js deleted file mode 100644 index 72e2c46adf..0000000000 --- a/vendor/assets/javascripts/syntaxhighlighter_lib/shBrushLatex.js +++ /dev/null @@ -1,45 +0,0 @@ -/** - * SyntaxHighlighter - * http://alexgorbatchev.com/ - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate - * - * @version - * 2.0.296 (March 01 2009) - * - * @copyright - * Copyright (C) 2004-2009 Alex Gorbatchev. - * - * @license - * This file is part of SyntaxHighlighter. - * - * SyntaxHighlighter is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * SyntaxHighlighter is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with SyntaxHighlighter. If not, see . - * - * - * Very simple Latex brush - * http://www.jorgemarsal.com/blog/ - */ - -dp.sh.Brushes.Latex = function() -{ - this.regexList = [ - { regex: new RegExp('%.*','gm'), css: 'comments' }, // one line comments - { regex: dp.sh.RegexLib.DoubleQuotedString, css: 'string' }, // double quoted strings - { regex: new RegExp('\\\\\\w*','gm'), css: 'keyword' }, // commands - ]; -} - -dp.sh.Brushes.Latex.prototype = new dp.sh.Highlighter(); -dp.sh.Brushes.Latex.Aliases = ['latex', 'tex']; diff --git a/vendor/assets/javascripts/syntaxhighlighter_lib/shBrushMarkdown.js b/vendor/assets/javascripts/syntaxhighlighter_lib/shBrushMarkdown.js deleted file mode 100644 index ebeadbd8ec..0000000000 --- a/vendor/assets/javascripts/syntaxhighlighter_lib/shBrushMarkdown.js +++ /dev/null @@ -1,59 +0,0 @@ -/** - * shBrushMarkdown.js - * Adapted from https://gist.github.com/1979689 - * - * @version - * 1.0.0 (March 06 2012) - * - * @copyright - * copyright (C) 2012 hekt . - * - * @license - * MIT license - */ -dp.sh.Brushes.Markdown = function() -{ - this.regexList = [ - {regex: dp.sh.RegexLib.SingleLinePerlComments, - css: 'comments'}, // comments - {regex: new RegExp('.+\\n([=-]{4,})', 'gm'), - css: 'functions' }, // headers - {regex: new RegExp('^#+\\s+.*', 'gm'), - css: 'functions' }, // headers - {regex: new RegExp('^(>|>)\\s+.*', 'gm'), - css: 'string' }, // blockquotes - {regex: new RegExp('^([0-9]+.|[*+-])\\s', 'gm'), - css: 'keyword' }, // lists - {regex: new RegExp('\\n\\n((\\s{4,}|\\t).*\\n?)+', 'gm'), - css: 'constants' }, // code block - {regex: new RegExp('^([*-_])(\\1{2,}|(\\s\\1){2,}).*', 'gm'), - css: 'functions' }, // horizontal rules - {regex: new RegExp('\\!?\\[[^\\]]*\\]\\s?(\\([^\\)]*\\)|\\[[^\\]]*\\])', - 'gm'), - css: 'keyword'}, // links and images - {regex: new RegExp('^\\s{0,3}\\[[^\\]]*\\]:\\s.*', 'gm'), - css: 'string'}, // references - {regex: new RegExp('\\*([^*\\s]([^*]|\\\\\\*)*[^*\\s]|[^*\\s])\\*', - 'gm'), - css: 'italic' }, // emphasis * - {regex: new RegExp('\\_([^_\\s]([^_]|\\\\_)*[^_\\s]|[^_\\s])_', 'gm'), - css: 'italic' }, // emphasis _ - {regex: new RegExp('\\*{2}([^\\s]([^*]|\\\\\\*\\*|[^*]\\*[^*])*[^\\s]|[^*\\s])\\*{2}', - 'gm'), - css: 'bold' }, // emphasis ** - {regex: new RegExp('__([^\\s]([^_]|\\\\__|[^_]_[^_])*[^\\s]|[^_\\s])__', - 'gm'), - css: 'bold' }, // emphasis __ - {regex: new RegExp('`(\\\\`|[^`])+`', 'gm'), - css: 'constants' }, // code ` - {regex: new RegExp('(`{2,}).*\\1', 'gm'), - css: 'constants' }, // code `` - {regex: new RegExp('(<|<).+[:@].+(>|>)', 'gm'), - css: 'keyword' } // automatic links - ]; - - this.CssClass = 'dp-markdown'; -} - -dp.sh.Brushes.Markdown.prototype = new dp.sh.Highlighter(); -dp.sh.Brushes.Markdown.Aliases = ['markdown', 'md', 'mdt', 'rmarkdown', 'rmd']; diff --git a/vendor/assets/javascripts/syntaxhighlighter_lib/shBrushPhp.js b/vendor/assets/javascripts/syntaxhighlighter_lib/shBrushPhp.js deleted file mode 100644 index 0add7cc19a..0000000000 --- a/vendor/assets/javascripts/syntaxhighlighter_lib/shBrushPhp.js +++ /dev/null @@ -1,60 +0,0 @@ -dp.sh.Brushes.Php = function() -{ - var funcs = 'abs acos acosh addcslashes addslashes ' + - 'array_change_key_case array_chunk array_combine array_count_values array_diff '+ - 'array_diff_assoc array_diff_key array_diff_uassoc array_diff_ukey array_fill '+ - 'array_filter array_flip array_intersect array_intersect_assoc array_intersect_key '+ - 'array_intersect_uassoc array_intersect_ukey array_key_exists array_keys array_map '+ - 'array_merge array_merge_recursive array_multisort array_pad array_pop array_product '+ - 'array_push array_rand array_reduce array_reverse array_search array_shift '+ - 'array_slice array_splice array_sum array_udiff array_udiff_assoc '+ - 'array_udiff_uassoc array_uintersect array_uintersect_assoc '+ - 'array_uintersect_uassoc array_unique array_unshift array_values array_walk '+ - 'array_walk_recursive atan atan2 atanh base64_decode base64_encode base_convert '+ - 'basename bcadd bccomp bcdiv bcmod bcmul bindec bindtextdomain bzclose bzcompress '+ - 'bzdecompress bzerrno bzerror bzerrstr bzflush bzopen bzread bzwrite ceil chdir '+ - 'checkdate checkdnsrr chgrp chmod chop chown chr chroot chunk_split class_exists '+ - 'closedir closelog copy cos cosh count count_chars date decbin dechex decoct '+ - 'deg2rad delete ebcdic2ascii echo empty end ereg ereg_replace eregi eregi_replace error_log '+ - 'error_reporting escapeshellarg escapeshellcmd eval exec exit exp explode extension_loaded '+ - 'feof fflush fgetc fgetcsv fgets fgetss file_exists file_get_contents file_put_contents '+ - 'fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype '+ - 'floatval flock floor flush fmod fnmatch fopen fpassthru fprintf fputcsv fputs fread fscanf '+ - 'fseek fsockopen fstat ftell ftok getallheaders getcwd getdate getenv gethostbyaddr gethostbyname '+ - 'gethostbynamel getimagesize getlastmod getmxrr getmygid getmyinode getmypid getmyuid getopt '+ - 'getprotobyname getprotobynumber getrandmax getrusage getservbyname getservbyport gettext '+ - 'gettimeofday gettype glob gmdate gmmktime ini_alter ini_get ini_get_all ini_restore ini_set '+ - 'interface_exists intval ip2long is_a is_array is_bool is_callable is_dir is_double '+ - 'is_executable is_file is_finite is_float is_infinite is_int is_integer is_link is_long '+ - 'is_nan is_null is_numeric is_object is_readable is_real is_resource is_scalar is_soap_fault '+ - 'is_string is_subclass_of is_uploaded_file is_writable is_writeable mkdir mktime nl2br '+ - 'parse_ini_file parse_str parse_url passthru pathinfo readlink realpath rewind rewinddir rmdir '+ - 'round str_ireplace str_pad str_repeat str_replace str_rot13 str_shuffle str_split '+ - 'str_word_count strcasecmp strchr strcmp strcoll strcspn strftime strip_tags stripcslashes '+ - 'stripos stripslashes stristr strlen strnatcasecmp strnatcmp strncasecmp strncmp strpbrk '+ - 'strpos strptime strrchr strrev strripos strrpos strspn strstr strtok strtolower strtotime '+ - 'strtoupper strtr strval substr substr_compare'; - - var keywords = 'and or xor __FILE__ __LINE__ array as break case ' + - 'cfunction class const continue declare default die do else ' + - 'elseif empty enddeclare endfor endforeach endif endswitch endwhile ' + - 'extends for foreach function include include_once global if ' + - 'new old_function return static switch use require require_once ' + - 'var while __FUNCTION__ __CLASS__ ' + - '__METHOD__ abstract interface public implements extends private protected throw'; - - this.regexList = [ - { regex: dp.sh.RegexLib.SingleLineCComments, css: 'comment' }, // one line comments - { regex: dp.sh.RegexLib.MultiLineCComments, css: 'comment' }, // multiline comments - { regex: dp.sh.RegexLib.DoubleQuotedString, css: 'string' }, // double quoted strings - { regex: dp.sh.RegexLib.SingleQuotedString, css: 'string' }, // single quoted strings - { regex: new RegExp('\\$\\w+', 'g'), css: 'vars' }, // variables - { regex: new RegExp(this.GetKeywords(funcs), 'gmi'), css: 'func' }, // functions - { regex: new RegExp(this.GetKeywords(keywords), 'gm'), css: 'keyword' } // keyword - ]; - - this.CssClass = 'dp-c'; -} - -dp.sh.Brushes.Php.prototype = new dp.sh.Highlighter(); -dp.sh.Brushes.Php.Aliases = ['php']; diff --git a/vendor/assets/javascripts/syntaxhighlighter_lib/shBrushPython.js b/vendor/assets/javascripts/syntaxhighlighter_lib/shBrushPython.js deleted file mode 100644 index a3b42ee7fc..0000000000 --- a/vendor/assets/javascripts/syntaxhighlighter_lib/shBrushPython.js +++ /dev/null @@ -1,30 +0,0 @@ -/* Python 2.3 syntax contributed by Gheorghe Milas */ -dp.sh.Brushes.Python = function() -{ - var keywords = 'and assert break class continue def del elif else ' + - 'except exec finally for from global if import in is ' + - 'lambda not or pass print raise return try yield while'; - - var special = 'None True False self cls class_' - - this.regexList = [ - { regex: dp.sh.RegexLib.SingleLinePerlComments, css: 'comment' }, - { regex: new RegExp("^\\s*@\\w+", 'gm'), css: 'decorator' }, - { regex: new RegExp("(['\"]{3})([^\\1])*?\\1", 'gm'), css: 'comment' }, - { regex: new RegExp('"(?!")(?:\\.|\\\\\\"|[^\\""\\n\\r])*"(?!")', 'gm'), css: 'string' }, - { regex: new RegExp("'(?!')*(?:\\.|(\\\\\\')|[^\\''\\n\\r])*'(?!')", 'gm'), css: 'string' }, - { regex: new RegExp("\\b\\d+\\.?\\w*", 'g'), css: 'number' }, - { regex: new RegExp(this.GetKeywords(keywords), 'gm'), css: 'keyword' }, - { regex: new RegExp(this.GetKeywords(special), 'gm'), css: 'special' } - ]; - - this.CssClass = 'dp-py'; - this.Style = '.dp-py .builtins { color: #ff1493; }' + - '.dp-py .magicmethods { color: #808080; }' + - '.dp-py .exceptions { color: brown; }' + - '.dp-py .types { color: brown; font-style: italic; }' + - '.dp-py .commonlibs { color: #8A2BE2; font-style: italic; }'; -} - -dp.sh.Brushes.Python.prototype = new dp.sh.Highlighter(); -dp.sh.Brushes.Python.Aliases = ['py', 'python']; diff --git a/vendor/assets/javascripts/syntaxhighlighter_lib/shBrushR.js b/vendor/assets/javascripts/syntaxhighlighter_lib/shBrushR.js deleted file mode 100644 index 34a42f38cf..0000000000 --- a/vendor/assets/javascripts/syntaxhighlighter_lib/shBrushR.js +++ /dev/null @@ -1,24 +0,0 @@ -// Syntax highlighting based on RStudio: -// https://github.com/rstudio/rstudio/blob/master/src/cpp/session/resources/r_highlight.html -dp.sh.Brushes.R = function() -{ - var keywords = 'if in break next repeat else for return switch while try ' + - 'stop warning require attach detach source setMethod setClass function ' + - 'tryCatch library setGeneric setGroupGeneric'; - - var special = 'NA NA_integer_ NA_real_ NA_character_ NA_complex_'; - - this.regexList = [ - { regex: dp.sh.RegexLib.SingleLinePerlComments, css: 'comment' }, - { regex: new RegExp('"(?!")(?:\\.|\\\\\\"|[^\\""\\n\\r])*"(?!")', 'gm'), css: 'string' }, - { regex: new RegExp("'(?!')*(?:\\.|(\\\\\\')|[^\\''\\n\\r])*'(?!')", 'gm'), css: 'string' }, - { regex: new RegExp("\\b\\d+\\.?\\w*", 'g'), css: 'number' }, - { regex: new RegExp(this.GetKeywords(keywords), 'gm'), css: 'keyword' }, - { regex: new RegExp(this.GetKeywords(special), 'gm'), css: 'special' } - ]; - - this.CssClass = 'dp-r'; -} - -dp.sh.Brushes.R.prototype = new dp.sh.Highlighter(); -dp.sh.Brushes.R.Aliases = ['r']; diff --git a/vendor/assets/javascripts/syntaxhighlighter_lib/shBrushRuby.js b/vendor/assets/javascripts/syntaxhighlighter_lib/shBrushRuby.js deleted file mode 100644 index 47768afe1b..0000000000 --- a/vendor/assets/javascripts/syntaxhighlighter_lib/shBrushRuby.js +++ /dev/null @@ -1,28 +0,0 @@ -/* Ruby 1.8.4 syntax contributed by Erik Peterson */ -dp.sh.Brushes.Ruby = function() -{ - var keywords = 'alias and BEGIN begin break case class def define_method defined do each else elsif ' + - 'END end ensure false for if in module new next nil not or raise redo rescue retry return ' + - 'self super then throw true undef unless until when while yield'; - - var builtins = 'Array Bignum Binding Class Continuation Dir Exception FalseClass File::Stat File Fixnum Fload ' + - 'Hash Integer IO MatchData Method Module NilClass Numeric Object Proc Range Regexp String Struct::TMS Symbol ' + - 'ThreadGroup Thread Time TrueClass' - - this.regexList = [ - { regex: dp.sh.RegexLib.SingleLinePerlComments, css: 'comment' }, // one line comments - { regex: dp.sh.RegexLib.DoubleQuotedString, css: 'string' }, // double quoted strings - { regex: dp.sh.RegexLib.SingleQuotedString, css: 'string' }, // single quoted strings - { regex: new RegExp(':[a-z][A-Za-z0-9_]*', 'g'), css: 'symbol' }, // symbols - { regex: new RegExp('(\\$|@@|@)\\w+', 'g'), css: 'variable' }, // $global, @instance, and @@class variables - { regex: new RegExp(this.GetKeywords(keywords), 'gm'), css: 'keyword' }, // keywords - { regex: new RegExp(this.GetKeywords(builtins), 'gm'), css: 'builtin' } // builtins - ]; - - this.CssClass = 'dp-rb'; - this.Style = '.dp-rb .symbol { color: #a70; }' + - '.dp-rb .variable { color: #a70; font-weight: bold; }'; -} - -dp.sh.Brushes.Ruby.prototype = new dp.sh.Highlighter(); -dp.sh.Brushes.Ruby.Aliases = ['ruby', 'rails', 'ror']; diff --git a/vendor/assets/javascripts/syntaxhighlighter_lib/shBrushScheme.js b/vendor/assets/javascripts/syntaxhighlighter_lib/shBrushScheme.js deleted file mode 100644 index 596d1b1d40..0000000000 --- a/vendor/assets/javascripts/syntaxhighlighter_lib/shBrushScheme.js +++ /dev/null @@ -1,27 +0,0 @@ -/* Scheme syntax contributed by ohyecloudy at gmail.com*/ -dp.sh.Brushes.Scheme=function() -{ - var keywords= - 'and begin ' + - 'call-with-current-continuation call-with-input-file call-with-output-file case cond ' + - 'define define-syntax delay do dynamic-wind ' + - 'else for-each if ' + - 'lambda let let* let-syntax letrec letrec-syntax ' + - 'map or syntax-rules'; - - this.regexList = [ - { regex: new RegExp('( |^);.*$', 'gm'), css: 'comment' }, - { regex: new RegExp('#\\|[\\s\\S]*?\\|#', 'gm'), css: 'comment'}, - { regex: dp.sh.RegexLib.DoubleQuotedString, css: 'string' }, - { regex: new RegExp("'.[a-zA-Z0-9_\-]*", 'g'), css: 'symbol' }, - { regex: new RegExp(this.GetKeywords(keywords), 'gm'), css: 'keyword' }, - { regex: new RegExp('[()]', 'gm'), css: 'parenthesis' } - ]; - - this.CssClass = 'dp-scheme'; - this.Style = '.dp-scheme .parenthesis { color: #843C24; }' + - '.dp-scheme .symbol { color: #808080; font-weight: bold;}'; -} - -dp.sh.Brushes.Scheme.prototype = new dp.sh.Highlighter(); -dp.sh.Brushes.Scheme.Aliases = ['scheme']; diff --git a/vendor/assets/javascripts/syntaxhighlighter_lib/shBrushScilab.js b/vendor/assets/javascripts/syntaxhighlighter_lib/shBrushScilab.js deleted file mode 100644 index 03739d4d41..0000000000 --- a/vendor/assets/javascripts/syntaxhighlighter_lib/shBrushScilab.js +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Author: Samuel GOUGEON - France - * Scilab Release: 5.3.1 (3/2011) - */ -dp.sh.Brushes.Scilab = function() -{ - var macros = 'AnalyzeBlobs BottomHat CalculateOtsuThreshold CalculateTextureEnergy CallbackHelp CallbackImageFile CallbackMouseMove CallbackSelectedLine CallbackSelectedPixel CallbackSelectedROI CheckBooleanMatrix CheckGraphicHandle CheckMatrix CheckNumericMatrix CheckScalar CheckString CheckStruct CheckStructureElement CheckVector CloseImage ComputeChannelVariance CreateCumulatedHistogram CreateFeatureStruct CreateHistogram CreateSizeHistogram CreateStructureElement CreateWaveletFrames CumulateSizeHistogram DilateImage DrawBoundingBoxes EdgeFilter ErodeImage ExportAsGlobalVariable FilterBySize FindBestMatches GLoad G_make GetVideoStruct GetWaveletFilters ImageTool Ind2RGB IsAScalar LAB2RGB NDcost OS_Version OpenImage PadImage PlotSparse RGB2Gray RGB2Ind RGB2LAB ReadHBSparse ReadImage ReadmiMatrix ResetFigureDDM ScaleToUInt8 SegmentByThreshold Sfgrayplot Sgrayplot ShowColorImage ShowImage ShowImageHistogram ShowImageProfile ShowLineHistogram TCL_CreateSlave TitleLabel TopHat UpsampleFilter WriteImage WritemiMatrix abcd abinv about accept_func_default accept_func_vfsa acf acosd acosh acoshm acosm acot acotd acoth acsc acscd acsch add_demo add_help_chapter add_module_help_chapter add_param add_profiling addcolor addmenu addmenus adj2sp aff2ab ana_style analpf analyze angle aplat arhnk arl2 arma2p armac armax armax1 arobasestring2strings arsimul ascii2string asciimat asec asecd asech asind asinh asinhm asinm atand atanh atanhm atanm atomsAutoload atomsAutoloadAdd atomsAutoloadDel atomsAutoloadList atomsCategoryList atomsDESCRIPTIONget atomsDepTreeShow atomsGetInstalled atomsGetLoaded atomsGetLoadedPath atomsGui atomsInstall atomsIsInstalled atomsIsLoaded atomsList atomsLoad atomsRemove atomsRepositoryAdd atomsRepositoryDel atomsRepositoryList atomsSearch atomsSetConfig atomsShow atomsSystemInit atomsSystemUpdate atomsTest atomsUpdate atomsVersion augment auread autumncolormap auwrite balreal bar barh barhomogenize base2dec bench_run bilin bilt bin2dec binomial bitand bitcmp bitget bitor bitset bitxor black blanks bloc2exp bloc2ss block_parameter_error bode bonecolormap bstap buttmag bvodeS bytecode bytecodewalk cainv calendar calfrq canon casc cat cat_code cbAtomsGui cb_m2sci_gui ccontrg cell cell2mat cellstr center cepstrum cfspec char chart cheb1mag cheb2mag check2dFun checkXYPair check_classpath check_gateways check_help check_librarypath check_modules_xml check_versions chepol chfact chsolve classmarkov clean_help cleanroots clf clipboard clock close closeDiagramPath cls2dls cmb_lin cmndred cmoment coding_ga_binary coding_ga_identity coff coffg colcomp colcompr colinout color colorbar colordef colormap colregul companion complex compute_initial_temp cond cond2sp condestsp config configure_msifort configure_msvc cont_frm cont_mat contour contour2d contourf contrss convert_to_float convertindex convol coolcolormap copfac coppercolormap correl cosd cosh coshm cosm cotd cotg coth cothm covar create_gif create_palette createfun createpopup createstruct cross crossover_ga_binary crossover_ga_default csc cscd csch csgn cshift csim cspect ctr_gram czt dae daeoptions datafit datatipCreate datatipDefaultDisplay datatipEventhandler datatipGetEntities datatipGetStruct datatipInitStruct datatipManagerMode datatipMove datatipRedraw datatipRemove datatipRemoveAll datatipSetDisplay datatipSetInterp datatipSetOrientation datatipSetStruct datatipToggle date datenum datevec dbphi dcf ddp deblank dec2base dec2bin dec2hex dec2oct del_help_chapter del_module_help_chapter demo_begin demo_choose demo_compiler demo_end demo_file_choice demo_folder_choice demo_function_choice demo_gui demo_mdialog demo_message demo_run demo_viewCode denom derivat derivative des2ss des2tf detectmsifort64tools detectmsvc64tools determ detr detrend devtools_run_builder dft dhnorm diff diophant dir dirname dispfiles dllinfo dragrect driver dscr dsimul dt_ility dtsi edit edit_curv edit_error eigenmarkov ell1mag enlarge_shape entropy eomday epred eqfir eqiir equil equil1 erf erfc erfcx erfinv errbar errorDiagramPath etime eval eval3d eval3dp evans evstr expression2code extract_help_examples fac3d fac3d1 factor factorial factors faurre fchamp fcontour fcontour2d feather ffilt fft2 fftshift fgrayplot fieldnames figure filt_sinc filter findABCD findAC findBDK findR find_freq find_links find_scicos_version findm findmsifortcompiler findmsvccompiler findobj findx0BD firstnonsingleton fit_dat fix fixedpointgcd flipdim flts fminsearch format_txt fourplan fplot2d fplot3d fplot3d1 fprintf frep2tf freson frfit frmag fscanf fseek_origin fsfirlin fspec fspecg fstabst ftest ftuneq fullfile fullrf fullrfk fun2string g_margin gainplot gamitg gauss gca gcare gcd gce gcf gda gdf ged ged_insert gencompilationflags_unix generateBlockImage generateBlockImages generic_i_ce generic_i_h generic_i_hm generic_i_s generic_i_st genfac3d genlib genlib_old genmarkov geomean getColorIndex getDiagramVersion getLineSpec getModelicaPath getPlotPropertyName getSurfPropertyName getTitleLabelPropertyNam get_figure_handle get_file_path get_function_path get_param get_profile get_scicos_version getcolor getd getfont getlinestyle getmark getscilabkeywords getshell getsymbol gettklib getvalue gfare gfrancis ghdl2tree ghdl_fields givens glever gmres gr_menu graduate graycolormap graypolarplot group gschur gspec gtild h2norm h_cl h_inf h_inf_st h_norm hallchart hank hankelsv harmean haveacompiler head_comments help_from_sci help_skeleton hermit hex2dec hilb hilbert hist3d histplot horner hotcolormap householder hrmt hsv2rgb hsvcolormap htrianr hypermat ifft ifftshift iir iirgroup iirlp iirmod ilib_build ilib_compile ilib_for_link ilib_gen_Make ilib_gen_Make_unix ilib_gen_cleaner ilib_gen_gateway ilib_gen_loader ilib_mex_build im_inv importScicosDiagram importScicosPal importXcosDiagram imrep2ss ind2sub inistate init_ga_default init_param initial_scicos_tables input instruction2code intc intcyl intdec integrate interp1 interpln intersect intl intsplin inttrap inv_coeff invr invrs invsyslin iqr isDocked isLeapYear isMacro isReservedWindow is_absolute_path is_param iscell iscellstr isempty isfield isinf isnan isnum isoview issparse isstruct isvector jMat jetcolormap jmat jre_path justify kalm karmarkar kernel kpure krac2 kroneck lattn launchtest lcf lcm lcmdiag leastsq legend legends leqe leqr lev levin lex_sort lft lin lin2mu lincos lindquist linf linfn linsolve linspace list2vec list_param listfiles listfunctions listvarinfile lmisolver lmitool loadScicosLibs loadXcosLibs loadmatfile loadwave locate log10 log2 logm logspace lqe lqg lqg2stan lqg_ltr lqr ls lyap m2sci_gui m_circle macglov macrovar mad makecell manedit mapsound markp2ss matfile2sci mdelete mean meanf median menubar mese mesh meshgrid mfft mfile2sci milk_drop minreal minss mkdir modulo moment mrfit msd mstr2sci mtlb mtlb_0 mtlb_a mtlb_all mtlb_any mtlb_axes mtlb_axis mtlb_beta mtlb_box mtlb_choices mtlb_close mtlb_colordef mtlb_cond mtlb_conv mtlb_cov mtlb_cumprod mtlb_cumsum mtlb_dec2hex mtlb_delete mtlb_diag mtlb_diff mtlb_dir mtlb_double mtlb_e mtlb_echo mtlb_error mtlb_eval mtlb_exist mtlb_eye mtlb_false mtlb_fft mtlb_fftshift mtlb_filter mtlb_find mtlb_findstr mtlb_fliplr mtlb_fopen mtlb_format mtlb_fprintf mtlb_fread mtlb_fscanf mtlb_full mtlb_fwrite mtlb_get mtlb_grid mtlb_hold mtlb_i mtlb_ifft mtlb_image mtlb_imp mtlb_int16 mtlb_int32 mtlb_int8 mtlb_is mtlb_isa mtlb_isfield mtlb_isletter mtlb_isspace mtlb_l mtlb_legendre mtlb_linspace mtlb_logic mtlb_logical mtlb_loglog mtlb_lower mtlb_max mtlb_mean mtlb_median mtlb_mesh mtlb_meshdom mtlb_min mtlb_more mtlb_num2str mtlb_ones mtlb_pcolor mtlb_plot mtlb_prod mtlb_qr mtlb_qz mtlb_rand mtlb_randn mtlb_rcond mtlb_realmax mtlb_realmin mtlb_repmat mtlb_s mtlb_semilogx mtlb_semilogy mtlb_setstr mtlb_size mtlb_sort mtlb_sortrows mtlb_sprintf mtlb_sscanf mtlb_std mtlb_strcmp mtlb_strcmpi mtlb_strfind mtlb_strrep mtlb_subplot mtlb_sum mtlb_t mtlb_toeplitz mtlb_tril mtlb_triu mtlb_true mtlb_type mtlb_uint16 mtlb_uint32 mtlb_uint8 mtlb_upper mtlb_var mtlb_zeros mu2lin mutation_ga_binary mutation_ga_default mvcorrel mvvacov name2rgb nancumsum nand2mean nanmax nanmean nanmeanf nanmedian nanmin nanstdev nansum narsimul nchoosek ndgrid ndims nehari neigh_func_csa neigh_func_default neigh_func_fsa neigh_func_vfsa neldermead_cget neldermead_configure neldermead_costf neldermead_destroy neldermead_display neldermead_function neldermead_get neldermead_log neldermead_new neldermead_restart neldermead_search neldermead_updatesimp nextpow2 nf3d nfreq nicholschart nlev nmplot_cget nmplot_configure nmplot_contour nmplot_destroy nmplot_display nmplot_function nmplot_get nmplot_historyplot nmplot_log nmplot_new nmplot_outputcmd nmplot_restart nmplot_search nmplot_simplexhistory noisegen nonreg_test_run norm now null num2cell num2str numdiff numer nyquist obs_gram obscont observer obsv_mat obsvss oceancolormap oct2dec odeoptions oldplot openDiagramPath optim_ga optim_moga optim_nsga optim_nsga2 optim_sa optimbase_cget optimbase_checkbounds optimbase_checkcostfun optimbase_checkx0 optimbase_configure optimbase_destroy optimbase_display optimbase_function optimbase_get optimbase_hasbounds optimbase_hasconstraints optimbase_hasnlcons optimbase_histget optimbase_histset optimbase_incriter optimbase_isfeasible optimbase_isinbounds optimbase_isinnonlincons optimbase_log optimbase_logshutdown optimbase_logstartup optimbase_new optimbase_outputcmd optimbase_outstruct optimbase_proj2bnds optimbase_set optimbase_stoplog optimbase_terminate optimget optimplotfunccount optimplotfval optimplotx optimset optimsimplex_center optimsimplex_check optimsimplex_compsomefv optimsimplex_computefv optimsimplex_deltafv optimsimplex_deltafvmax optimsimplex_destroy optimsimplex_dirmat optimsimplex_fvmean optimsimplex_fvstdev optimsimplex_fvvariance optimsimplex_getall optimsimplex_getallfv optimsimplex_getallx optimsimplex_getfv optimsimplex_getn optimsimplex_getnbve optimsimplex_getve optimsimplex_getx optimsimplex_gradientfv optimsimplex_log optimsimplex_new optimsimplex_print optimsimplex_reflect optimsimplex_setall optimsimplex_setallfv optimsimplex_setallx optimsimplex_setfv optimsimplex_setn optimsimplex_setnbve optimsimplex_setve optimsimplex_setx optimsimplex_shrink optimsimplex_size optimsimplex_sort optimsimplex_tostring optimsimplex_xbar orth orthProj p_margin pack paging paramfplot2d pareto_filter parrot pascal pbig pca pcg pdiv pen2ea pencan pencost penlaur perctl perl perms permute pertrans pfactors pfss phasemag phc pie pinkcolormap pinv pixDist planck playsnd plot plot3d2 plot3d3 plotPoints plotframe plotout plotprofile plzr pmodulo pol2des pol2str polar polarplot polfact polyfit powershell prbs_a prettyprint primes princomp printf profile proj projaff projsl projspec psmall pspect qmr qpsolve quart quaskro rafiter rainbowcolormap randpencil range rank read_csv readxls recompilefunction recons reglin regress remezb remove_param remove_profiling repfreq replace_Ix_by_Fx replot repmat reset_profiling resize_matrix returntoscilab rgb2name rhs2code ric_desc riccati rmdir rotate routh_t rowcomp rowcompr rowinout rowregul rowshuff rref sample samplef samwr savematfile savewave sca scaling scanf scf sci2exp sci2map sciGUI_init sci_sparse scicos scicos_demonstration scicos_getvalue scicos_simulate scicos_workspace_init scilab2scicos scisptdemo scitest sd2sci sda sdf sdiff sec secd sech secto3d see selection_ga_elitist selection_ga_random sensi setDefaultColor setPlotProperty setStringPosition setSurfProperty setTitleLabelProperty set_param setdiff seteventhandler sgrid show_margins show_pca showprofile signm sinc sincd sind sinh sinhm sinm sm2des sm2ss smga smooth solve sound soundsec sp2adj spaninter spanplus spantwo specfact speye sprand springcolormap sprintf spzeros sqroot sqrtm square squarewave squeeze srfaur srkf ss2des ss2ss ss2tf sscanf sskf ssprint ssrand st_deviation st_i_generic st_ility stabil stairs3d statgain stdev stdevf steadycos strRot13 strange strcmpi strtrim struct sub2ind subplot summercolormap surf sva svplot sylm sylv sysconv sysdiag sysfact syslin syssize system systmat tabul tand tanh tanhm tanm tbx_build_cleaner tbx_build_gateway tbx_build_gateway_clean tbx_build_gateway_loader tbx_build_help tbx_build_help_loader tbx_build_loader tbx_build_macros tbx_build_src tbx_builder tbx_builder_gateway tbx_builder_gateway_lang tbx_builder_help tbx_builder_help_lang tbx_builder_macros tbx_builder_src tbx_builder_src_lang temp_law_csa temp_law_default temp_law_fsa temp_law_huang temp_law_vfsa test_clean test_on_columns test_run testexamples texout tf2des tf2ss thrownan tic time_id title titlepage toc toeplitz tohtml tokenpos toolboxes trace trans translatepaths tree2code trfmod trianfml trimmean trisolve trzeros twinkle typeof uiConcatTree uiCreateNode uiCreateTree uiDeleteNode uiDumpTree uiEqualsTree uiFindNode uiGetChildrenNode uiGetNodePosition uiGetParentNode uiInsertNode ui_observer union unique unit_test_run unix_g unix_s unix_w unix_x unobs unpack variance variancef varspace vec2list vectorfind ver warnobsolete wavread wavwrite wcenter weekday wfir whereami whitecolormap who_user wiener wigner winclose window winlist wintercolormap with_atlas with_javasci with_macros_source with_modelica_compiler with_pvm with_texmacs with_tk write_csv xGetMouse x_choices x_matrix xbasr xclear xcosBlockEval xcosBlockInterface xcosClearBlockWarning xcosCodeGeneration xcosConfigureModelica xcosPal xcosPalAdd xcosPalAddBlock xcosPalExport xcosShowBlockWarning xcos_close xcos_compile xcos_open xcos_run xcos_simulate xcos_workspace_init xend xinfo xinit xlabel xload xmlfiletohtml xmltochm xmltoformat xmltohtml xmltojar xmltopdf xmltops xmltoweb xnumb xrpoly xs2emf xs2fig xsave xselect xsetm xstringl ylabel yulewalk zeropen zgrid zlabel zpbutt zpch1 zpch2 zpell'; - var builtin = 'Calendar ClipBoard CloseVideoFile ConvertColorSpace CreatePixelIndexList DistanceTransform GetVideoInfo MaskFilter MatchTemplate Matplot Matplot1 MedianFilter MorphologicalFilter OpenVideoFile PlaySound ReadImageFile ReadImageFromVideo SearchBlobs SeparableFilter TCL_DeleteInterp TCL_DoOneEvent TCL_EvalFile TCL_EvalStr TCL_ExistArray TCL_ExistInterp TCL_ExistVar TCL_GetVar TCL_GetVersion TCL_SetVar TCL_UnsetVar TCL_UpVar VarianceFilter Watershed WriteImageFile _ about abs acos addcb addf addhistory addinter amell and argn arl2_ius ascii asin atan backslash balanc banner basename bdiag beep besselh besseli besselj besselk bessely beta bezout bfinit blkfc1i blkslvi bool2s browsevar bsplin3val buildDoc buildDocv2 buildouttb bvode c_link calerf call callblk captions cdfbet cdfbin cdfchi cdfchn cdff cdffnc cdfgam cdfnbn cdfnor cdfpoi cdft ceil champ champ1 chartooem chdir chol clean clear_pixmap clearfun closeEditor closeXcos code2str coeff comp completion conj consolebox contour2di contr convstr copy copyfile corr cos coserror createGUID createdir cshep2d ctree2 ctree3 ctree4 cumprod cumsum curblock curblockc dasrt dassl data2sig debug deff definedfields degree delbpt delete deletefile delip delmenu det dgettext dhinf diag diary diffobjs disp dispbpt displayhistory disposefftwlibrary dlgamma dnaupd dneupd dos double draw drawaxis drawlater drawnow dsaupd dsearch dseupd duplicate editor editvar emptystr end_scicosim ereduc errcatch errclear error eval_cshep2d exec execstr exists exp expm exportUI export_to_hdf5 eye fadj2sp fec feval fftw fftw_flags fftw_forget_wisdom fftwlibraryisloaded file fileext fileinfo fileparts filesep find findBD findfileassociation findfiles floor format fort fprintfMat freq frexp fromc fromjava fscanfMat fsolve fstair full fullpath funcprot funptr gamma gammaln geom3d get get_absolute_file_path get_fftw_wisdom getblocklabel getcallbackobject getdate getdebuginfo getdefaultlanguage getdrives getdynlibext getenv getfield gethistory gethistoryfile getinstalledlookandfeels getio getlanguage getlongpathname getlookandfeel getmd5 getmemory getmodules getos getpid getrelativefilename getscicosvars getscilabmode getshortpathname getsystemmetrics gettext getvariablesonstack getversion glist glue grand grayplot grep gsort gstacksize havewindow helpbrowser hess hinf historymanager historysize host iconvert ieee ilib_verbose imag impl import_from_hdf5 imult inpnvi int int16 int2d int32 int3d int8 interp interp2d interp3d intg intppty inttype inv is_handle_valid isalphanum isascii isdef isdigit isdir isequal isequalbitwise iserror isfile isglobal isletter isreal istssession iswaitingforinput javaclasspath javalibrarypath kron lasterror ldiv ldivf legendre length lib librarieslist libraryinfo linear_interpn lines link linmeq list load loadScicos loadfftwlibrary loadhistory log log1p lsq lsq_splin lsqrsolve lsslist lstcat lstsize ltitr lu ludel lufact luget lusolve macr2lst macr2tree matfile_close matfile_listvar matfile_open matfile_varreadnext matfile_varwrite matrix max maxfiles mcisendstring mclearerr mclose meof merror messagebox mfprintf mfscanf mget mgeti mgetl mgetstr min mlist mode model2blk mopen move movefile mprintf mput mputl mputstr mscanf mseek msprintf msscanf mtell mtlb_mode mtlb_sparse mucomp mulf nearfloat newaxes newest newfun nnz notify number_properties ode odedc oemtochar ones opentk optim or ordmmd parallel_concurrency parallel_run param3d param3d1 part pathconvert pathsep permutobj phase_simulation plot2d plot2d1 plot2d2 plot2d3 plot2d4 plot3d plot3d1 pointer_xproperty poly ppol pppdiv predef print printfigure printsetupbox prod progressionbar prompt qld qp_solve qr raise_window rand rankqr rat rcond rdivf read read4b readb readgateway readmps real realtime realtimeinit regexp relocate_handle remez removedir removelinehistory res_with_prec resethistory residu ricc ricc_old rlist roots rotate_axes round rpem rtitr rubberbox save saveafterncommands saveconsecutivecommands savehistory schur sci_haltscicos sci_tree2 sci_tree3 sci_tree4 sciargs scicos_debug scicos_debug_count scicos_time scicosim scinotes sctree semidef set set_blockerror set_fftw_wisdom set_xproperty setbpt setdefaultlanguage setenv setfield sethistoryfile setlanguage setlookandfeel setmenu sfact sfinit show_pixmap show_window showalluimenushandles sident sig2data sign simp simp_mode sin size slash sleep sorder sparse spchol spcompack spec spget splin splin2d splin3d spones sqrt stacksize str2code strcat strchr strcmp strcspn strindex string stringbox stripblanks strncpy strrchr strrev strsplit strspn strstr strsubst strtod strtok subf sum svd swap_handles symfcti syredi system_getproperty system_setproperty ta2lpd tan taucs_chdel taucs_chfact taucs_chget taucs_chinfo taucs_chsolve testmatrix timer tlist tohome tokens toolbar toprint tr_zer tril triu type typename uiDisplayTree uicontextmenu uicontrol uigetcolor uigetdir uigetfile uigetfont uimenu uint16 uint32 uint8 uipopup uiputfile uiwait ulink umf_ludel umf_lufact umf_luget umf_luinfo umf_lusolve umfpack unglue unix unsetmenu unzoom usecanvas user var2vec varn vec2var waitbar warnBlockByUID warning where whereis win64 winopen winqueryreg winsid with_embedded_jre with_module writb write write4b x_choose x_choose_modeless x_dialog x_mdialog xarc xarcs xarrows xchange xchoicesi xclick xcos xcosConfigureXmlFile xcosDiagramClose xcosDiagramOpen xcosDiagramToHDF5 xcosPalCategoryAdd xcosPalDelete xcosPalDisable xcosPalEnable xcosPalGenerateIcon xcosPalLoad xcosPalMove xdel xfarc xfarcs xfpoly xfpolys xfrect xget xgetech xgetmouse xgraduate xgrid xlfont xls_open xls_read xname xpause xpoly xpolys xrect xrects xs2bmp xs2eps xs2gif xs2jpg xs2pdf xs2png xs2ppm xs2ps xs2svg xsegs xset xsetech xstring xstringb xtitle zeros znaupd zneupd zoom_rect'; - var keywords = 'abort apropos break case catch clc clear continue do else end endfunction exit for function global halt help if pause pwd quit resume return then what who whos'; - var variables = 'atomsguilib atomslib cacsdlib compatibility_functilib corelib data_structureslib datatipslib demo_toolslib development_toolslib differential_equationlib dynamic_linklib elementary_functionslib fft fileiolib functionslib genetic_algorithmslib graphic_exportlib graphicslib guilib helptoolslib home integerlib interpolationlib iolib ipdlib jvmlib linear_algebralib m2scilib maple2scilablib matiolib modules_managerlib neldermeadlib optimbaselib optimizationlib optimsimplexlib output_streamlib overloadinglib parameterslib polynomialslib scicos_autolib scicos_utilslib scinoteslib signal_processinglib simulated_annealinglib soundlib sparselib special_functionslib spreadsheetlib statisticslib stringlib tclscilib texmacslib timelib uitreelib umfpacklib windows_toolslib xcoslib'; - this.regexList = [ - { regex: /\/\/.*$/gm, css: 'comments' }, // one line comments - { regex: dp.sh.RegexLib.DoubleQuotedString, css: 'string' }, // strings - { regex: new RegExp(this.GetKeywords(macros), 'gm'), css: 'functions bold' }, - { regex: new RegExp(this.GetKeywords(builtin), 'gm'), css: 'color3' }, - { regex: new RegExp(this.GetKeywords(keywords), 'gm'), css: 'keyword' }, - { regex: new RegExp(this.GetKeywords(variables), 'gm'), css: 'variable' } - ]; -}; -dp.sh.Brushes.Scilab.prototype = new dp.sh.Highlighter(); -dp.sh.Brushes.Scilab.Aliases = ['scilab']; diff --git a/vendor/assets/javascripts/syntaxhighlighter_lib/shBrushSql.js b/vendor/assets/javascripts/syntaxhighlighter_lib/shBrushSql.js deleted file mode 100644 index d171260f46..0000000000 --- a/vendor/assets/javascripts/syntaxhighlighter_lib/shBrushSql.js +++ /dev/null @@ -1,42 +0,0 @@ -dp.sh.Brushes.Sql = function() -{ - var funcs = 'abs avg case cast coalesce convert count current_timestamp ' + - 'current_user day isnull left lower month nullif replace right ' + - 'session_user space substring sum system_user upper user year'; - - var keywords = 'absolute action add after alter as asc at authorization begin bigint ' + - 'binary bit by cascade char character check checkpoint close collate ' + - 'column commit committed connect connection constraint contains continue ' + - 'create cube current current_date current_time cursor database date ' + - 'deallocate dec decimal declare default delete desc distinct double drop ' + - 'dynamic else end end-exec escape except exec execute false fetch first ' + - 'float for force foreign forward free from full function global goto grant ' + - 'group grouping having hour ignore index inner insensitive insert instead ' + - 'int integer intersect into is isolation key last level load local max min ' + - 'minute modify move name national nchar next no numeric of off on only ' + - 'open option order out output partial password precision prepare primary ' + - 'prior privileges procedure public read real references relative repeatable ' + - 'restrict return returns revoke rollback rollup rows rule schema scroll ' + - 'second section select sequence serializable set size smallint static ' + - 'statistics table temp temporary then time timestamp to top transaction ' + - 'translation trigger true truncate uncommitted union unique update values ' + - 'varchar varying view when where with work'; - - var operators = 'all and any between cross in join like not null or outer some'; - - this.regexList = [ - { regex: new RegExp('--(.*)$', 'gm'), css: 'comment' }, // one line and multiline comments - { regex: dp.sh.RegexLib.DoubleQuotedString, css: 'string' }, // double quoted strings - { regex: dp.sh.RegexLib.SingleQuotedString, css: 'string' }, // single quoted strings - { regex: new RegExp(this.GetKeywords(funcs), 'gmi'), css: 'func' }, // functions - { regex: new RegExp(this.GetKeywords(operators), 'gmi'), css: 'op' }, // operators and such - { regex: new RegExp(this.GetKeywords(keywords), 'gmi'), css: 'keyword' } // keyword - ]; - - this.CssClass = 'dp-sql'; - this.Style = '.dp-sql .func { color: #ff1493; }' + - '.dp-sql .op { color: #808080; }'; -} - -dp.sh.Brushes.Sql.prototype = new dp.sh.Highlighter(); -dp.sh.Brushes.Sql.Aliases = ['sql']; diff --git a/vendor/assets/javascripts/syntaxhighlighter_lib/shBrushUnknown.js b/vendor/assets/javascripts/syntaxhighlighter_lib/shBrushUnknown.js deleted file mode 100644 index 3576ada2d8..0000000000 --- a/vendor/assets/javascripts/syntaxhighlighter_lib/shBrushUnknown.js +++ /dev/null @@ -1,16 +0,0 @@ -/* Custom SyntaxHighlighter 'Brush' to let SyntaxHighlighter run on files that -it doesn't necessarily recognize. Nothing is highlighted, but the text is still -compiled into an ordered list, etc. */ - -dp.sh.Brushes.Unknown = function() -{ - var keywords = '' - var builtins = '' - - this.regexList = []; - this.CssClass = 'dp-unknown'; - this.Style = ''; -} - -dp.sh.Brushes.Unknown.prototype = new dp.sh.Highlighter(); -dp.sh.Brushes.Unknown.Aliases = ['unknown']; diff --git a/vendor/assets/javascripts/syntaxhighlighter_lib/shBrushVb.js b/vendor/assets/javascripts/syntaxhighlighter_lib/shBrushVb.js deleted file mode 100644 index a9c376fade..0000000000 --- a/vendor/assets/javascripts/syntaxhighlighter_lib/shBrushVb.js +++ /dev/null @@ -1,29 +0,0 @@ -dp.sh.Brushes.Vb = function() -{ - var keywords = 'AddHandler AddressOf AndAlso Alias And Ansi As Assembly Auto ' + - 'Boolean ByRef Byte ByVal Call Case Catch CBool CByte CChar CDate ' + - 'CDec CDbl Char CInt Class CLng CObj Const CShort CSng CStr CType ' + - 'Date Decimal Declare Default Delegate Dim DirectCast Do Double Each ' + - 'Else ElseIf End Enum Erase Error Event Exit False Finally For Friend ' + - 'Function Get GetType GoSub GoTo Handles If Implements Imports In ' + - 'Inherits Integer Interface Is Let Lib Like Long Loop Me Mod Module ' + - 'MustInherit MustOverride MyBase MyClass Namespace New Next Not Nothing ' + - 'NotInheritable NotOverridable Object On Option Optional Or OrElse ' + - 'Overloads Overridable Overrides ParamArray Preserve Private Property ' + - 'Protected Public RaiseEvent ReadOnly ReDim REM RemoveHandler Resume ' + - 'Return Select Set Shadows Shared Short Single Static Step Stop String ' + - 'Structure Sub SyncLock Then Throw To True Try TypeOf Unicode Until ' + - 'Variant When While With WithEvents WriteOnly Xor'; - - this.regexList = [ - { regex: new RegExp('\'.*$', 'gm'), css: 'comment' }, // one line comments - { regex: dp.sh.RegexLib.DoubleQuotedString, css: 'string' }, // strings - { regex: new RegExp('^\\s*#.*', 'gm'), css: 'preprocessor' }, // preprocessor tags like #region and #endregion - { regex: new RegExp(this.GetKeywords(keywords), 'gm'), css: 'keyword' } // c# keyword - ]; - - this.CssClass = 'dp-vb'; -} - -dp.sh.Brushes.Vb.prototype = new dp.sh.Highlighter(); -dp.sh.Brushes.Vb.Aliases = ['vb', 'vb.net']; diff --git a/vendor/assets/javascripts/syntaxhighlighter_lib/shBrushXml.js b/vendor/assets/javascripts/syntaxhighlighter_lib/shBrushXml.js deleted file mode 100644 index 0cfda7f230..0000000000 --- a/vendor/assets/javascripts/syntaxhighlighter_lib/shBrushXml.js +++ /dev/null @@ -1,70 +0,0 @@ -dp.sh.Brushes.Xml = function() -{ - this.CssClass = 'dp-xml'; - this.Style = '.dp-xml .cdata { color: #ff1493; }' + - '.dp-xml .tag, .dp-xml .tag-name { color: #069; font-weight: bold; }' + - '.dp-xml .attribute { color: red; }' + - '.dp-xml .attribute-value { color: blue; }'; -} - -dp.sh.Brushes.Xml.prototype = new dp.sh.Highlighter(); -dp.sh.Brushes.Xml.Aliases = ['xml', 'xhtml', 'xslt', 'html', 'xhtml']; - -dp.sh.Brushes.Xml.prototype.ProcessRegexList = function() -{ - function push(array, value) - { - array[array.length] = value; - } - - /* If only there was a way to get index of a group within a match, the whole XML - could be matched with the expression looking something like that: - - () - | () - | (<)*(\w+)*\s*(\w+)\s*=\s*(".*?"|'.*?'|\w+)(/*>)* - | () - */ - var index = 0; - var match = null; - var regex = null; - - // Match CDATA in the following format - // (\<|<)\!\[[\w\s]*?\[(.|\s)*?\]\](\>|>) - this.GetMatches(new RegExp('(\<|<)\\!\\[[\\w\\s]*?\\[(.|\\s)*?\\]\\](\>|>)', 'gm'), 'cdata'); - - // Match comments - // (\<|<)!--\s*.*?\s*--(\>|>) - this.GetMatches(new RegExp('(\<|<)!--\\s*.*?\\s*--(\>|>)', 'gm'), 'comments'); - - // Match attributes and their values - // (:|\w+)\s*=\s*(".*?"|\'.*?\'|\w+)* - regex = new RegExp('([:\\w-\.]+)\\s*=\\s*(".*?"|\'.*?\'|\\w+)*|(\\w+)', 'gm'); // Thanks to Tomi Blinnikka of Yahoo! for fixing namespaces in attributes - while((match = regex.exec(this.code)) != null) - { - if(match[1] == null) - { - continue; - } - - push(this.matches, new dp.sh.Match(match[1], match.index, 'attribute')); - - // if xml is invalid and attribute has no property value, ignore it - if(match[2] != undefined) - { - push(this.matches, new dp.sh.Match(match[2], match.index + match[0].indexOf(match[2]), 'attribute-value')); - } - } - - // Match opening and closing tag brackets - // (\<|<)/*\?*(?!\!)|/*\?*(\>|>) - this.GetMatches(new RegExp('(\<|<)/*\\?*(?!\\!)|/*\\?*(\>|>)', 'gm'), 'tag'); - - // Match tag names - // (\<|<)/*\?*\s*(\w+) - regex = new RegExp('(?:\<|<)/*\\?*\\s*([:\\w-\.]+)', 'gm'); - while((match = regex.exec(this.code)) != null) - { - push(this.matches, new dp.sh.Match(match[1], match.index + match[0].indexOf(match[1]), 'tag-name')); - } -} diff --git a/vendor/assets/javascripts/syntaxhighlighter_lib/shCore.js b/vendor/assets/javascripts/syntaxhighlighter_lib/shCore.js deleted file mode 100644 index 93682b2451..0000000000 --- a/vendor/assets/javascripts/syntaxhighlighter_lib/shCore.js +++ /dev/null @@ -1,648 +0,0 @@ -/** - * Code Syntax Highlighter. - * Version 1.5.1 - * Copyright (C) 2004-2007 Alex Gorbatchev. - * http://www.dreamprojections.com/syntaxhighlighter/ - * - * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General - * Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. - * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more - * details. - * - * You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -// -// create namespaces -// -var dp = { - sh : - { - Toolbar : {}, - Utils : {}, - RegexLib: {}, - Brushes : {}, - Strings : { - AboutDialog : 'About...

dp.SyntaxHighlighter

Version: {V}

http://www.dreamprojections.com/syntaxhighlighter

©2004-2007 Alex Gorbatchev.
' - }, - ClipboardSwf : null, - Version : '1.5.1' - } -}; - -// make an alias -dp.SyntaxHighlighter = dp.sh; - -// -// Toolbar functions -// - -dp.sh.Toolbar.Commands = { - - // opens a new windows and puts the original unformatted source code inside. - ViewSource: { - label: 'view plain', - func: function(sender, highlighter) { - var code = dp.sh.Utils.FixForBlogger(highlighter.originalCode).replace(/' + code + ''); - wnd.document.close(); - } - }, - ExpandSource: { - label: '+ expand source', - check: function(highlighter) { return highlighter.collapse; }, - func: function(sender, highlighter) { - sender.parentNode.removeChild(sender); - highlighter.div.className = highlighter.div.className.replace('collapsed', ''); - } - }, - - // Copies the original source code in to the clipboard. Uses either IE only method or Flash object if ClipboardSwf is set - CopyToClipboard: { - label: 'copy to clipboard', - check: function() { return window.clipboardData != null || dp.sh.ClipboardSwf != null; }, - func: function(sender, highlighter) { - var code = dp.sh.Utils.FixForBlogger(highlighter.originalCode) - .replace(/</g,'<') - .replace(/>/g,'>') - .replace(/&/g,'&') - ; - - if(window.clipboardData) { - window.clipboardData.setData('text', code); - } - else if(dp.sh.ClipboardSwf != null) { - var flashcopier = highlighter.flashCopier; - - if(flashcopier == null) - { - flashcopier = document.createElement('div'); - highlighter.flashCopier = flashcopier; - highlighter.div.appendChild(flashcopier); - } - - flashcopier.innerHTML = ''; - } - - alert('The code is in your clipboard now'); - } - }, - - // creates an invisible iframe, puts the original source code inside and prints it - PrintSource: { - label: 'print', - func: function(sender, highlighter) { - var iframe = document.createElement('IFRAME'); - var doc = null; - - // this hides the iframe - iframe.style.cssText = 'position:absolute;width:0px;height:0px;left:-500px;top:-500px;'; - - document.body.appendChild(iframe); - doc = iframe.contentWindow.document; - - dp.sh.Utils.CopyStyles(doc, window.document); - doc.write('
' + highlighter.div.innerHTML + '
'); - doc.close(); - - iframe.contentWindow.focus(); - iframe.contentWindow.print(); - - alert('Printing...'); - - document.body.removeChild(iframe); - } - }, - - About: { - label: '?', - func: function(highlighter) { - var wnd = window.open('', '_blank', 'dialog,width=300,height=150,scrollbars=0'); - var doc = wnd.document; - - dp.sh.Utils.CopyStyles(doc, window.document); - - doc.write(dp.sh.Strings.AboutDialog.replace('{V}', dp.sh.Version)); - doc.close(); - wnd.focus(); - } - } -}; - -// creates a
with all toolbar links -dp.sh.Toolbar.Create = function(highlighter) { - var div = document.createElement('DIV'); - - div.className = 'tools'; - - for(var name in dp.sh.Toolbar.Commands) - { - var cmd = dp.sh.Toolbar.Commands[name]; - - if(cmd.check != null && !cmd.check(highlighter)) - continue; - - div.innerHTML += '' + cmd.label + ''; - } - - return div; -} - -// executes toolbar command by name -dp.sh.Toolbar.Command = function(name, sender) { - var n = sender; - - while(n != null && n.className.indexOf('dp-highlighter') == -1) - n = n.parentNode; - - if(n != null) - dp.sh.Toolbar.Commands[name].func(sender, n.highlighter); -} - -// copies all from 'target' window to 'dest' -dp.sh.Utils.CopyStyles = function(destDoc, sourceDoc) { - var links = sourceDoc.getElementsByTagName('link'); - - for(var i = 0; i < links.length; i++) - if(links[i].rel.toLowerCase() == 'stylesheet') - destDoc.write(''); -} - -dp.sh.Utils.FixForBlogger = function(str) { - return (dp.sh.isBloggerMode == true) ? str.replace(/|<br\s*\/?>/gi, '\n') : str; -} - -// -// Common reusable regular expressions -// -dp.sh.RegexLib = { - MultiLineCComments : new RegExp('/\\*[\\s\\S]*?\\*/', 'gm'), - SingleLineCComments : new RegExp('//.*$', 'gm'), - SingleLinePerlComments : new RegExp('#.*$', 'gm'), - DoubleQuotedString : new RegExp('"(?:\\.|(\\\\\\")|[^\\""\\n])*"','g'), - SingleQuotedString : new RegExp("'(?:\\.|(\\\\\\')|[^\\''\\n])*'", 'g') -}; - -// -// Match object -// -dp.sh.Match = function(value, index, css) { - this.value = value; - this.index = index; - this.length = value.length; - this.css = css; -} - -// -// Highlighter object -// -dp.sh.Highlighter = function() { - this.noGutter = false; - this.addControls = true; - this.collapse = false; - this.tabsToSpaces = true; - this.wrapColumn = 80; - this.showColumns = true; -} - -// static callback for the match sorting -dp.sh.Highlighter.SortCallback = function(m1, m2) { - // sort matches by index first - if(m1.index < m2.index) - return -1; - else if(m1.index > m2.index) - return 1; - else { - // if index is the same, sort by length - if(m1.length < m2.length) - return -1; - else if(m1.length > m2.length) - return 1; - } - return 0; -} - -dp.sh.Highlighter.prototype.CreateElement = function(name) { - var result = document.createElement(name); - result.highlighter = this; - return result; -} - -// gets a list of all matches for a given regular expression -dp.sh.Highlighter.prototype.GetMatches = function(regex, css) { - var index = 0; - var match = null; - - while((match = regex.exec(this.code)) != null) - this.matches[this.matches.length] = new dp.sh.Match(match[0], match.index, css); -} - -dp.sh.Highlighter.prototype.AddBit = function(str, css) { - if(str == null || str.length == 0) - return; - - var span = this.CreateElement('SPAN'); - -// str = str.replace(/&/g, '&'); - str = str.replace(/ /g, ' '); - str = str.replace(//g, '>'); - str = str.replace(/\n/gm, '
'); - - // when adding a piece of code, check to see if it has line breaks in it - // and if it does, wrap individual line breaks with span tags - if(css != null) { - if((/br/gi).test(str)) { - var lines = str.split('
'); - - for(var i = 0; i < lines.length; i++) { - span = this.CreateElement('SPAN'); - span.className = css; - span.innerHTML = lines[i]; - - this.div.appendChild(span); - - // don't add a
for the last line - if(i + 1 < lines.length) - this.div.appendChild(this.CreateElement('BR')); - } - } else { - span.className = css; - span.innerHTML = str; - this.div.appendChild(span); - } - } else { - span.innerHTML = str; - this.div.appendChild(span); - } -} - -// checks if one match is inside any other match -dp.sh.Highlighter.prototype.IsInside = function(match) { - if(match == null || match.length == 0) - return false; - - for(var i = 0; i < this.matches.length; i++) { - var c = this.matches[i]; - - if(c == null) - continue; - - if((match.index > c.index) && (match.index < c.index + c.length)) - return true; - } - - return false; -} - -dp.sh.Highlighter.prototype.ProcessRegexList = function() { - for(var i = 0; i < this.regexList.length; i++) - this.GetMatches(this.regexList[i].regex, this.regexList[i].css); -} - -dp.sh.Highlighter.prototype.ProcessSmartTabs = function(code) { - var lines = code.split('\n'); - var result = ''; - var tabSize = 4; - var tab = '\t'; - - // This function inserts specified amount of spaces in the string - // where a tab is while removing that given tab. - function InsertSpaces(line, pos, count) { - var left = line.substr(0, pos); - var right = line.substr(pos + 1, line.length); // pos + 1 will get rid of the tab - var spaces = ''; - - for(var i = 0; i < count; i++) - spaces += ' '; - - return left + spaces + right; - } - - // This function process one line for 'smart tabs' - function ProcessLine(line, tabSize) { - if(line.indexOf(tab) == -1) - return line; - - var pos = 0; - - while((pos = line.indexOf(tab)) != -1) { - // This is pretty much all there is to the 'smart tabs' logic. - // Based on the position within the line and size of a tab, - // calculate the amount of spaces we need to insert. - var spaces = tabSize - pos % tabSize; - - line = InsertSpaces(line, pos, spaces); - } - - return line; - } - - // Go through all the lines and do the 'smart tabs' magic. - for(var i = 0; i < lines.length; i++) - result += ProcessLine(lines[i], tabSize) + '\n'; - - return result; -} - -dp.sh.Highlighter.prototype.SwitchToList = function() { - // thanks to Lachlan Donald from SitePoint.com for this
tag fix. - var html = this.div.innerHTML.replace(/<(br)\/?>/gi, '\n'); - var lines = html.split('\n'); - - if(this.addControls == true) - this.bar.appendChild(dp.sh.Toolbar.Create(this)); - - // add columns ruler - if(this.showColumns) { - var div = this.CreateElement('div'); - var columns = this.CreateElement('div'); - var showEvery = 10; - var i = 1; - - while(i <= 150) { - if(i % showEvery == 0) { - div.innerHTML += i; - i += (i + '').length; - } else { - div.innerHTML += '·'; - i++; - } - } - - columns.className = 'columns'; - columns.appendChild(div); - this.bar.appendChild(columns); - } - - for(var i = 0, lineIndex = this.firstLine; i < lines.length - 1; i++, lineIndex++) { - var li = this.CreateElement('LI'); - var span = this.CreateElement('SPAN'); - - if(lines[i] === "") { - span.innerHTML = ' '; - } - else { - span.innerHTML = lines[i]; - } - - li.appendChild(span); - this.ol.appendChild(li); - } - - this.div.innerHTML = ''; -} - -dp.sh.Highlighter.prototype.Highlight = function(code) { - function Trim(str) { - return str.replace(/^\s*(.*?)[\s\n]*$/g, '$1'); - } - - function Chop(str) { - return str.replace(/\n*$/, '').replace(/^\n*/, ''); - } - - function Unindent(str) { - var lines = dp.sh.Utils.FixForBlogger(str).split('\n'); - var indents = new Array(); - var regex = new RegExp('^\\s*', 'g'); - var min = 1000; - - // go through every line and check for common number of indents - for(var i = 0; i < lines.length && min > 0; i++) { - if(Trim(lines[i]).length == 0) - continue; - - var matches = regex.exec(lines[i]); - - if(matches != null && matches.length > 0) - min = Math.min(matches[0].length, min); - } - - // trim minimum common number of white space from the begining of every line - if(min > 0) - for(var i = 0; i < lines.length; i++) - lines[i] = lines[i].substr(min); - - return lines.join('\n'); - } - - // This function returns a portions of the string from pos1 to pos2 inclusive - function Copy(string, pos1, pos2) { - return string.substr(pos1, pos2 - pos1); - } - - var pos = 0; - - if(code == null) - code = ''; - - this.originalCode = code; - this.code = Chop(Unindent(code)); - this.div = this.CreateElement('DIV'); - this.bar = this.CreateElement('DIV'); - this.ol = this.CreateElement('OL'); - this.matches = new Array(); - - this.div.className = 'dp-highlighter'; - this.div.highlighter = this; - - this.bar.className = 'bar'; - - // set the first line - this.ol.start = this.firstLine; - - if(this.CssClass != null) - this.ol.className = this.CssClass; - - if(this.collapse) - this.div.className += ' collapsed'; - - if(this.noGutter) - this.div.className += ' nogutter'; - - // replace tabs with spaces - if(this.tabsToSpaces == true) - this.code = this.ProcessSmartTabs(this.code); - - this.ProcessRegexList(); - - // if no matches found, add entire code as plain text - if(this.matches.length == 0) { - this.AddBit(this.code, null); - this.SwitchToList(); - this.div.appendChild(this.bar); - this.div.appendChild(this.ol); - return; - } - - // sort the matches - this.matches = this.matches.sort(dp.sh.Highlighter.SortCallback); - - // The following loop checks to see if any of the matches are inside - // of other matches. This process would get rid of highligted strings - // inside comments, keywords inside strings and so on. - for(var i = 0; i < this.matches.length; i++) - if(this.IsInside(this.matches[i])) - this.matches[i] = null; - - // Finally, go through the final list of matches and pull the all - // together adding everything in between that isn't a match. - for(var i = 0; i < this.matches.length; i++) { - var match = this.matches[i]; - - if(match == null || match.length == 0) - continue; - - this.AddBit(Copy(this.code, pos, match.index), null); - this.AddBit(match.value, match.css); - - pos = match.index + match.length; - } - - this.AddBit(this.code.substr(pos), null); - - this.SwitchToList(); - this.div.appendChild(this.bar); - this.div.appendChild(this.ol); -} - -dp.sh.Highlighter.prototype.GetKeywords = function(str) { - return '\\b' + str.replace(/ /g, '\\b|\\b') + '\\b'; -} - -dp.sh.BloggerMode = function() { - dp.sh.isBloggerMode = true; -} - -// highlightes all elements identified by name and gets source code from specified property -dp.sh.HighlightAll = function(name, showGutter /* optional */, showControls /* optional */, collapseAll /* optional */, firstLine /* optional */, showColumns /* optional */) { - function FindValue() { - var a = arguments; - - for(var i = 0; i < a.length; i++) { - if(a[i] == null) - continue; - - if(typeof(a[i]) == 'string' && a[i] != '') - return a[i] + ''; - - if(typeof(a[i]) == 'object' && a[i].value != '') - return a[i].value + ''; - } - - return null; - } - - function IsOptionSet(value, list) { - for(var i = 0; i < list.length; i++) - if(list[i] == value) - return true; - - return false; - } - - function GetOptionValue(name, list, defaultValue) { - var regex = new RegExp('^' + name + '\\[(\\w+)\\]$', 'gi'); - var matches = null; - - for(var i = 0; i < list.length; i++) - if((matches = regex.exec(list[i])) != null) - return matches[1]; - - return defaultValue; - } - - function FindTagsByName(list, name, tagName) { - var tags = document.getElementsByTagName(tagName); - - for(var i = 0; i < tags.length; i++) - if(tags[i].getAttribute('name') == name) - list.push(tags[i]); - } - - var elements = []; - var highlighter = null; - var registered = {}; - var propertyName = 'innerHTML'; - - // for some reason IE doesn't find
 by name, however it does see them just fine by tag name...
-  FindTagsByName(elements, name, 'pre');
-  FindTagsByName(elements, name, 'textarea');
-
-  if(elements.length == 0)
-    return;
-
-  // register all brushes
-  for(var brush in dp.sh.Brushes) {
-    var aliases = dp.sh.Brushes[brush].Aliases;
-
-    if(aliases == null)
-      continue;
-
-    for(var i = 0; i < aliases.length; i++)
-      registered[aliases[i]] = brush;
-  }
-
-  for(var i = 0; i < elements.length; i++) {
-    var element = elements[i];
-    var options = FindValue(
-          element.attributes['class'], element.className,
-          element.attributes['language'], element.language
-        );
-    var language = '';
-
-    if(options == null)
-      continue;
-
-    options = options.split(':');
-
-    language = options[0].toLowerCase();
-
-    if(registered[language] == null)
-      continue;
-
-    // instantiate a brush
-    highlighter = new dp.sh.Brushes[registered[language]]();
-
-    // hide the original element
-    element.style.display = 'none';
-
-    highlighter.noGutter = (showGutter == null) ? IsOptionSet('nogutter', options) : !showGutter;
-    highlighter.addControls = (showControls == null) ? !IsOptionSet('nocontrols', options) : showControls;
-    highlighter.collapse = (collapseAll == null) ? IsOptionSet('collapse', options) : collapseAll;
-    highlighter.showColumns = (showColumns == null) ? IsOptionSet('showcolumns', options) : showColumns;
-
-    // write out custom brush style
-    var headNode = document.getElementsByTagName('head')[0];
-    if(highlighter.Style && headNode) {
-      var styleNode = document.createElement('style');
-      styleNode.setAttribute('type', 'text/css');
-
-      if(styleNode.styleSheet) { // for IE
-        styleNode.styleSheet.cssText = highlighter.Style;
-      }
-      else { // for everyone else
-        var textNode = document.createTextNode(highlighter.Style);
-        styleNode.appendChild(textNode);
-      }
-
-      headNode.appendChild(styleNode);
-    }
-
-    // first line idea comes from Andrew Collington, thanks!
-    highlighter.firstLine = (firstLine == null) ? parseInt(GetOptionValue('firstline', options, 1)) : firstLine;
-
-    highlighter.Highlight(element[propertyName]);
-
-    highlighter.source = element;
-
-    element.parentNode.insertBefore(highlighter.div, element);
-  }
-}
diff --git a/webpack.common.js b/webpack.common.js
index 8f112a60a8..a34c49c873 100644
--- a/webpack.common.js
+++ b/webpack.common.js
@@ -5,6 +5,8 @@ const MiniCssExtractPlugin = require("mini-css-extract-plugin");
 module.exports = {
   entry: {
     application_webpack: "./app/javascript/application_webpack.js",
+    dark_theme: "./app/javascript/dark_theme.js",
+    light_theme: "./app/javascript/light_theme.js",
     markus_notebook: "./app/javascript/markus_notebook.js",
     "pdf.worker": "pdfjs-dist/build/pdf.worker.mjs",
     result: "./app/javascript/result.js",