ela 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +5 -0
- data/.gitlab-ci.yml +23 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +139 -0
- data/Guardfile +25 -0
- data/LICENSE.txt +205 -0
- data/README.de.md +195 -0
- data/README.md +66 -0
- data/Rakefile +96 -0
- data/app/css/screen.styl +425 -0
- data/app/css/vendor/stackedit.styl +140 -0
- data/app/fonts/Roboto-Italic-webfont.eot +0 -0
- data/app/fonts/Roboto-Italic-webfont.svg +642 -0
- data/app/fonts/Roboto-Italic-webfont.ttf +0 -0
- data/app/fonts/Roboto-Italic-webfont.woff +0 -0
- data/app/fonts/Roboto-Light-webfont.eot +0 -0
- data/app/fonts/Roboto-Light-webfont.svg +641 -0
- data/app/fonts/Roboto-Light-webfont.ttf +0 -0
- data/app/fonts/Roboto-Light-webfont.woff +0 -0
- data/app/fonts/Roboto-LightItalic-webfont.eot +0 -0
- data/app/fonts/Roboto-LightItalic-webfont.svg +641 -0
- data/app/fonts/Roboto-LightItalic-webfont.ttf +0 -0
- data/app/fonts/Roboto-LightItalic-webfont.woff +0 -0
- data/app/fonts/Roboto-Medium-webfont.eot +0 -0
- data/app/fonts/Roboto-Medium-webfont.svg +593 -0
- data/app/fonts/Roboto-Medium-webfont.ttf +0 -0
- data/app/fonts/Roboto-Medium-webfont.woff +0 -0
- data/app/fonts/Roboto-MediumItalic-webfont.eot +0 -0
- data/app/fonts/Roboto-MediumItalic-webfont.svg +642 -0
- data/app/fonts/Roboto-MediumItalic-webfont.ttf +0 -0
- data/app/fonts/Roboto-MediumItalic-webfont.woff +0 -0
- data/app/fonts/Roboto-Regular-webfont.eot +0 -0
- data/app/fonts/Roboto-Regular-webfont.svg +621 -0
- data/app/fonts/Roboto-Regular-webfont.ttf +0 -0
- data/app/fonts/Roboto-Regular-webfont.woff +0 -0
- data/app/fonts/Roboto-Thin-webfont.eot +0 -0
- data/app/fonts/Roboto-Thin-webfont.svg +631 -0
- data/app/fonts/Roboto-Thin-webfont.ttf +0 -0
- data/app/fonts/Roboto-Thin-webfont.woff +0 -0
- data/app/fonts/Roboto-ThinItalic-webfont.eot +0 -0
- data/app/fonts/Roboto-ThinItalic-webfont.svg +631 -0
- data/app/fonts/Roboto-ThinItalic-webfont.ttf +0 -0
- data/app/fonts/Roboto-ThinItalic-webfont.woff +0 -0
- data/app/fonts/droid_sans_regular.typeface.svg +1 -0
- data/app/fonts/fontawesome-webfont.eot +0 -0
- data/app/fonts/fontawesome-webfont.svg +2671 -0
- data/app/fonts/fontawesome-webfont.ttf +0 -0
- data/app/fonts/fontawesome-webfont.woff +0 -0
- data/app/fonts/fontawesome-webfont.woff2 +0 -0
- data/app/js/lib/application.coffee +83 -0
- data/app/js/lib/bootstrap_data.coffee +70 -0
- data/app/js/lib/collections/00_limited_collection.coffee +85 -0
- data/app/js/lib/collections/curves.coffee +3 -0
- data/app/js/lib/collections/named_object_collection.coffee +7 -0
- data/app/js/lib/mathjaxConfig.coffee +241 -0
- data/app/js/lib/models/app.coffee +58 -0
- data/app/js/lib/models/base_app.coffee +62 -0
- data/app/js/lib/models/base_app_model.coffee +61 -0
- data/app/js/lib/models/base_calculator.coffee +212 -0
- data/app/js/lib/models/base_subapp_container.coffee +35 -0
- data/app/js/lib/models/curve.coffee +179 -0
- data/app/js/lib/router.coffee +26 -0
- data/app/js/lib/views/app.coffee +56 -0
- data/app/js/lib/views/base_app.coffee +274 -0
- data/app/js/lib/views/base_aside.coffee +9 -0
- data/app/js/lib/views/base_graph.coffee +477 -0
- data/app/js/lib/views/base_subapp_container.coffee +44 -0
- data/app/js/lib/views/canvas.coffee +73 -0
- data/app/js/lib/views/curve_graph.coffee +163 -0
- data/app/js/lib/views/curves_aside.coffee +21 -0
- data/app/js/lib/views/curves_list_item.coffee +8 -0
- data/app/js/lib/views/grouped_parameters_aside.coffee +14 -0
- data/app/js/lib/views/headup.coffee +15 -0
- data/app/js/lib/views/help.coffee +86 -0
- data/app/js/lib/views/interpolated_graph.coffee +281 -0
- data/app/js/lib/views/legend.coffee +138 -0
- data/app/js/lib/views/legend_handler.coffee +51 -0
- data/app/js/lib/views/overview.coffee +85 -0
- data/app/js/lib/views/overview_tile.coffee +18 -0
- data/app/js/lib/views/parameters_aside.coffee +12 -0
- data/app/js/lib/views/three_graph.coffee +92 -0
- data/app/js/vendor/Markdown.Converter.js +1519 -0
- data/app/js/vendor/Markdown.Extra.js +874 -0
- data/app/js/vendor/Markdown.Toc.coffee +79 -0
- data/app/js/vendor/backbone-1.3.3.min.js +2 -0
- data/app/js/vendor/backbone-validation-0.11.5.js +8 -0
- data/app/js/vendor/backbone.poised/form.coffee +156 -0
- data/app/js/vendor/backbone.poised/form/anchor.coffee +26 -0
- data/app/js/vendor/backbone.poised/form/base_control.coffee +42 -0
- data/app/js/vendor/backbone.poised/form/linked_control.coffee +79 -0
- data/app/js/vendor/backbone.poised/form/linked_number_control.coffee +27 -0
- data/app/js/vendor/backbone.poised/form/linked_range_control.coffee +53 -0
- data/app/js/vendor/backbone.poised/form/linked_select_control.coffee +18 -0
- data/app/js/vendor/backbone.poised/form/linked_string_control.coffee +27 -0
- data/app/js/vendor/backbone.poised/form/number_control.coffee +25 -0
- data/app/js/vendor/backbone.poised/form/range_control.coffee +48 -0
- data/app/js/vendor/backbone.poised/form/select_control.coffee +16 -0
- data/app/js/vendor/backbone.poised/form/selectbox.coffee +78 -0
- data/app/js/vendor/backbone.poised/form/slider.coffee +109 -0
- data/app/js/vendor/backbone.poised/form/string_control.coffee +23 -0
- data/app/js/vendor/backbone.poised/form/submit_control.coffee +39 -0
- data/app/js/vendor/backbone.poised/form/textarea.coffee +36 -0
- data/app/js/vendor/backbone.poised/form/textfield.coffee +86 -0
- data/app/js/vendor/backbone.poised/form/value.coffee +33 -0
- data/app/js/vendor/backbone.poised/form/value_control.coffee +15 -0
- data/app/js/vendor/backbone.poised/linked_form.coffee +43 -0
- data/app/js/vendor/backbone.poised/list.coffee +97 -0
- data/app/js/vendor/backbone.poised/list/add_button.coffee +16 -0
- data/app/js/vendor/backbone.poised/list/anchor.coffee +32 -0
- data/app/js/vendor/backbone.poised/list/item.coffee +68 -0
- data/app/js/vendor/backbone.poised/list/searchfield.coffee +26 -0
- data/app/js/vendor/backbone.poised/list/selectable_item.coffee +65 -0
- data/app/js/vendor/backbone.poised/patches.coffee +6 -0
- data/app/js/vendor/backbone.poised/string_mixin.coffee +23 -0
- data/app/js/vendor/backbone.poised/underscore_ext.coffee +2 -0
- data/app/js/vendor/backbone.poised/view.coffee +59 -0
- data/app/js/vendor/gaussianElimination.coffee +40 -0
- data/app/js/vendor/hammer-2.0.8.min.js +7 -0
- data/app/js/vendor/jquery-3.1.1.min.js +4 -0
- data/app/js/vendor/jquery.after-transition.coffee +20 -0
- data/app/js/vendor/jquery.backbone-hammer.coffee +28 -0
- data/app/js/vendor/jquery.keyboard-modifiers.coffee +22 -0
- data/app/js/vendor/jquery.mark-5.2.3.min.js +7 -0
- data/app/js/vendor/jquery.scrollTo-2.1.2.min.js +7 -0
- data/app/js/vendor/js-yaml-3.4.3.min.js +3 -0
- data/app/js/vendor/markup_text.coffee +95 -0
- data/app/js/vendor/mathjax/MathJax.js +19 -0
- data/app/js/vendor/mathjax/extensions/MathEvents.js +19 -0
- data/app/js/vendor/mathjax/extensions/tex2jax.js +19 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_AMS-Regular.eot +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Caligraphic-Bold.eot +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Caligraphic-Regular.eot +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Fraktur-Bold.eot +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Fraktur-Regular.eot +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Main-Bold.eot +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Main-Italic.eot +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Main-Regular.eot +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Math-BoldItalic.eot +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Math-Italic.eot +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Math-Regular.eot +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_SansSerif-Bold.eot +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_SansSerif-Italic.eot +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_SansSerif-Regular.eot +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Script-Regular.eot +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Size1-Regular.eot +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Size2-Regular.eot +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Size3-Regular.eot +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Size4-Regular.eot +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Typewriter-Regular.eot +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_WinIE6-Regular.eot +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_AMS-Regular.otf +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Caligraphic-Bold.otf +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Caligraphic-Regular.otf +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Fraktur-Bold.otf +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Fraktur-Regular.otf +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Main-Bold.otf +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Main-Italic.otf +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Main-Regular.otf +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Math-BoldItalic.otf +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Math-Italic.otf +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Math-Regular.otf +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_SansSerif-Bold.otf +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_SansSerif-Italic.otf +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_SansSerif-Regular.otf +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Script-Regular.otf +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Size1-Regular.otf +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Size2-Regular.otf +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Size3-Regular.otf +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Size4-Regular.otf +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Typewriter-Regular.otf +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_WinChrome-Regular.otf +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_WinIE6-Regular.otf +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_AMS-Regular.svg +765 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Caligraphic-Bold.svg +136 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Caligraphic-Regular.svg +134 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Fraktur-Bold.svg +319 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Fraktur-Regular.svg +309 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Main-Bold.svg +656 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Main-Italic.svg +374 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Main-Regular.svg +659 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Math-BoldItalic.svg +331 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Math-Italic.svg +331 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Math-Regular.svg +330 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_SansSerif-Bold.svg +280 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_SansSerif-Italic.svg +245 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_SansSerif-Regular.svg +211 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Script-Regular.svg +160 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Size1-Regular.svg +110 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Size2-Regular.svg +109 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Size3-Regular.svg +49 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Size4-Regular.svg +102 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Typewriter-Regular.svg +322 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_WinChrome-Regular.svg +39 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_AMS-Regular.woff +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Caligraphic-Bold.woff +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Caligraphic-Regular.woff +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Fraktur-Bold.woff +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Fraktur-Regular.woff +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Main-Bold.woff +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Main-Italic.woff +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Main-Regular.woff +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Math-BoldItalic.woff +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Math-Italic.woff +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Math-Regular.woff +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_SansSerif-Bold.woff +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_SansSerif-Italic.woff +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_SansSerif-Regular.woff +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Script-Regular.woff +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Size1-Regular.woff +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Size2-Regular.woff +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Size3-Regular.woff +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Size4-Regular.woff +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Typewriter-Regular.woff +0 -0
- data/app/js/vendor/mathjax/jax/element/mml/jax.js +19 -0
- data/app/js/vendor/mathjax/jax/element/mml/optable/Arrows.js +19 -0
- data/app/js/vendor/mathjax/jax/element/mml/optable/BasicLatin.js +19 -0
- data/app/js/vendor/mathjax/jax/element/mml/optable/CombDiacritMarks.js +19 -0
- data/app/js/vendor/mathjax/jax/element/mml/optable/CombDiactForSymbols.js +19 -0
- data/app/js/vendor/mathjax/jax/element/mml/optable/Dingbats.js +19 -0
- data/app/js/vendor/mathjax/jax/element/mml/optable/GeneralPunctuation.js +19 -0
- data/app/js/vendor/mathjax/jax/element/mml/optable/GeometricShapes.js +19 -0
- data/app/js/vendor/mathjax/jax/element/mml/optable/GreekAndCoptic.js +19 -0
- data/app/js/vendor/mathjax/jax/element/mml/optable/Latin1Supplement.js +19 -0
- data/app/js/vendor/mathjax/jax/element/mml/optable/LetterlikeSymbols.js +19 -0
- data/app/js/vendor/mathjax/jax/element/mml/optable/MathOperators.js +19 -0
- data/app/js/vendor/mathjax/jax/element/mml/optable/MiscMathSymbolsA.js +19 -0
- data/app/js/vendor/mathjax/jax/element/mml/optable/MiscMathSymbolsB.js +19 -0
- data/app/js/vendor/mathjax/jax/element/mml/optable/MiscSymbolsAndArrows.js +19 -0
- data/app/js/vendor/mathjax/jax/element/mml/optable/MiscTechnical.js +19 -0
- data/app/js/vendor/mathjax/jax/element/mml/optable/SpacingModLetters.js +19 -0
- data/app/js/vendor/mathjax/jax/element/mml/optable/SuppMathOperators.js +19 -0
- data/app/js/vendor/mathjax/jax/element/mml/optable/SupplementalArrowsA.js +19 -0
- data/app/js/vendor/mathjax/jax/element/mml/optable/SupplementalArrowsB.js +19 -0
- data/app/js/vendor/mathjax/jax/input/TeX/config.js +19 -0
- data/app/js/vendor/mathjax/jax/input/TeX/jax.js +19 -0
- data/app/js/vendor/mathjax/jax/output/CommonHTML/autoload/annotation-xml.js +19 -0
- data/app/js/vendor/mathjax/jax/output/CommonHTML/autoload/maction.js +19 -0
- data/app/js/vendor/mathjax/jax/output/CommonHTML/autoload/menclose.js +19 -0
- data/app/js/vendor/mathjax/jax/output/CommonHTML/autoload/mglyph.js +19 -0
- data/app/js/vendor/mathjax/jax/output/CommonHTML/autoload/mmultiscripts.js +19 -0
- data/app/js/vendor/mathjax/jax/output/CommonHTML/autoload/ms.js +19 -0
- data/app/js/vendor/mathjax/jax/output/CommonHTML/autoload/mtable.js +19 -0
- data/app/js/vendor/mathjax/jax/output/CommonHTML/autoload/multiline.js +19 -0
- data/app/js/vendor/mathjax/jax/output/CommonHTML/config.js +19 -0
- data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/AMS-Regular.js +19 -0
- data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/Caligraphic-Bold.js +19 -0
- data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/Fraktur-Bold.js +19 -0
- data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/Fraktur-Regular.js +19 -0
- data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/Main-Bold.js +19 -0
- data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/Math-BoldItalic.js +19 -0
- data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/SansSerif-Bold.js +19 -0
- data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/SansSerif-Italic.js +19 -0
- data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/SansSerif-Regular.js +19 -0
- data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/Script-Regular.js +19 -0
- data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/Typewriter-Regular.js +19 -0
- data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/fontdata-extra.js +19 -0
- data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/fontdata.js +19 -0
- data/app/js/vendor/mathjax/jax/output/CommonHTML/jax.js +19 -0
- data/app/js/vendor/modernizr-custom-3.3.1.min.js +3 -0
- data/app/js/vendor/persistjs-git.js +1136 -0
- data/app/js/vendor/poised/poised.general.coffee +21 -0
- data/app/js/vendor/poised/poised.tabs.coffee +31 -0
- data/app/js/vendor/poised/utils.coffee +11 -0
- data/app/js/vendor/request_animation_frame.coffee +19 -0
- data/app/js/vendor/three-82.min.js +15 -0
- data/app/js/vendor/three-CanvasRenderer-82.js +1118 -0
- data/app/js/vendor/three-Projector-82.js +929 -0
- data/app/js/vendor/underscore-1.8.3.min.js +6 -0
- data/app/js/vendor/webfontloader-1.6.26.min.js +33 -0
- data/app/views/aliasing/legend.jst.hamlc +6 -0
- data/app/views/composites/composites_list_item_label.jst.hamlc +3 -0
- data/app/views/composites/import_composites_aside.jst.hamlc +6 -0
- data/app/views/composites/mix_preset_list_item_label.jst.hamlc +8 -0
- data/app/views/composites/share_aside.jst.hamlc +7 -0
- data/app/views/doc/airplanes_list_item_label.jst.hamlc +3 -0
- data/app/views/doc/import_airplanes_aside.jst.hamlc +6 -0
- data/app/views/doc/share_aside.jst.hamlc +7 -0
- data/app/views/general/app.jst.hamlc +42 -0
- data/app/views/general/curves_list_item_label.jst.hamlc +5 -0
- data/app/views/general/help.jst.hamlc +7 -0
- data/app/views/general/tabs.jst.hamlc +6 -0
- data/app/views/index.haml +24 -0
- data/app/views/overview/app.jst.hamlc +7 -0
- data/app/views/overview/tile.jst.hamlc +4 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/ela.gemspec +50 -0
- data/exe/ela +59 -0
- data/lib/ela.rb +8 -0
- data/lib/ela/jasmine.rb +87 -0
- data/lib/ela/server.rb +136 -0
- data/lib/ela/utils.rb +131 -0
- data/lib/ela/version.rb +3 -0
- data/package-lock.json +899 -0
- data/package.json +11 -0
- data/support/project/Guardfile +64 -0
- data/support/project/jasmine.yml +3 -0
- data/support/server.ru +5 -0
- metadata +4365 -0
@@ -0,0 +1,874 @@
|
|
1
|
+
(function () {
|
2
|
+
// A quick way to make sure we're only keeping span-level tags when we need to.
|
3
|
+
// This isn't supposed to be foolproof. It's just a quick way to make sure we
|
4
|
+
// keep all span-level tags returned by a pagedown converter. It should allow
|
5
|
+
// all span-level tags through, with or without attributes.
|
6
|
+
var inlineTags = new RegExp(['^(<\\/?(a|abbr|acronym|applet|area|b|basefont|',
|
7
|
+
'bdo|big|button|cite|code|del|dfn|em|figcaption|',
|
8
|
+
'font|i|iframe|img|input|ins|kbd|label|map|',
|
9
|
+
'mark|meter|object|param|progress|q|ruby|rp|rt|s|',
|
10
|
+
'samp|script|select|small|span|strike|strong|',
|
11
|
+
'sub|sup|textarea|time|tt|u|var|wbr)[^>]*>|',
|
12
|
+
'<(br)\\s?\\/?>)$'].join(''), 'i');
|
13
|
+
|
14
|
+
/******************************************************************
|
15
|
+
* Utility Functions *
|
16
|
+
*****************************************************************/
|
17
|
+
|
18
|
+
// patch for ie7
|
19
|
+
if (!Array.indexOf) {
|
20
|
+
Array.prototype.indexOf = function(obj) {
|
21
|
+
for (var i = 0; i < this.length; i++) {
|
22
|
+
if (this[i] == obj) {
|
23
|
+
return i;
|
24
|
+
}
|
25
|
+
}
|
26
|
+
return -1;
|
27
|
+
};
|
28
|
+
}
|
29
|
+
|
30
|
+
function trim(str) {
|
31
|
+
return str.replace(/^\s+|\s+$/g, '');
|
32
|
+
}
|
33
|
+
|
34
|
+
function rtrim(str) {
|
35
|
+
return str.replace(/\s+$/g, '');
|
36
|
+
}
|
37
|
+
|
38
|
+
// Remove one level of indentation from text. Indent is 4 spaces.
|
39
|
+
function outdent(text) {
|
40
|
+
return text.replace(new RegExp('^(\\t|[ ]{1,4})', 'gm'), '');
|
41
|
+
}
|
42
|
+
|
43
|
+
function contains(str, substr) {
|
44
|
+
return str.indexOf(substr) != -1;
|
45
|
+
}
|
46
|
+
|
47
|
+
// Sanitize html, removing tags that aren't in the whitelist
|
48
|
+
function sanitizeHtml(html, whitelist) {
|
49
|
+
return html.replace(/<[^>]*>?/gi, function(tag) {
|
50
|
+
return tag.match(whitelist) ? tag : '';
|
51
|
+
});
|
52
|
+
}
|
53
|
+
|
54
|
+
// Merge two arrays, keeping only unique elements.
|
55
|
+
function union(x, y) {
|
56
|
+
var obj = {};
|
57
|
+
for (var i = 0; i < x.length; i++)
|
58
|
+
obj[x[i]] = x[i];
|
59
|
+
for (i = 0; i < y.length; i++)
|
60
|
+
obj[y[i]] = y[i];
|
61
|
+
var res = [];
|
62
|
+
for (var k in obj) {
|
63
|
+
if (obj.hasOwnProperty(k))
|
64
|
+
res.push(obj[k]);
|
65
|
+
}
|
66
|
+
return res;
|
67
|
+
}
|
68
|
+
|
69
|
+
// JS regexes don't support \A or \Z, so we add sentinels, as Pagedown
|
70
|
+
// does. In this case, we add the ascii codes for start of text (STX) and
|
71
|
+
// end of text (ETX), an idea borrowed from:
|
72
|
+
// https://github.com/tanakahisateru/js-markdown-extra
|
73
|
+
function addAnchors(text) {
|
74
|
+
if(text.charAt(0) != '\x02')
|
75
|
+
text = '\x02' + text;
|
76
|
+
if(text.charAt(text.length - 1) != '\x03')
|
77
|
+
text = text + '\x03';
|
78
|
+
return text;
|
79
|
+
}
|
80
|
+
|
81
|
+
// Remove STX and ETX sentinels.
|
82
|
+
function removeAnchors(text) {
|
83
|
+
if(text.charAt(0) == '\x02')
|
84
|
+
text = text.substr(1);
|
85
|
+
if(text.charAt(text.length - 1) == '\x03')
|
86
|
+
text = text.substr(0, text.length - 1);
|
87
|
+
return text;
|
88
|
+
}
|
89
|
+
|
90
|
+
// Convert markdown within an element, retaining only span-level tags
|
91
|
+
function convertSpans(text, extra) {
|
92
|
+
return sanitizeHtml(convertAll(text, extra), inlineTags);
|
93
|
+
}
|
94
|
+
|
95
|
+
// Convert internal markdown using the stock pagedown converter
|
96
|
+
function convertAll(text, extra) {
|
97
|
+
var result = extra.blockGamutHookCallback(text);
|
98
|
+
// We need to perform these operations since we skip the steps in the converter
|
99
|
+
result = unescapeSpecialChars(result);
|
100
|
+
result = result.replace(/~D/g, "$$").replace(/~T/g, "~");
|
101
|
+
result = extra.previousPostConversion(result);
|
102
|
+
return result;
|
103
|
+
}
|
104
|
+
|
105
|
+
// Convert escaped special characters
|
106
|
+
function processEscapesStep1(text) {
|
107
|
+
// Markdown extra adds two escapable characters, `:` and `|`
|
108
|
+
return text.replace(/\\\|/g, '~I').replace(/\\:/g, '~i');
|
109
|
+
}
|
110
|
+
function processEscapesStep2(text) {
|
111
|
+
return text.replace(/~I/g, '|').replace(/~i/g, ':');
|
112
|
+
}
|
113
|
+
|
114
|
+
// Duplicated from PageDown converter
|
115
|
+
function unescapeSpecialChars(text) {
|
116
|
+
// Swap back in all the special characters we've hidden.
|
117
|
+
text = text.replace(/~E(\d+)E/g, function(wholeMatch, m1) {
|
118
|
+
var charCodeToReplace = parseInt(m1);
|
119
|
+
return String.fromCharCode(charCodeToReplace);
|
120
|
+
});
|
121
|
+
return text;
|
122
|
+
}
|
123
|
+
|
124
|
+
function slugify(text) {
|
125
|
+
return text.toLowerCase()
|
126
|
+
.replace(/\s+/g, '-') // Replace spaces with -
|
127
|
+
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
|
128
|
+
.replace(/\-\-+/g, '-') // Replace multiple - with single -
|
129
|
+
.replace(/^-+/, '') // Trim - from start of text
|
130
|
+
.replace(/-+$/, ''); // Trim - from end of text
|
131
|
+
}
|
132
|
+
|
133
|
+
/*****************************************************************************
|
134
|
+
* Markdown.Extra *
|
135
|
+
****************************************************************************/
|
136
|
+
|
137
|
+
Markdown.Extra = function() {
|
138
|
+
// For converting internal markdown (in tables for instance).
|
139
|
+
// This is necessary since these methods are meant to be called as
|
140
|
+
// preConversion hooks, and the Markdown converter passed to init()
|
141
|
+
// won't convert any markdown contained in the html tags we return.
|
142
|
+
this.converter = null;
|
143
|
+
|
144
|
+
// Stores html blocks we generate in hooks so that
|
145
|
+
// they're not destroyed if the user is using a sanitizing converter
|
146
|
+
this.hashBlocks = [];
|
147
|
+
|
148
|
+
// Stores footnotes
|
149
|
+
this.footnotes = {};
|
150
|
+
this.usedFootnotes = [];
|
151
|
+
|
152
|
+
// Special attribute blocks for fenced code blocks and headers enabled.
|
153
|
+
this.attributeBlocks = false;
|
154
|
+
|
155
|
+
// Fenced code block options
|
156
|
+
this.googleCodePrettify = false;
|
157
|
+
this.highlightJs = false;
|
158
|
+
|
159
|
+
// Table options
|
160
|
+
this.tableClass = '';
|
161
|
+
|
162
|
+
this.tabWidth = 4;
|
163
|
+
};
|
164
|
+
|
165
|
+
Markdown.Extra.init = function(converter, options) {
|
166
|
+
// Each call to init creates a new instance of Markdown.Extra so it's
|
167
|
+
// safe to have multiple converters, with different options, on a single page
|
168
|
+
var extra = new Markdown.Extra();
|
169
|
+
var postNormalizationTransformations = [];
|
170
|
+
var preBlockGamutTransformations = [];
|
171
|
+
var postSpanGamutTransformations = [];
|
172
|
+
var postConversionTransformations = ["unHashExtraBlocks"];
|
173
|
+
|
174
|
+
options = options || {};
|
175
|
+
options.extensions = options.extensions || ["all"];
|
176
|
+
if (contains(options.extensions, "all")) {
|
177
|
+
options.extensions = ["tables", "fenced_code_gfm", "def_list", "attr_list", "footnotes", "smartypants", "strikethrough", "newlines"];
|
178
|
+
}
|
179
|
+
preBlockGamutTransformations.push("wrapHeaders");
|
180
|
+
if (contains(options.extensions, "attr_list")) {
|
181
|
+
postNormalizationTransformations.push("hashFcbAttributeBlocks");
|
182
|
+
preBlockGamutTransformations.push("hashHeaderAttributeBlocks");
|
183
|
+
postConversionTransformations.push("applyAttributeBlocks");
|
184
|
+
extra.attributeBlocks = true;
|
185
|
+
}
|
186
|
+
if (contains(options.extensions, "fenced_code_gfm")) {
|
187
|
+
// This step will convert fcb inside list items and blockquotes
|
188
|
+
preBlockGamutTransformations.push("fencedCodeBlocks");
|
189
|
+
// This extra step is to prevent html blocks hashing and link definition/footnotes stripping inside fcb
|
190
|
+
postNormalizationTransformations.push("fencedCodeBlocks");
|
191
|
+
}
|
192
|
+
if (contains(options.extensions, "tables")) {
|
193
|
+
preBlockGamutTransformations.push("tables");
|
194
|
+
}
|
195
|
+
if (contains(options.extensions, "def_list")) {
|
196
|
+
preBlockGamutTransformations.push("definitionLists");
|
197
|
+
}
|
198
|
+
if (contains(options.extensions, "footnotes")) {
|
199
|
+
postNormalizationTransformations.push("stripFootnoteDefinitions");
|
200
|
+
preBlockGamutTransformations.push("doFootnotes");
|
201
|
+
postConversionTransformations.push("printFootnotes");
|
202
|
+
}
|
203
|
+
if (contains(options.extensions, "smartypants")) {
|
204
|
+
postConversionTransformations.push("runSmartyPants");
|
205
|
+
}
|
206
|
+
if (contains(options.extensions, "strikethrough")) {
|
207
|
+
postSpanGamutTransformations.push("strikethrough");
|
208
|
+
}
|
209
|
+
if (contains(options.extensions, "newlines")) {
|
210
|
+
postSpanGamutTransformations.push("newlines");
|
211
|
+
}
|
212
|
+
|
213
|
+
converter.hooks.chain("postNormalization", function(text) {
|
214
|
+
return extra.doTransform(postNormalizationTransformations, text) + '\n';
|
215
|
+
});
|
216
|
+
|
217
|
+
converter.hooks.chain("preBlockGamut", function(text, blockGamutHookCallback) {
|
218
|
+
// Keep a reference to the block gamut callback to run recursively
|
219
|
+
extra.blockGamutHookCallback = blockGamutHookCallback;
|
220
|
+
text = processEscapesStep1(text);
|
221
|
+
text = extra.doTransform(preBlockGamutTransformations, text) + '\n';
|
222
|
+
text = processEscapesStep2(text);
|
223
|
+
return text;
|
224
|
+
});
|
225
|
+
|
226
|
+
converter.hooks.chain("postSpanGamut", function(text) {
|
227
|
+
return extra.doTransform(postSpanGamutTransformations, text);
|
228
|
+
});
|
229
|
+
|
230
|
+
// Keep a reference to the hook chain running before doPostConversion to apply on hashed extra blocks
|
231
|
+
extra.previousPostConversion = converter.hooks.postConversion;
|
232
|
+
converter.hooks.chain("postConversion", function(text) {
|
233
|
+
text = extra.doTransform(postConversionTransformations, text);
|
234
|
+
// Clear state vars that may use unnecessary memory
|
235
|
+
extra.hashBlocks = [];
|
236
|
+
extra.footnotes = {};
|
237
|
+
extra.usedFootnotes = [];
|
238
|
+
return text;
|
239
|
+
});
|
240
|
+
|
241
|
+
if ("highlighter" in options) {
|
242
|
+
extra.googleCodePrettify = options.highlighter === 'prettify';
|
243
|
+
extra.highlightJs = options.highlighter === 'highlight';
|
244
|
+
}
|
245
|
+
|
246
|
+
if ("table_class" in options) {
|
247
|
+
extra.tableClass = options.table_class;
|
248
|
+
}
|
249
|
+
|
250
|
+
extra.converter = converter;
|
251
|
+
|
252
|
+
// Caller usually won't need this, but it's handy for testing.
|
253
|
+
return extra;
|
254
|
+
};
|
255
|
+
|
256
|
+
// Do transformations
|
257
|
+
Markdown.Extra.prototype.doTransform = function(transformations, text) {
|
258
|
+
for(var i = 0; i < transformations.length; i++)
|
259
|
+
text = this[transformations[i]](text);
|
260
|
+
return text;
|
261
|
+
};
|
262
|
+
|
263
|
+
// Return a placeholder containing a key, which is the block's index in the
|
264
|
+
// hashBlocks array. We wrap our output in a <p> tag here so Pagedown won't.
|
265
|
+
Markdown.Extra.prototype.hashExtraBlock = function(block) {
|
266
|
+
return '\n<p>~X' + (this.hashBlocks.push(block) - 1) + 'X</p>\n';
|
267
|
+
};
|
268
|
+
Markdown.Extra.prototype.hashExtraInline = function(block) {
|
269
|
+
return '~X' + (this.hashBlocks.push(block) - 1) + 'X';
|
270
|
+
};
|
271
|
+
|
272
|
+
// Replace placeholder blocks in `text` with their corresponding
|
273
|
+
// html blocks in the hashBlocks array.
|
274
|
+
Markdown.Extra.prototype.unHashExtraBlocks = function(text) {
|
275
|
+
var self = this;
|
276
|
+
function recursiveUnHash() {
|
277
|
+
var hasHash = false;
|
278
|
+
text = text.replace(/(?:<p>)?~X(\d+)X(?:<\/p>)?/g, function(wholeMatch, m1) {
|
279
|
+
hasHash = true;
|
280
|
+
var key = parseInt(m1, 10);
|
281
|
+
return self.hashBlocks[key];
|
282
|
+
});
|
283
|
+
if(hasHash === true) {
|
284
|
+
recursiveUnHash();
|
285
|
+
}
|
286
|
+
}
|
287
|
+
recursiveUnHash();
|
288
|
+
return text;
|
289
|
+
};
|
290
|
+
|
291
|
+
// Wrap headers to make sure they won't be in def lists
|
292
|
+
Markdown.Extra.prototype.wrapHeaders = function(text) {
|
293
|
+
function wrap(text) {
|
294
|
+
return '\n' + text + '\n';
|
295
|
+
}
|
296
|
+
text = text.replace(/^.+[ \t]*\n=+[ \t]*\n+/gm, wrap);
|
297
|
+
text = text.replace(/^.+[ \t]*\n-+[ \t]*\n+/gm, wrap);
|
298
|
+
text = text.replace(/^\#{1,6}[ \t]*.+?[ \t]*\#*\n+/gm, wrap);
|
299
|
+
return text;
|
300
|
+
};
|
301
|
+
|
302
|
+
|
303
|
+
/******************************************************************
|
304
|
+
* Attribute Blocks *
|
305
|
+
*****************************************************************/
|
306
|
+
|
307
|
+
// TODO: use sentinels. Should we just add/remove them in doConversion?
|
308
|
+
// TODO: better matches for id / class attributes
|
309
|
+
var attrBlock = "\\{[ \\t]*((?:[#.][-_:a-zA-Z0-9]+[ \\t]*)+)\\}";
|
310
|
+
var hdrAttributesA = new RegExp("^(#{1,6}.*#{0,6})[ \\t]+" + attrBlock + "[ \\t]*(?:\\n|0x03)", "gm");
|
311
|
+
var hdrAttributesB = new RegExp("^(.*)[ \\t]+" + attrBlock + "[ \\t]*\\n" +
|
312
|
+
"(?=[\\-|=]+\\s*(?:\\n|0x03))", "gm"); // underline lookahead
|
313
|
+
var fcbAttributes = new RegExp("^(```[ \\t]*[^{\\s]*)[ \\t]+" + attrBlock + "[ \\t]*\\n" +
|
314
|
+
"(?=([\\s\\S]*?)\\n```[ \\t]*(\\n|0x03))", "gm");
|
315
|
+
|
316
|
+
// Extract headers attribute blocks, move them above the element they will be
|
317
|
+
// applied to, and hash them for later.
|
318
|
+
Markdown.Extra.prototype.hashHeaderAttributeBlocks = function(text) {
|
319
|
+
|
320
|
+
var self = this;
|
321
|
+
function attributeCallback(wholeMatch, pre, attr) {
|
322
|
+
return '<p>~XX' + (self.hashBlocks.push(attr) - 1) + 'XX</p>\n' + pre + "\n";
|
323
|
+
}
|
324
|
+
|
325
|
+
text = text.replace(hdrAttributesA, attributeCallback); // ## headers
|
326
|
+
text = text.replace(hdrAttributesB, attributeCallback); // underline headers
|
327
|
+
return text;
|
328
|
+
};
|
329
|
+
|
330
|
+
// Extract FCB attribute blocks, move them above the element they will be
|
331
|
+
// applied to, and hash them for later.
|
332
|
+
Markdown.Extra.prototype.hashFcbAttributeBlocks = function(text) {
|
333
|
+
// TODO: use sentinels. Should we just add/remove them in doConversion?
|
334
|
+
// TODO: better matches for id / class attributes
|
335
|
+
|
336
|
+
var self = this;
|
337
|
+
function attributeCallback(wholeMatch, pre, attr) {
|
338
|
+
return '<p>~XX' + (self.hashBlocks.push(attr) - 1) + 'XX</p>\n' + pre + "\n";
|
339
|
+
}
|
340
|
+
|
341
|
+
return text.replace(fcbAttributes, attributeCallback);
|
342
|
+
};
|
343
|
+
|
344
|
+
Markdown.Extra.prototype.applyAttributeBlocks = function(text) {
|
345
|
+
var self = this;
|
346
|
+
var blockRe = new RegExp('<p>~XX(\\d+)XX</p>[\\s]*' +
|
347
|
+
'(?:<(h[1-6]|pre)(?: +class="(\\S+)")?(>[\\s\\S]*?</\\2>))', "gm");
|
348
|
+
text = text.replace(blockRe, function(wholeMatch, k, tag, cls, rest) {
|
349
|
+
if (!tag) // no following header or fenced code block.
|
350
|
+
return '';
|
351
|
+
|
352
|
+
// get attributes list from hash
|
353
|
+
var key = parseInt(k, 10);
|
354
|
+
var attributes = self.hashBlocks[key];
|
355
|
+
|
356
|
+
// get id
|
357
|
+
var id = attributes.match(/#[^\s#.]+/g) || [];
|
358
|
+
var idStr = id[0] ? ' id="' + id[0].substr(1, id[0].length - 1) + '"' : '';
|
359
|
+
|
360
|
+
// get classes and merge with existing classes
|
361
|
+
var classes = attributes.match(/\.[^\s#.]+/g) || [];
|
362
|
+
for (var i = 0; i < classes.length; i++) // Remove leading dot
|
363
|
+
classes[i] = classes[i].substr(1, classes[i].length - 1);
|
364
|
+
|
365
|
+
var classStr = '';
|
366
|
+
if (cls)
|
367
|
+
classes = union(classes, [cls]);
|
368
|
+
|
369
|
+
if (classes.length > 0)
|
370
|
+
classStr = ' class="' + classes.join(' ') + '"';
|
371
|
+
|
372
|
+
return "<" + tag + idStr + classStr + rest;
|
373
|
+
});
|
374
|
+
|
375
|
+
return text;
|
376
|
+
};
|
377
|
+
|
378
|
+
/******************************************************************
|
379
|
+
* Tables *
|
380
|
+
*****************************************************************/
|
381
|
+
|
382
|
+
// Find and convert Markdown Extra tables into html.
|
383
|
+
Markdown.Extra.prototype.tables = function(text) {
|
384
|
+
var self = this;
|
385
|
+
|
386
|
+
var leadingPipe = new RegExp(
|
387
|
+
['^' ,
|
388
|
+
'[ ]{0,3}' , // Allowed whitespace
|
389
|
+
'[|]' , // Initial pipe
|
390
|
+
'(.+)\\n' , // $1: Header Row
|
391
|
+
|
392
|
+
'[ ]{0,3}' , // Allowed whitespace
|
393
|
+
'[|]([ ]*[-:]+[-| :]*)\\n' , // $2: Separator
|
394
|
+
|
395
|
+
'(' , // $3: Table Body
|
396
|
+
'(?:[ ]*[|].*\\n?)*' , // Table rows
|
397
|
+
')',
|
398
|
+
'(?:\\n|$)' // Stop at final newline
|
399
|
+
].join(''),
|
400
|
+
'gm'
|
401
|
+
);
|
402
|
+
|
403
|
+
var noLeadingPipe = new RegExp(
|
404
|
+
['^' ,
|
405
|
+
'[ ]{0,3}' , // Allowed whitespace
|
406
|
+
'(\\S.*[|].*)\\n' , // $1: Header Row
|
407
|
+
|
408
|
+
'[ ]{0,3}' , // Allowed whitespace
|
409
|
+
'([-:]+[ ]*[|][-| :]*)\\n' , // $2: Separator
|
410
|
+
|
411
|
+
'(' , // $3: Table Body
|
412
|
+
'(?:.*[|].*\\n?)*' , // Table rows
|
413
|
+
')' ,
|
414
|
+
'(?:\\n|$)' // Stop at final newline
|
415
|
+
].join(''),
|
416
|
+
'gm'
|
417
|
+
);
|
418
|
+
|
419
|
+
text = text.replace(leadingPipe, doTable);
|
420
|
+
text = text.replace(noLeadingPipe, doTable);
|
421
|
+
|
422
|
+
// $1 = header, $2 = separator, $3 = body
|
423
|
+
function doTable(match, header, separator, body, offset, string) {
|
424
|
+
// remove any leading pipes and whitespace
|
425
|
+
header = header.replace(/^ *[|]/m, '');
|
426
|
+
separator = separator.replace(/^ *[|]/m, '');
|
427
|
+
body = body.replace(/^ *[|]/gm, '');
|
428
|
+
|
429
|
+
// remove trailing pipes and whitespace
|
430
|
+
header = header.replace(/[|] *$/m, '');
|
431
|
+
separator = separator.replace(/[|] *$/m, '');
|
432
|
+
body = body.replace(/[|] *$/gm, '');
|
433
|
+
|
434
|
+
// determine column alignments
|
435
|
+
alignspecs = separator.split(/ *[|] */);
|
436
|
+
align = [];
|
437
|
+
for (var i = 0; i < alignspecs.length; i++) {
|
438
|
+
var spec = alignspecs[i];
|
439
|
+
if (spec.match(/^ *-+: *$/m))
|
440
|
+
align[i] = ' style="text-align:right;"';
|
441
|
+
else if (spec.match(/^ *:-+: *$/m))
|
442
|
+
align[i] = ' style="text-align:center;"';
|
443
|
+
else if (spec.match(/^ *:-+ *$/m))
|
444
|
+
align[i] = ' style="text-align:left;"';
|
445
|
+
else align[i] = '';
|
446
|
+
}
|
447
|
+
|
448
|
+
// TODO: parse spans in header and rows before splitting, so that pipes
|
449
|
+
// inside of tags are not interpreted as separators
|
450
|
+
var headers = header.split(/ *[|] */);
|
451
|
+
var colCount = headers.length;
|
452
|
+
|
453
|
+
// build html
|
454
|
+
var cls = self.tableClass ? ' class="' + self.tableClass + '"' : '';
|
455
|
+
var html = ['<table', cls, '>\n', '<thead>\n', '<tr>\n'].join('');
|
456
|
+
|
457
|
+
// build column headers.
|
458
|
+
for (i = 0; i < colCount; i++) {
|
459
|
+
var headerHtml = convertSpans(trim(headers[i]), self);
|
460
|
+
html += [" <th", align[i], ">", headerHtml, "</th>\n"].join('');
|
461
|
+
}
|
462
|
+
html += "</tr>\n</thead>\n";
|
463
|
+
|
464
|
+
// build rows
|
465
|
+
var rows = body.split('\n');
|
466
|
+
for (i = 0; i < rows.length; i++) {
|
467
|
+
if (rows[i].match(/^\s*$/)) // can apply to final row
|
468
|
+
continue;
|
469
|
+
|
470
|
+
// ensure number of rowCells matches colCount
|
471
|
+
var rowCells = rows[i].split(/ *[|] */);
|
472
|
+
var lenDiff = colCount - rowCells.length;
|
473
|
+
for (var j = 0; j < lenDiff; j++)
|
474
|
+
rowCells.push('');
|
475
|
+
|
476
|
+
html += "<tr>\n";
|
477
|
+
for (j = 0; j < colCount; j++) {
|
478
|
+
var colHtml = convertSpans(trim(rowCells[j]), self);
|
479
|
+
html += [" <td", align[j], ">", colHtml, "</td>\n"].join('');
|
480
|
+
}
|
481
|
+
html += "</tr>\n";
|
482
|
+
}
|
483
|
+
|
484
|
+
html += "</table>\n";
|
485
|
+
|
486
|
+
// replace html with placeholder until postConversion step
|
487
|
+
return self.hashExtraBlock(html);
|
488
|
+
}
|
489
|
+
|
490
|
+
return text;
|
491
|
+
};
|
492
|
+
|
493
|
+
|
494
|
+
/******************************************************************
|
495
|
+
* Footnotes *
|
496
|
+
*****************************************************************/
|
497
|
+
|
498
|
+
// Strip footnote, store in hashes.
|
499
|
+
Markdown.Extra.prototype.stripFootnoteDefinitions = function(text) {
|
500
|
+
var self = this;
|
501
|
+
|
502
|
+
text = text.replace(
|
503
|
+
/\n[ ]{0,3}\[\^(.+?)\]\:[ \t]*\n?([\s\S]*?)\n{1,2}((?=\n[ ]{0,3}\S)|$)/g,
|
504
|
+
function(wholeMatch, m1, m2) {
|
505
|
+
m1 = slugify(m1);
|
506
|
+
m2 += "\n";
|
507
|
+
m2 = m2.replace(/^[ ]{0,3}/g, "");
|
508
|
+
self.footnotes[m1] = m2;
|
509
|
+
return "\n";
|
510
|
+
});
|
511
|
+
|
512
|
+
return text;
|
513
|
+
};
|
514
|
+
|
515
|
+
|
516
|
+
// Find and convert footnotes references.
|
517
|
+
Markdown.Extra.prototype.doFootnotes = function(text) {
|
518
|
+
var self = this;
|
519
|
+
if(self.isConvertingFootnote === true) {
|
520
|
+
return text;
|
521
|
+
}
|
522
|
+
|
523
|
+
var footnoteCounter = 0;
|
524
|
+
text = text.replace(/\[\^(.+?)\]/g, function(wholeMatch, m1) {
|
525
|
+
var id = slugify(m1);
|
526
|
+
var footnote = self.footnotes[id];
|
527
|
+
if (footnote === undefined) {
|
528
|
+
return wholeMatch;
|
529
|
+
}
|
530
|
+
footnoteCounter++;
|
531
|
+
self.usedFootnotes.push(id);
|
532
|
+
var html = '<a href="#fn:' + id + '" id="fnref:' + id
|
533
|
+
+ '" title="See footnote" class="footnote">' + footnoteCounter
|
534
|
+
+ '</a>';
|
535
|
+
return self.hashExtraInline(html);
|
536
|
+
});
|
537
|
+
|
538
|
+
return text;
|
539
|
+
};
|
540
|
+
|
541
|
+
// Print footnotes at the end of the document
|
542
|
+
Markdown.Extra.prototype.printFootnotes = function(text) {
|
543
|
+
var self = this;
|
544
|
+
|
545
|
+
if (self.usedFootnotes.length === 0) {
|
546
|
+
return text;
|
547
|
+
}
|
548
|
+
|
549
|
+
text += '\n\n<div class="footnotes">\n<hr>\n<ol>\n\n';
|
550
|
+
for(var i=0; i<self.usedFootnotes.length; i++) {
|
551
|
+
var id = self.usedFootnotes[i];
|
552
|
+
var footnote = self.footnotes[id];
|
553
|
+
self.isConvertingFootnote = true;
|
554
|
+
var formattedfootnote = convertSpans(footnote, self);
|
555
|
+
delete self.isConvertingFootnote;
|
556
|
+
text += '<li id="fn:'
|
557
|
+
+ id
|
558
|
+
+ '">'
|
559
|
+
+ formattedfootnote
|
560
|
+
+ ' <a href="#fnref:'
|
561
|
+
+ id
|
562
|
+
+ '" title="Return to article" class="reversefootnote">↩</a></li>\n\n';
|
563
|
+
}
|
564
|
+
text += '</ol>\n</div>';
|
565
|
+
return text;
|
566
|
+
};
|
567
|
+
|
568
|
+
|
569
|
+
/******************************************************************
|
570
|
+
* Fenced Code Blocks (gfm) *
|
571
|
+
******************************************************************/
|
572
|
+
|
573
|
+
// Find and convert gfm-inspired fenced code blocks into html.
|
574
|
+
Markdown.Extra.prototype.fencedCodeBlocks = function(text) {
|
575
|
+
function encodeCode(code) {
|
576
|
+
code = code.replace(/&/g, "&");
|
577
|
+
code = code.replace(/</g, "<");
|
578
|
+
code = code.replace(/>/g, ">");
|
579
|
+
// These were escaped by PageDown before postNormalization
|
580
|
+
code = code.replace(/~D/g, "$$");
|
581
|
+
code = code.replace(/~T/g, "~");
|
582
|
+
return code;
|
583
|
+
}
|
584
|
+
|
585
|
+
var self = this;
|
586
|
+
text = text.replace(/(?:^|\n)```[ \t]*(\S*)[ \t]*\n([\s\S]*?)\n```[ \t]*(?=\n)/g, function(match, m1, m2) {
|
587
|
+
var language = m1, codeblock = m2;
|
588
|
+
|
589
|
+
// adhere to specified options
|
590
|
+
var preclass = self.googleCodePrettify ? ' class="prettyprint"' : '';
|
591
|
+
var codeclass = '';
|
592
|
+
if (language) {
|
593
|
+
if (self.googleCodePrettify || self.highlightJs) {
|
594
|
+
// use html5 language- class names. supported by both prettify and highlight.js
|
595
|
+
codeclass = ' class="language-' + language + '"';
|
596
|
+
} else {
|
597
|
+
codeclass = ' class="' + language + '"';
|
598
|
+
}
|
599
|
+
}
|
600
|
+
|
601
|
+
var html = ['<pre', preclass, '><code', codeclass, '>',
|
602
|
+
encodeCode(codeblock), '</code></pre>'].join('');
|
603
|
+
|
604
|
+
// replace codeblock with placeholder until postConversion step
|
605
|
+
return self.hashExtraBlock(html);
|
606
|
+
});
|
607
|
+
|
608
|
+
return text;
|
609
|
+
};
|
610
|
+
|
611
|
+
|
612
|
+
/******************************************************************
|
613
|
+
* SmartyPants *
|
614
|
+
******************************************************************/
|
615
|
+
|
616
|
+
Markdown.Extra.prototype.educatePants = function(text) {
|
617
|
+
var self = this;
|
618
|
+
var result = '';
|
619
|
+
var blockOffset = 0;
|
620
|
+
// Here we parse HTML in a very bad manner
|
621
|
+
text.replace(/(?:<!--[\s\S]*?-->)|(<)([a-zA-Z1-6]+)([^\n]*?>)([\s\S]*?)(<\/\2>)/g, function(wholeMatch, m1, m2, m3, m4, m5, offset) {
|
622
|
+
var token = text.substring(blockOffset, offset);
|
623
|
+
result += self.applyPants(token);
|
624
|
+
self.smartyPantsLastChar = result.substring(result.length - 1);
|
625
|
+
blockOffset = offset + wholeMatch.length;
|
626
|
+
if(!m1) {
|
627
|
+
// Skip commentary
|
628
|
+
result += wholeMatch;
|
629
|
+
return;
|
630
|
+
}
|
631
|
+
// Skip special tags
|
632
|
+
if(!/code|kbd|pre|script|noscript|iframe|math|ins|del|pre/i.test(m2)) {
|
633
|
+
m4 = self.educatePants(m4);
|
634
|
+
}
|
635
|
+
else {
|
636
|
+
self.smartyPantsLastChar = m4.substring(m4.length - 1);
|
637
|
+
}
|
638
|
+
result += m1 + m2 + m3 + m4 + m5;
|
639
|
+
});
|
640
|
+
var lastToken = text.substring(blockOffset);
|
641
|
+
result += self.applyPants(lastToken);
|
642
|
+
self.smartyPantsLastChar = result.substring(result.length - 1);
|
643
|
+
return result;
|
644
|
+
};
|
645
|
+
|
646
|
+
function revertPants(wholeMatch, m1) {
|
647
|
+
var blockText = m1;
|
648
|
+
blockText = blockText.replace(/&\#8220;/g, "\"");
|
649
|
+
blockText = blockText.replace(/&\#8221;/g, "\"");
|
650
|
+
blockText = blockText.replace(/&\#8216;/g, "'");
|
651
|
+
blockText = blockText.replace(/&\#8217;/g, "'");
|
652
|
+
blockText = blockText.replace(/&\#8212;/g, "---");
|
653
|
+
blockText = blockText.replace(/&\#8211;/g, "--");
|
654
|
+
blockText = blockText.replace(/&\#8230;/g, "...");
|
655
|
+
return blockText;
|
656
|
+
}
|
657
|
+
|
658
|
+
Markdown.Extra.prototype.applyPants = function(text) {
|
659
|
+
// Dashes
|
660
|
+
text = text.replace(/---/g, "—").replace(/--/g, "–");
|
661
|
+
// Ellipses
|
662
|
+
text = text.replace(/\.\.\./g, "…").replace(/\.\s\.\s\./g, "…");
|
663
|
+
// Backticks
|
664
|
+
text = text.replace(/``/g, "“").replace (/''/g, "”");
|
665
|
+
|
666
|
+
if(/^'$/.test(text)) {
|
667
|
+
// Special case: single-character ' token
|
668
|
+
if(/\S/.test(this.smartyPantsLastChar)) {
|
669
|
+
return "’";
|
670
|
+
}
|
671
|
+
return "‘";
|
672
|
+
}
|
673
|
+
if(/^"$/.test(text)) {
|
674
|
+
// Special case: single-character " token
|
675
|
+
if(/\S/.test(this.smartyPantsLastChar)) {
|
676
|
+
return "”";
|
677
|
+
}
|
678
|
+
return "“";
|
679
|
+
}
|
680
|
+
|
681
|
+
// Special case if the very first character is a quote
|
682
|
+
// followed by punctuation at a non-word-break. Close the quotes by brute force:
|
683
|
+
text = text.replace (/^'(?=[!"#\$\%'()*+,\-.\/:;<=>?\@\[\\]\^_`{|}~]\B)/, "’");
|
684
|
+
text = text.replace (/^"(?=[!"#\$\%'()*+,\-.\/:;<=>?\@\[\\]\^_`{|}~]\B)/, "”");
|
685
|
+
|
686
|
+
// Special case for double sets of quotes, e.g.:
|
687
|
+
// <p>He said, "'Quoted' words in a larger quote."</p>
|
688
|
+
text = text.replace(/"'(?=\w)/g, "“‘");
|
689
|
+
text = text.replace(/'"(?=\w)/g, "‘“");
|
690
|
+
|
691
|
+
// Special case for decade abbreviations (the '80s):
|
692
|
+
text = text.replace(/'(?=\d{2}s)/g, "’");
|
693
|
+
|
694
|
+
// Get most opening single quotes:
|
695
|
+
text = text.replace(/(\s| |--|&[mn]dash;|&\#8211;|&\#8212;|&\#x201[34];)'(?=\w)/g, "$1‘");
|
696
|
+
|
697
|
+
// Single closing quotes:
|
698
|
+
text = text.replace(/([^\s\[\{\(\-])'/g, "$1’");
|
699
|
+
text = text.replace(/'(?=\s|s\b)/g, "’");
|
700
|
+
|
701
|
+
// Any remaining single quotes should be opening ones:
|
702
|
+
text = text.replace(/'/g, "‘");
|
703
|
+
|
704
|
+
// Get most opening double quotes:
|
705
|
+
text = text.replace(/(\s| |--|&[mn]dash;|&\#8211;|&\#8212;|&\#x201[34];)"(?=\w)/g, "$1“");
|
706
|
+
|
707
|
+
// Double closing quotes:
|
708
|
+
text = text.replace(/([^\s\[\{\(\-])"/g, "$1”");
|
709
|
+
text = text.replace(/"(?=\s)/g, "”");
|
710
|
+
|
711
|
+
// Any remaining quotes should be opening ones.
|
712
|
+
text = text.replace(/"/ig, "“");
|
713
|
+
return text;
|
714
|
+
};
|
715
|
+
|
716
|
+
// Find and convert markdown extra definition lists into html.
|
717
|
+
Markdown.Extra.prototype.runSmartyPants = function(text) {
|
718
|
+
this.smartyPantsLastChar = '';
|
719
|
+
text = this.educatePants(text);
|
720
|
+
// Clean everything inside html tags (some of them may have been converted due to our rough html parsing)
|
721
|
+
text = text.replace(/(<([a-zA-Z1-6]+)\b([^\n>]*?)(\/)?>)/g, revertPants);
|
722
|
+
return text;
|
723
|
+
};
|
724
|
+
|
725
|
+
/******************************************************************
|
726
|
+
* Definition Lists *
|
727
|
+
******************************************************************/
|
728
|
+
|
729
|
+
// Find and convert markdown extra definition lists into html.
|
730
|
+
Markdown.Extra.prototype.definitionLists = function(text) {
|
731
|
+
var wholeList = new RegExp(
|
732
|
+
['(\\x02\\n?|\\n\\n)' ,
|
733
|
+
'(?:' ,
|
734
|
+
'(' , // $1 = whole list
|
735
|
+
'(' , // $2
|
736
|
+
'[ ]{0,3}' ,
|
737
|
+
'((?:[ \\t]*\\S.*\\n)+)', // $3 = defined term
|
738
|
+
'\\n?' ,
|
739
|
+
'[ ]{0,3}:[ ]+' , // colon starting definition
|
740
|
+
')' ,
|
741
|
+
'([\\s\\S]+?)' ,
|
742
|
+
'(' , // $4
|
743
|
+
'(?=\\0x03)' , // \z
|
744
|
+
'|' ,
|
745
|
+
'(?=' ,
|
746
|
+
'\\n{2,}' ,
|
747
|
+
'(?=\\S)' ,
|
748
|
+
'(?!' , // Negative lookahead for another term
|
749
|
+
'[ ]{0,3}' ,
|
750
|
+
'(?:\\S.*\\n)+?' , // defined term
|
751
|
+
'\\n?' ,
|
752
|
+
'[ ]{0,3}:[ ]+' , // colon starting definition
|
753
|
+
')' ,
|
754
|
+
'(?!' , // Negative lookahead for another definition
|
755
|
+
'[ ]{0,3}:[ ]+' , // colon starting definition
|
756
|
+
')' ,
|
757
|
+
')' ,
|
758
|
+
')' ,
|
759
|
+
')' ,
|
760
|
+
')'
|
761
|
+
].join(''),
|
762
|
+
'gm'
|
763
|
+
);
|
764
|
+
|
765
|
+
var self = this;
|
766
|
+
text = addAnchors(text);
|
767
|
+
|
768
|
+
text = text.replace(wholeList, function(match, pre, list) {
|
769
|
+
var result = trim(self.processDefListItems(list));
|
770
|
+
result = "<dl>\n" + result + "\n</dl>";
|
771
|
+
return pre + self.hashExtraBlock(result) + "\n\n";
|
772
|
+
});
|
773
|
+
|
774
|
+
return removeAnchors(text);
|
775
|
+
};
|
776
|
+
|
777
|
+
// Process the contents of a single definition list, splitting it
|
778
|
+
// into individual term and definition list items.
|
779
|
+
Markdown.Extra.prototype.processDefListItems = function(listStr) {
|
780
|
+
var self = this;
|
781
|
+
|
782
|
+
var dt = new RegExp(
|
783
|
+
['(\\x02\\n?|\\n\\n+)' , // leading line
|
784
|
+
'(' , // definition terms = $1
|
785
|
+
'[ ]{0,3}' , // leading whitespace
|
786
|
+
'(?![:][ ]|[ ])' , // negative lookahead for a definition
|
787
|
+
// mark (colon) or more whitespace
|
788
|
+
'(?:\\S.*\\n)+?' , // actual term (not whitespace)
|
789
|
+
')' ,
|
790
|
+
'(?=\\n?[ ]{0,3}:[ ])' // lookahead for following line feed
|
791
|
+
].join(''), // with a definition mark
|
792
|
+
'gm'
|
793
|
+
);
|
794
|
+
|
795
|
+
var dd = new RegExp(
|
796
|
+
['\\n(\\n+)?' , // leading line = $1
|
797
|
+
'(' , // marker space = $2
|
798
|
+
'[ ]{0,3}' , // whitespace before colon
|
799
|
+
'[:][ ]+' , // definition mark (colon)
|
800
|
+
')' ,
|
801
|
+
'([\\s\\S]+?)' , // definition text = $3
|
802
|
+
'(?=\\n*' , // stop at next definition mark,
|
803
|
+
'(?:' , // next term or end of text
|
804
|
+
'\\n[ ]{0,3}[:][ ]|' ,
|
805
|
+
'<dt>|\\x03' , // \z
|
806
|
+
')' ,
|
807
|
+
')'
|
808
|
+
].join(''),
|
809
|
+
'gm'
|
810
|
+
);
|
811
|
+
|
812
|
+
listStr = addAnchors(listStr);
|
813
|
+
// trim trailing blank lines:
|
814
|
+
listStr = listStr.replace(/\n{2,}(?=\\x03)/, "\n");
|
815
|
+
|
816
|
+
// Process definition terms.
|
817
|
+
listStr = listStr.replace(dt, function(match, pre, termsStr) {
|
818
|
+
var terms = trim(termsStr).split("\n");
|
819
|
+
var text = '';
|
820
|
+
for (var i = 0; i < terms.length; i++) {
|
821
|
+
var term = terms[i];
|
822
|
+
// process spans inside dt
|
823
|
+
term = convertSpans(trim(term), self);
|
824
|
+
text += "\n<dt>" + term + "</dt>";
|
825
|
+
}
|
826
|
+
return text + "\n";
|
827
|
+
});
|
828
|
+
|
829
|
+
// Process actual definitions.
|
830
|
+
listStr = listStr.replace(dd, function(match, leadingLine, markerSpace, def) {
|
831
|
+
if (leadingLine || def.match(/\n{2,}/)) {
|
832
|
+
// replace marker with the appropriate whitespace indentation
|
833
|
+
def = Array(markerSpace.length + 1).join(' ') + def;
|
834
|
+
// process markdown inside definition
|
835
|
+
// TODO?: currently doesn't apply extensions
|
836
|
+
def = outdent(def) + "\n\n";
|
837
|
+
def = "\n" + convertAll(def, self) + "\n";
|
838
|
+
} else {
|
839
|
+
// convert span-level markdown inside definition
|
840
|
+
def = rtrim(def);
|
841
|
+
def = convertSpans(outdent(def), self);
|
842
|
+
}
|
843
|
+
|
844
|
+
return "\n<dd>" + def + "</dd>\n";
|
845
|
+
});
|
846
|
+
|
847
|
+
return removeAnchors(listStr);
|
848
|
+
};
|
849
|
+
|
850
|
+
|
851
|
+
/***********************************************************
|
852
|
+
* Strikethrough *
|
853
|
+
************************************************************/
|
854
|
+
|
855
|
+
Markdown.Extra.prototype.strikethrough = function(text) {
|
856
|
+
// Pretty much duplicated from _DoItalicsAndBold
|
857
|
+
return text.replace(/([\W_]|^)~T~T(?=\S)([^\r]*?\S[\*_]*)~T~T([\W_]|$)/g,
|
858
|
+
"$1<del>$2</del>$3");
|
859
|
+
};
|
860
|
+
|
861
|
+
|
862
|
+
/***********************************************************
|
863
|
+
* New lines *
|
864
|
+
************************************************************/
|
865
|
+
|
866
|
+
Markdown.Extra.prototype.newlines = function(text) {
|
867
|
+
// We have to ignore already converted newlines and line breaks in sub-list items
|
868
|
+
return text.replace(/(<(?:br|\/li)>)?\n/g, function(wholeMatch, previousTag) {
|
869
|
+
return previousTag ? wholeMatch : " <br>\n";
|
870
|
+
});
|
871
|
+
};
|
872
|
+
|
873
|
+
})();
|
874
|
+
|