ad2games-ui_components 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/Rakefile +28 -0
- data/app/assets/javascripts/ui_components.js.erb +26 -0
- data/app/assets/javascripts/ui_components/chosen_init.coffee +9 -0
- data/app/assets/javascripts/ui_components/domchange.coffee +1 -0
- data/app/assets/javascripts/ui_components/hide_empty_dropdowns.coffee +4 -0
- data/app/assets/javascripts/ui_components/modal.coffee +1 -0
- data/app/assets/javascripts/ui_components/navbar.coffee +2 -0
- data/app/assets/javascripts/ui_components/sticky_header.coffee +24 -0
- data/app/assets/javascripts/ui_components/submit_on_change.coffee +3 -0
- data/app/assets/javascripts/ui_components/turbolinks_progressbar.coffee +2 -0
- data/app/assets/stylesheets/a2g_ui_components.scss +8 -0
- data/app/assets/stylesheets/default_theme/button.scss +160 -0
- data/app/assets/stylesheets/default_theme/common.scss +15 -0
- data/app/assets/stylesheets/default_theme/footer.scss +7 -0
- data/app/assets/stylesheets/default_theme/form.scss +72 -0
- data/app/assets/stylesheets/default_theme/navbar.scss +55 -0
- data/app/assets/stylesheets/default_theme/table.scss +68 -0
- data/app/assets/stylesheets/default_theme/toolbar.scss +117 -0
- data/app/assets/stylesheets/libs.scss +6 -0
- data/app/assets/stylesheets/ui_components.scss.erb +15 -0
- data/app/assets/stylesheets/ui_components/checkbox_list.scss +11 -0
- data/app/assets/stylesheets/ui_components/date_range.scss +5 -0
- data/app/assets/stylesheets/ui_components/markdown_textarea.scss +7 -0
- data/app/assets/stylesheets/variables.scss +893 -0
- data/app/cells/checkbox_list/checkbox_list.yml +7 -0
- data/app/cells/checkbox_list/checkbox_list_cell.rb +33 -0
- data/app/cells/datagrid_filter/datagrid_filter.yml +14 -0
- data/app/cells/datagrid_filter/datagrid_filter_cell.rb +35 -0
- data/app/cells/date_range/date_range.coffee +69 -0
- data/app/cells/date_range/date_range.yml +7 -0
- data/app/cells/date_range/date_range_cell.rb +55 -0
- data/app/cells/form_cell_base.rb +26 -0
- data/app/cells/hello_world/hello_world.slim +1 -0
- data/app/cells/hello_world/hello_world.yml +5 -0
- data/app/cells/hello_world/hello_world_cell.rb +4 -0
- data/app/cells/markdown_readonly/markdown_readonly.coffee +5 -0
- data/app/cells/markdown_readonly/markdown_readonly.slim +1 -0
- data/app/cells/markdown_readonly/markdown_readonly.yml +4 -0
- data/app/cells/markdown_readonly/markdown_readonly_cell.rb +4 -0
- data/app/cells/markdown_textarea/markdown_textarea.coffee +9 -0
- data/app/cells/markdown_textarea/markdown_textarea.slim +9 -0
- data/app/cells/markdown_textarea/markdown_textarea.yml +8 -0
- data/app/cells/markdown_textarea/markdown_textarea_cell.rb +42 -0
- data/app/cells/modal/modal.coffee +2 -0
- data/app/cells/modal/modal.slim +12 -0
- data/app/cells/modal/modal.yml +22 -0
- data/app/cells/modal/modal_cell.rb +31 -0
- data/app/cells/select/select.coffee +35 -0
- data/app/cells/select/select.yml +14 -0
- data/app/cells/select/select_cell.rb +59 -0
- data/app/helpers/ui_components/view_helper.rb +8 -0
- data/lib/generators/generate_component.thor +32 -0
- data/lib/tasks/styleguide.rake +8 -0
- data/lib/ui_components.rb +14 -0
- data/lib/ui_components/cell.rb +16 -0
- data/lib/ui_components/cell_attributes.rb +49 -0
- data/lib/ui_components/docu_cop.rb +31 -0
- data/lib/ui_components/engine.rb +26 -0
- data/lib/ui_components/form_helper.rb +32 -0
- data/lib/ui_components/templates/cell.tt +2 -0
- data/lib/ui_components/templates/coffee.tt +0 -0
- data/lib/ui_components/templates/config.tt +9 -0
- data/lib/ui_components/templates/sass.tt +0 -0
- data/lib/ui_components/templates/view.tt +0 -0
- data/vendor/assets/bower_components/ajax-chosen/CHANGELOG.md +10 -0
- data/vendor/assets/bower_components/ajax-chosen/Cakefile +93 -0
- data/vendor/assets/bower_components/ajax-chosen/Makefile +2 -0
- data/vendor/assets/bower_components/ajax-chosen/README.md +131 -0
- data/vendor/assets/bower_components/ajax-chosen/VERSION +1 -0
- data/vendor/assets/bower_components/ajax-chosen/bower.json +23 -0
- data/vendor/assets/bower_components/ajax-chosen/data.json +57 -0
- data/vendor/assets/bower_components/ajax-chosen/docs/ajax-chosen.html +71 -0
- data/vendor/assets/bower_components/ajax-chosen/docs/docco.css +186 -0
- data/vendor/assets/bower_components/ajax-chosen/index.html +47 -0
- data/vendor/assets/bower_components/ajax-chosen/lib/ajax-chosen.js +159 -0
- data/vendor/assets/bower_components/ajax-chosen/lib/ajax-chosen.min.js +17 -0
- data/vendor/assets/bower_components/ajax-chosen/package.json +18 -0
- data/vendor/assets/bower_components/ajax-chosen/src/ajax-chosen.coffee +183 -0
- data/vendor/assets/bower_components/bootstrap-chosen/README.md +29 -0
- data/vendor/assets/bower_components/bootstrap-chosen/bootstrap-chosen-variables.less +24 -0
- data/vendor/assets/bower_components/bootstrap-chosen/bootstrap-chosen-variables.scss +16 -0
- data/vendor/assets/bower_components/bootstrap-chosen/bootstrap-chosen.less +473 -0
- data/vendor/assets/bower_components/bootstrap-chosen/bootstrap-chosen.scss +459 -0
- data/vendor/assets/bower_components/bootstrap-chosen/bower.json +25 -0
- data/vendor/assets/bower_components/bootstrap-chosen/chosen-sprite.png +0 -0
- data/vendor/assets/bower_components/bootstrap-chosen/chosen-sprite@2x.png +0 -0
- data/vendor/assets/bower_components/bootstrap-daterangepicker/README.md +200 -0
- data/vendor/assets/bower_components/bootstrap-daterangepicker/bower.json +20 -0
- data/vendor/assets/bower_components/bootstrap-daterangepicker/daterangepicker-bs2.css +303 -0
- data/vendor/assets/bower_components/bootstrap-daterangepicker/daterangepicker-bs3.css +335 -0
- data/vendor/assets/bower_components/bootstrap-daterangepicker/daterangepicker.js +1348 -0
- data/vendor/assets/bower_components/bootstrap-daterangepicker/examples.html +272 -0
- data/vendor/assets/bower_components/bootstrap-daterangepicker/package.js +18 -0
- data/vendor/assets/bower_components/bootstrap-daterangepicker/package.json +32 -0
- data/vendor/assets/bower_components/chosen/bower.json +50 -0
- data/vendor/assets/bower_components/chosen/chosen-sprite.png +0 -0
- data/vendor/assets/bower_components/chosen/chosen-sprite@2x.png +0 -0
- data/vendor/assets/bower_components/chosen/chosen.css +448 -0
- data/vendor/assets/bower_components/chosen/chosen.jquery.js +1272 -0
- data/vendor/assets/bower_components/highlightjs/LICENSE +24 -0
- data/vendor/assets/bower_components/highlightjs/Makefile +21 -0
- data/vendor/assets/bower_components/highlightjs/README.md +12 -0
- data/vendor/assets/bower_components/highlightjs/bower.json +14 -0
- data/vendor/assets/bower_components/highlightjs/component.json +12 -0
- data/vendor/assets/bower_components/highlightjs/composer.json +26 -0
- data/vendor/assets/bower_components/highlightjs/highlight.pack.js +15263 -0
- data/vendor/assets/bower_components/highlightjs/highlight.pack.min.js +12 -0
- data/vendor/assets/bower_components/highlightjs/package.json +8 -0
- data/vendor/assets/bower_components/highlightjs/styles/agate.css +108 -0
- data/vendor/assets/bower_components/highlightjs/styles/androidstudio.css +66 -0
- data/vendor/assets/bower_components/highlightjs/styles/arduino-light.css +88 -0
- data/vendor/assets/bower_components/highlightjs/styles/arta.css +73 -0
- data/vendor/assets/bower_components/highlightjs/styles/ascetic.css +45 -0
- data/vendor/assets/bower_components/highlightjs/styles/atelier-cave-dark.css +83 -0
- data/vendor/assets/bower_components/highlightjs/styles/atelier-cave-light.css +85 -0
- data/vendor/assets/bower_components/highlightjs/styles/atelier-cave.dark.css +113 -0
- data/vendor/assets/bower_components/highlightjs/styles/atelier-cave.light.css +113 -0
- data/vendor/assets/bower_components/highlightjs/styles/atelier-dune-dark.css +69 -0
- data/vendor/assets/bower_components/highlightjs/styles/atelier-dune-light.css +69 -0
- data/vendor/assets/bower_components/highlightjs/styles/atelier-dune.dark.css +94 -0
- data/vendor/assets/bower_components/highlightjs/styles/atelier-dune.light.css +94 -0
- data/vendor/assets/bower_components/highlightjs/styles/atelier-estuary-dark.css +84 -0
- data/vendor/assets/bower_components/highlightjs/styles/atelier-estuary-light.css +84 -0
- data/vendor/assets/bower_components/highlightjs/styles/atelier-estuary.dark.css +113 -0
- data/vendor/assets/bower_components/highlightjs/styles/atelier-estuary.light.css +113 -0
- data/vendor/assets/bower_components/highlightjs/styles/atelier-forest-dark.css +69 -0
- data/vendor/assets/bower_components/highlightjs/styles/atelier-forest-light.css +69 -0
- data/vendor/assets/bower_components/highlightjs/styles/atelier-forest.dark.css +94 -0
- data/vendor/assets/bower_components/highlightjs/styles/atelier-forest.light.css +94 -0
- data/vendor/assets/bower_components/highlightjs/styles/atelier-heath-dark.css +69 -0
- data/vendor/assets/bower_components/highlightjs/styles/atelier-heath-light.css +69 -0
- data/vendor/assets/bower_components/highlightjs/styles/atelier-heath.dark.css +94 -0
- data/vendor/assets/bower_components/highlightjs/styles/atelier-heath.light.css +94 -0
- data/vendor/assets/bower_components/highlightjs/styles/atelier-lakeside-dark.css +69 -0
- data/vendor/assets/bower_components/highlightjs/styles/atelier-lakeside-light.css +69 -0
- data/vendor/assets/bower_components/highlightjs/styles/atelier-lakeside.dark.css +94 -0
- data/vendor/assets/bower_components/highlightjs/styles/atelier-lakeside.light.css +94 -0
- data/vendor/assets/bower_components/highlightjs/styles/atelier-plateau-dark.css +84 -0
- data/vendor/assets/bower_components/highlightjs/styles/atelier-plateau-light.css +84 -0
- data/vendor/assets/bower_components/highlightjs/styles/atelier-plateau.dark.css +113 -0
- data/vendor/assets/bower_components/highlightjs/styles/atelier-plateau.light.css +113 -0
- data/vendor/assets/bower_components/highlightjs/styles/atelier-savanna-dark.css +84 -0
- data/vendor/assets/bower_components/highlightjs/styles/atelier-savanna-light.css +84 -0
- data/vendor/assets/bower_components/highlightjs/styles/atelier-savanna.dark.css +113 -0
- data/vendor/assets/bower_components/highlightjs/styles/atelier-savanna.light.css +113 -0
- data/vendor/assets/bower_components/highlightjs/styles/atelier-seaside-dark.css +69 -0
- data/vendor/assets/bower_components/highlightjs/styles/atelier-seaside-light.css +69 -0
- data/vendor/assets/bower_components/highlightjs/styles/atelier-seaside.dark.css +94 -0
- data/vendor/assets/bower_components/highlightjs/styles/atelier-seaside.light.css +94 -0
- data/vendor/assets/bower_components/highlightjs/styles/atelier-sulphurpool-dark.css +69 -0
- data/vendor/assets/bower_components/highlightjs/styles/atelier-sulphurpool-light.css +69 -0
- data/vendor/assets/bower_components/highlightjs/styles/atelier-sulphurpool.dark.css +94 -0
- data/vendor/assets/bower_components/highlightjs/styles/atelier-sulphurpool.light.css +94 -0
- data/vendor/assets/bower_components/highlightjs/styles/brown-paper.css +64 -0
- data/vendor/assets/bower_components/highlightjs/styles/brown-papersq.png +0 -0
- data/vendor/assets/bower_components/highlightjs/styles/brown_paper.css +103 -0
- data/vendor/assets/bower_components/highlightjs/styles/brown_papersq.png +0 -0
- data/vendor/assets/bower_components/highlightjs/styles/codepen-embed.css +60 -0
- data/vendor/assets/bower_components/highlightjs/styles/color-brewer.css +71 -0
- data/vendor/assets/bower_components/highlightjs/styles/dark.css +63 -0
- data/vendor/assets/bower_components/highlightjs/styles/darkula.css +74 -0
- data/vendor/assets/bower_components/highlightjs/styles/default.css +99 -0
- data/vendor/assets/bower_components/highlightjs/styles/docco.css +97 -0
- data/vendor/assets/bower_components/highlightjs/styles/dracula.css +76 -0
- data/vendor/assets/bower_components/highlightjs/styles/far.css +71 -0
- data/vendor/assets/bower_components/highlightjs/styles/foundation.css +88 -0
- data/vendor/assets/bower_components/highlightjs/styles/github-gist.css +71 -0
- data/vendor/assets/bower_components/highlightjs/styles/github.css +99 -0
- data/vendor/assets/bower_components/highlightjs/styles/googlecode.css +89 -0
- data/vendor/assets/bower_components/highlightjs/styles/grayscale.css +101 -0
- data/vendor/assets/bower_components/highlightjs/styles/gruvbox-dark.css +108 -0
- data/vendor/assets/bower_components/highlightjs/styles/gruvbox-light.css +108 -0
- data/vendor/assets/bower_components/highlightjs/styles/hopscotch.css +83 -0
- data/vendor/assets/bower_components/highlightjs/styles/hybrid.css +102 -0
- data/vendor/assets/bower_components/highlightjs/styles/idea.css +97 -0
- data/vendor/assets/bower_components/highlightjs/styles/ir-black.css +73 -0
- data/vendor/assets/bower_components/highlightjs/styles/ir_black.css +106 -0
- data/vendor/assets/bower_components/highlightjs/styles/kimbie.dark.css +74 -0
- data/vendor/assets/bower_components/highlightjs/styles/kimbie.light.css +74 -0
- data/vendor/assets/bower_components/highlightjs/styles/magula.css +70 -0
- data/vendor/assets/bower_components/highlightjs/styles/mono-blue.css +59 -0
- data/vendor/assets/bower_components/highlightjs/styles/monokai-sublime.css +83 -0
- data/vendor/assets/bower_components/highlightjs/styles/monokai.css +70 -0
- data/vendor/assets/bower_components/highlightjs/styles/monokai_sublime.css +154 -0
- data/vendor/assets/bower_components/highlightjs/styles/obsidian.css +88 -0
- data/vendor/assets/bower_components/highlightjs/styles/paraiso-dark.css +72 -0
- data/vendor/assets/bower_components/highlightjs/styles/paraiso-light.css +72 -0
- data/vendor/assets/bower_components/highlightjs/styles/paraiso.dark.css +96 -0
- data/vendor/assets/bower_components/highlightjs/styles/paraiso.light.css +96 -0
- data/vendor/assets/bower_components/highlightjs/styles/pojoaque.css +83 -0
- data/vendor/assets/bower_components/highlightjs/styles/pojoaque.jpg +0 -0
- data/vendor/assets/bower_components/highlightjs/styles/qtcreator_dark.css +83 -0
- data/vendor/assets/bower_components/highlightjs/styles/qtcreator_light.css +83 -0
- data/vendor/assets/bower_components/highlightjs/styles/railscasts.css +106 -0
- data/vendor/assets/bower_components/highlightjs/styles/rainbow.css +85 -0
- data/vendor/assets/bower_components/highlightjs/styles/school-book.css +72 -0
- data/vendor/assets/bower_components/highlightjs/styles/school-book.png +0 -0
- data/vendor/assets/bower_components/highlightjs/styles/school_book.css +111 -0
- data/vendor/assets/bower_components/highlightjs/styles/school_book.png +0 -0
- data/vendor/assets/bower_components/highlightjs/styles/solarized-dark.css +84 -0
- data/vendor/assets/bower_components/highlightjs/styles/solarized-light.css +84 -0
- data/vendor/assets/bower_components/highlightjs/styles/solarized_dark.css +107 -0
- data/vendor/assets/bower_components/highlightjs/styles/solarized_light.css +107 -0
- data/vendor/assets/bower_components/highlightjs/styles/sunburst.css +102 -0
- data/vendor/assets/bower_components/highlightjs/styles/tomorrow-night-blue.css +75 -0
- data/vendor/assets/bower_components/highlightjs/styles/tomorrow-night-bright.css +74 -0
- data/vendor/assets/bower_components/highlightjs/styles/tomorrow-night-eighties.css +74 -0
- data/vendor/assets/bower_components/highlightjs/styles/tomorrow-night.css +75 -0
- data/vendor/assets/bower_components/highlightjs/styles/tomorrow.css +72 -0
- data/vendor/assets/bower_components/highlightjs/styles/vs.css +68 -0
- data/vendor/assets/bower_components/highlightjs/styles/xcode.css +93 -0
- data/vendor/assets/bower_components/highlightjs/styles/zenburn.css +80 -0
- data/vendor/assets/bower_components/jquery.floatThead/CONTRIBUTING.md +33 -0
- data/vendor/assets/bower_components/jquery.floatThead/README.md +285 -0
- data/vendor/assets/bower_components/jquery.floatThead/bower.json +34 -0
- data/vendor/assets/bower_components/jquery.floatThead/dist/jquery.floatThead-slim.js +899 -0
- data/vendor/assets/bower_components/jquery.floatThead/dist/jquery.floatThead-slim.min.js +3 -0
- data/vendor/assets/bower_components/jquery.floatThead/dist/jquery.floatThead.js +964 -0
- data/vendor/assets/bower_components/jquery.floatThead/dist/jquery.floatThead.min.js +3 -0
- data/vendor/assets/bower_components/jquery.floatThead/license.txt +21 -0
- data/vendor/assets/bower_components/jquery/AUTHORS.txt +278 -0
- data/vendor/assets/bower_components/jquery/LICENSE.txt +36 -0
- data/vendor/assets/bower_components/jquery/README.md +65 -0
- data/vendor/assets/bower_components/jquery/bower.json +14 -0
- data/vendor/assets/bower_components/jquery/dist/jquery.js +9842 -0
- data/vendor/assets/bower_components/jquery/dist/jquery.min.js +4 -0
- data/vendor/assets/bower_components/jquery/dist/jquery.min.map +1 -0
- data/vendor/assets/bower_components/jquery/dist/jquery.slim.js +7877 -0
- data/vendor/assets/bower_components/jquery/dist/jquery.slim.min.js +4 -0
- data/vendor/assets/bower_components/jquery/dist/jquery.slim.min.map +1 -0
- data/vendor/assets/bower_components/jquery/sizzle/LICENSE.txt +36 -0
- data/vendor/assets/bower_components/jquery/sizzle/dist/sizzle.js +2143 -0
- data/vendor/assets/bower_components/jquery/sizzle/dist/sizzle.min.js +3 -0
- data/vendor/assets/bower_components/jquery/sizzle/dist/sizzle.min.map +1 -0
- data/vendor/assets/bower_components/jquery/src/ajax.js +845 -0
- data/vendor/assets/bower_components/jquery/src/ajax/jsonp.js +100 -0
- data/vendor/assets/bower_components/jquery/src/ajax/load.js +83 -0
- data/vendor/assets/bower_components/jquery/src/ajax/parseJSON.js +13 -0
- data/vendor/assets/bower_components/jquery/src/ajax/parseXML.js +27 -0
- data/vendor/assets/bower_components/jquery/src/ajax/script.js +68 -0
- data/vendor/assets/bower_components/jquery/src/ajax/var/location.js +3 -0
- data/vendor/assets/bower_components/jquery/src/ajax/var/nonce.js +5 -0
- data/vendor/assets/bower_components/jquery/src/ajax/var/rquery.js +3 -0
- data/vendor/assets/bower_components/jquery/src/ajax/xhr.js +167 -0
- data/vendor/assets/bower_components/jquery/src/attributes.js +11 -0
- data/vendor/assets/bower_components/jquery/src/attributes/attr.js +142 -0
- data/vendor/assets/bower_components/jquery/src/attributes/classes.js +177 -0
- data/vendor/assets/bower_components/jquery/src/attributes/prop.js +125 -0
- data/vendor/assets/bower_components/jquery/src/attributes/support.js +36 -0
- data/vendor/assets/bower_components/jquery/src/attributes/val.js +177 -0
- data/vendor/assets/bower_components/jquery/src/callbacks.js +232 -0
- data/vendor/assets/bower_components/jquery/src/core.js +494 -0
- data/vendor/assets/bower_components/jquery/src/core/DOMEval.js +14 -0
- data/vendor/assets/bower_components/jquery/src/core/access.js +65 -0
- data/vendor/assets/bower_components/jquery/src/core/init.js +134 -0
- data/vendor/assets/bower_components/jquery/src/core/parseHTML.js +41 -0
- data/vendor/assets/bower_components/jquery/src/core/ready.js +103 -0
- data/vendor/assets/bower_components/jquery/src/core/support.js +18 -0
- data/vendor/assets/bower_components/jquery/src/core/var/rsingleTag.js +5 -0
- data/vendor/assets/bower_components/jquery/src/css.js +515 -0
- data/vendor/assets/bower_components/jquery/src/css/addGetHookIf.js +24 -0
- data/vendor/assets/bower_components/jquery/src/css/adjustCSS.js +65 -0
- data/vendor/assets/bower_components/jquery/src/css/curCSS.js +60 -0
- data/vendor/assets/bower_components/jquery/src/css/defaultDisplay.js +72 -0
- data/vendor/assets/bower_components/jquery/src/css/hiddenVisibleSelectors.js +18 -0
- data/vendor/assets/bower_components/jquery/src/css/showHide.js +48 -0
- data/vendor/assets/bower_components/jquery/src/css/support.js +121 -0
- data/vendor/assets/bower_components/jquery/src/css/var/cssExpand.js +3 -0
- data/vendor/assets/bower_components/jquery/src/css/var/getStyles.js +15 -0
- data/vendor/assets/bower_components/jquery/src/css/var/isHidden.js +16 -0
- data/vendor/assets/bower_components/jquery/src/css/var/rmargin.js +3 -0
- data/vendor/assets/bower_components/jquery/src/css/var/rnumnonpx.js +5 -0
- data/vendor/assets/bower_components/jquery/src/css/var/swap.js +24 -0
- data/vendor/assets/bower_components/jquery/src/data.js +187 -0
- data/vendor/assets/bower_components/jquery/src/data/Data.js +200 -0
- data/vendor/assets/bower_components/jquery/src/data/accepts.js +20 -0
- data/vendor/assets/bower_components/jquery/src/data/support.js +23 -0
- data/vendor/assets/bower_components/jquery/src/data/var/acceptData.js +18 -0
- data/vendor/assets/bower_components/jquery/src/data/var/dataPriv.js +5 -0
- data/vendor/assets/bower_components/jquery/src/data/var/dataUser.js +5 -0
- data/vendor/assets/bower_components/jquery/src/deferred.js +158 -0
- data/vendor/assets/bower_components/jquery/src/deferred/exceptionHook.js +19 -0
- data/vendor/assets/bower_components/jquery/src/deprecated.js +32 -0
- data/vendor/assets/bower_components/jquery/src/dimensions.js +54 -0
- data/vendor/assets/bower_components/jquery/src/effects.js +629 -0
- data/vendor/assets/bower_components/jquery/src/effects/Tween.js +121 -0
- data/vendor/assets/bower_components/jquery/src/effects/animatedSelector.js +13 -0
- data/vendor/assets/bower_components/jquery/src/effects/support.js +58 -0
- data/vendor/assets/bower_components/jquery/src/event.js +710 -0
- data/vendor/assets/bower_components/jquery/src/event/ajax.js +20 -0
- data/vendor/assets/bower_components/jquery/src/event/alias.js +27 -0
- data/vendor/assets/bower_components/jquery/src/event/focusin.js +53 -0
- data/vendor/assets/bower_components/jquery/src/event/support.js +9 -0
- data/vendor/assets/bower_components/jquery/src/event/trigger.js +199 -0
- data/vendor/assets/bower_components/jquery/src/exports/amd.js +24 -0
- data/vendor/assets/bower_components/jquery/src/exports/global.js +26 -0
- data/vendor/assets/bower_components/jquery/src/intro.js +44 -0
- data/vendor/assets/bower_components/jquery/src/jquery.js +37 -0
- data/vendor/assets/bower_components/jquery/src/manipulation.js +481 -0
- data/vendor/assets/bower_components/jquery/src/manipulation/_evalUrl.js +20 -0
- data/vendor/assets/bower_components/jquery/src/manipulation/buildFragment.js +102 -0
- data/vendor/assets/bower_components/jquery/src/manipulation/createSafeFragment.js +20 -0
- data/vendor/assets/bower_components/jquery/src/manipulation/getAll.js +21 -0
- data/vendor/assets/bower_components/jquery/src/manipulation/setGlobalEval.js +20 -0
- data/vendor/assets/bower_components/jquery/src/manipulation/support.js +33 -0
- data/vendor/assets/bower_components/jquery/src/manipulation/var/nodeNames.js +5 -0
- data/vendor/assets/bower_components/jquery/src/manipulation/var/rcheckableType.js +3 -0
- data/vendor/assets/bower_components/jquery/src/manipulation/var/rleadingWhitespace.js +3 -0
- data/vendor/assets/bower_components/jquery/src/manipulation/var/rscriptType.js +3 -0
- data/vendor/assets/bower_components/jquery/src/manipulation/var/rtagName.js +3 -0
- data/vendor/assets/bower_components/jquery/src/manipulation/wrapMap.js +27 -0
- data/vendor/assets/bower_components/jquery/src/offset.js +218 -0
- data/vendor/assets/bower_components/jquery/src/outro.js +2 -0
- data/vendor/assets/bower_components/jquery/src/queue.js +143 -0
- data/vendor/assets/bower_components/jquery/src/queue/delay.js +22 -0
- data/vendor/assets/bower_components/jquery/src/selector-native.js +211 -0
- data/vendor/assets/bower_components/jquery/src/selector-sizzle.js +14 -0
- data/vendor/assets/bower_components/jquery/src/selector.js +1 -0
- data/vendor/assets/bower_components/jquery/src/serialize.js +125 -0
- data/vendor/assets/bower_components/jquery/src/support.js +63 -0
- data/vendor/assets/bower_components/jquery/src/traversing.js +175 -0
- data/vendor/assets/bower_components/jquery/src/traversing/findFilter.js +100 -0
- data/vendor/assets/bower_components/jquery/src/traversing/var/dir.js +20 -0
- data/vendor/assets/bower_components/jquery/src/traversing/var/rneedsContext.js +6 -0
- data/vendor/assets/bower_components/jquery/src/traversing/var/siblings.js +15 -0
- data/vendor/assets/bower_components/jquery/src/var/arr.js +3 -0
- data/vendor/assets/bower_components/jquery/src/var/class2type.js +5 -0
- data/vendor/assets/bower_components/jquery/src/var/concat.js +5 -0
- data/vendor/assets/bower_components/jquery/src/var/deletedIds.js +3 -0
- data/vendor/assets/bower_components/jquery/src/var/document.js +3 -0
- data/vendor/assets/bower_components/jquery/src/var/documentElement.js +5 -0
- data/vendor/assets/bower_components/jquery/src/var/hasOwn.js +5 -0
- data/vendor/assets/bower_components/jquery/src/var/indexOf.js +5 -0
- data/vendor/assets/bower_components/jquery/src/var/pnum.js +3 -0
- data/vendor/assets/bower_components/jquery/src/var/push.js +5 -0
- data/vendor/assets/bower_components/jquery/src/var/rcssNum.js +7 -0
- data/vendor/assets/bower_components/jquery/src/var/rnotwhite.js +3 -0
- data/vendor/assets/bower_components/jquery/src/var/slice.js +5 -0
- data/vendor/assets/bower_components/jquery/src/var/support.js +5 -0
- data/vendor/assets/bower_components/jquery/src/var/toString.js +5 -0
- data/vendor/assets/bower_components/jquery/src/wrap.js +79 -0
- data/vendor/assets/bower_components/marked/Gulpfile.js +22 -0
- data/vendor/assets/bower_components/marked/LICENSE +19 -0
- data/vendor/assets/bower_components/marked/Makefile +12 -0
- data/vendor/assets/bower_components/marked/README.md +406 -0
- data/vendor/assets/bower_components/marked/bin/marked +187 -0
- data/vendor/assets/bower_components/marked/bower.json +24 -0
- data/vendor/assets/bower_components/marked/component.json +10 -0
- data/vendor/assets/bower_components/marked/doc/broken.md +426 -0
- data/vendor/assets/bower_components/marked/doc/todo.md +2 -0
- data/vendor/assets/bower_components/marked/index.js +1 -0
- data/vendor/assets/bower_components/marked/lib/marked.js +1285 -0
- data/vendor/assets/bower_components/marked/man/marked.1 +91 -0
- data/vendor/assets/bower_components/marked/marked.min.js +6 -0
- data/vendor/assets/bower_components/marked/package.json +24 -0
- data/vendor/assets/bower_components/moment/CHANGELOG.md +423 -0
- data/vendor/assets/bower_components/moment/LICENSE +22 -0
- data/vendor/assets/bower_components/moment/Moment.js.nuspec +28 -0
- data/vendor/assets/bower_components/moment/README.md +39 -0
- data/vendor/assets/bower_components/moment/benchmarks/clone.js +10 -0
- data/vendor/assets/bower_components/moment/bower.json +20 -0
- data/vendor/assets/bower_components/moment/locale/af.js +71 -0
- data/vendor/assets/bower_components/moment/locale/ar-ma.js +57 -0
- data/vendor/assets/bower_components/moment/locale/ar-sa.js +101 -0
- data/vendor/assets/bower_components/moment/locale/ar-tn.js +55 -0
- data/vendor/assets/bower_components/moment/locale/ar.js +134 -0
- data/vendor/assets/bower_components/moment/locale/az.js +107 -0
- data/vendor/assets/bower_components/moment/locale/be.js +154 -0
- data/vendor/assets/bower_components/moment/locale/bg.js +88 -0
- data/vendor/assets/bower_components/moment/locale/bn.js +111 -0
- data/vendor/assets/bower_components/moment/locale/bo.js +108 -0
- data/vendor/assets/bower_components/moment/locale/br.js +109 -0
- data/vendor/assets/bower_components/moment/locale/bs.js +140 -0
- data/vendor/assets/bower_components/moment/locale/ca.js +77 -0
- data/vendor/assets/bower_components/moment/locale/cs.js +157 -0
- data/vendor/assets/bower_components/moment/locale/cv.js +61 -0
- data/vendor/assets/bower_components/moment/locale/cy.js +79 -0
- data/vendor/assets/bower_components/moment/locale/da.js +58 -0
- data/vendor/assets/bower_components/moment/locale/de-at.js +74 -0
- data/vendor/assets/bower_components/moment/locale/de.js +73 -0
- data/vendor/assets/bower_components/moment/locale/el.js +94 -0
- data/vendor/assets/bower_components/moment/locale/en-au.js +64 -0
- data/vendor/assets/bower_components/moment/locale/en-ca.js +61 -0
- data/vendor/assets/bower_components/moment/locale/en-gb.js +65 -0
- data/vendor/assets/bower_components/moment/locale/eo.js +71 -0
- data/vendor/assets/bower_components/moment/locale/es.js +77 -0
- data/vendor/assets/bower_components/moment/locale/et.js +78 -0
- data/vendor/assets/bower_components/moment/locale/eu.js +62 -0
- data/vendor/assets/bower_components/moment/locale/fa.js +103 -0
- data/vendor/assets/bower_components/moment/locale/fi.js +107 -0
- data/vendor/assets/bower_components/moment/locale/fo.js +58 -0
- data/vendor/assets/bower_components/moment/locale/fr-ca.js +56 -0
- data/vendor/assets/bower_components/moment/locale/fr.js +60 -0
- data/vendor/assets/bower_components/moment/locale/fy.js +69 -0
- data/vendor/assets/bower_components/moment/locale/gl.js +73 -0
- data/vendor/assets/bower_components/moment/locale/he.js +80 -0
- data/vendor/assets/bower_components/moment/locale/hi.js +121 -0
- data/vendor/assets/bower_components/moment/locale/hr.js +141 -0
- data/vendor/assets/bower_components/moment/locale/hu.js +111 -0
- data/vendor/assets/bower_components/moment/locale/hy-am.js +118 -0
- data/vendor/assets/bower_components/moment/locale/id.js +81 -0
- data/vendor/assets/bower_components/moment/locale/is.js +126 -0
- data/vendor/assets/bower_components/moment/locale/it.js +68 -0
- data/vendor/assets/bower_components/moment/locale/ja.js +63 -0
- data/vendor/assets/bower_components/moment/locale/ka.js +109 -0
- data/vendor/assets/bower_components/moment/locale/km.js +56 -0
- data/vendor/assets/bower_components/moment/locale/ko.js +65 -0
- data/vendor/assets/bower_components/moment/locale/lb.js +139 -0
- data/vendor/assets/bower_components/moment/locale/lt.js +120 -0
- data/vendor/assets/bower_components/moment/locale/lv.js +79 -0
- data/vendor/assets/bower_components/moment/locale/mk.js +88 -0
- data/vendor/assets/bower_components/moment/locale/ml.js +69 -0
- data/vendor/assets/bower_components/moment/locale/mr.js +120 -0
- data/vendor/assets/bower_components/moment/locale/ms-my.js +80 -0
- data/vendor/assets/bower_components/moment/locale/my.js +89 -0
- data/vendor/assets/bower_components/moment/locale/nb.js +59 -0
- data/vendor/assets/bower_components/moment/locale/ne.js +121 -0
- data/vendor/assets/bower_components/moment/locale/nl.js +69 -0
- data/vendor/assets/bower_components/moment/locale/nn.js +58 -0
- data/vendor/assets/bower_components/moment/locale/pl.js +100 -0
- data/vendor/assets/bower_components/moment/locale/pt-br.js +58 -0
- data/vendor/assets/bower_components/moment/locale/pt.js +62 -0
- data/vendor/assets/bower_components/moment/locale/ro.js +73 -0
- data/vendor/assets/bower_components/moment/locale/ru.js +176 -0
- data/vendor/assets/bower_components/moment/locale/sk.js +158 -0
- data/vendor/assets/bower_components/moment/locale/sl.js +146 -0
- data/vendor/assets/bower_components/moment/locale/sq.js +67 -0
- data/vendor/assets/bower_components/moment/locale/sr-cyrl.js +107 -0
- data/vendor/assets/bower_components/moment/locale/sr.js +107 -0
- data/vendor/assets/bower_components/moment/locale/sv.js +65 -0
- data/vendor/assets/bower_components/moment/locale/ta.js +130 -0
- data/vendor/assets/bower_components/moment/locale/th.js +63 -0
- data/vendor/assets/bower_components/moment/locale/tl-ph.js +60 -0
- data/vendor/assets/bower_components/moment/locale/tr.js +94 -0
- data/vendor/assets/bower_components/moment/locale/tzm-latn.js +56 -0
- data/vendor/assets/bower_components/moment/locale/tzm.js +56 -0
- data/vendor/assets/bower_components/moment/locale/uk.js +163 -0
- data/vendor/assets/bower_components/moment/locale/uz.js +56 -0
- data/vendor/assets/bower_components/moment/locale/vi.js +64 -0
- data/vendor/assets/bower_components/moment/locale/zh-cn.js +125 -0
- data/vendor/assets/bower_components/moment/locale/zh-tw.js +99 -0
- data/vendor/assets/bower_components/moment/meteor/README.md +25 -0
- data/vendor/assets/bower_components/moment/meteor/export.js +3 -0
- data/vendor/assets/bower_components/moment/meteor/test.js +5 -0
- data/vendor/assets/bower_components/moment/min/locales.js +7306 -0
- data/vendor/assets/bower_components/moment/min/locales.min.js +4 -0
- data/vendor/assets/bower_components/moment/min/moment-with-locales.js +9792 -0
- data/vendor/assets/bower_components/moment/min/moment-with-locales.min.js +10 -0
- data/vendor/assets/bower_components/moment/min/moment.min.js +7 -0
- data/vendor/assets/bower_components/moment/moment.js +3043 -0
- data/vendor/assets/bower_components/moment/scripts/npm_prepublish.sh +43 -0
- data/vendor/assets/bower_components/underscore/LICENSE +23 -0
- data/vendor/assets/bower_components/underscore/README.md +22 -0
- data/vendor/assets/bower_components/underscore/bower.json +7 -0
- data/vendor/assets/bower_components/underscore/underscore-min.js +6 -0
- data/vendor/assets/bower_components/underscore/underscore-min.map +1 -0
- data/vendor/assets/bower_components/underscore/underscore.js +1548 -0
- metadata +782 -0
@@ -0,0 +1 @@
|
|
1
|
+
module.exports = require('./lib/marked');
|
@@ -0,0 +1,1285 @@
|
|
1
|
+
/**
|
2
|
+
* marked - a markdown parser
|
3
|
+
* Copyright (c) 2011-2014, Christopher Jeffrey. (MIT Licensed)
|
4
|
+
* https://github.com/chjj/marked
|
5
|
+
*/
|
6
|
+
|
7
|
+
;(function() {
|
8
|
+
|
9
|
+
/**
|
10
|
+
* Block-Level Grammar
|
11
|
+
*/
|
12
|
+
|
13
|
+
var block = {
|
14
|
+
newline: /^\n+/,
|
15
|
+
code: /^( {4}[^\n]+\n*)+/,
|
16
|
+
fences: noop,
|
17
|
+
hr: /^( *[-*_]){3,} *(?:\n+|$)/,
|
18
|
+
heading: /^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,
|
19
|
+
nptable: noop,
|
20
|
+
lheading: /^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,
|
21
|
+
blockquote: /^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,
|
22
|
+
list: /^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,
|
23
|
+
html: /^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,
|
24
|
+
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,
|
25
|
+
table: noop,
|
26
|
+
paragraph: /^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,
|
27
|
+
text: /^[^\n]+/
|
28
|
+
};
|
29
|
+
|
30
|
+
block.bullet = /(?:[*+-]|\d+\.)/;
|
31
|
+
block.item = /^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/;
|
32
|
+
block.item = replace(block.item, 'gm')
|
33
|
+
(/bull/g, block.bullet)
|
34
|
+
();
|
35
|
+
|
36
|
+
block.list = replace(block.list)
|
37
|
+
(/bull/g, block.bullet)
|
38
|
+
('hr', '\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))')
|
39
|
+
('def', '\\n+(?=' + block.def.source + ')')
|
40
|
+
();
|
41
|
+
|
42
|
+
block.blockquote = replace(block.blockquote)
|
43
|
+
('def', block.def)
|
44
|
+
();
|
45
|
+
|
46
|
+
block._tag = '(?!(?:'
|
47
|
+
+ 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code'
|
48
|
+
+ '|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo'
|
49
|
+
+ '|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b';
|
50
|
+
|
51
|
+
block.html = replace(block.html)
|
52
|
+
('comment', /<!--[\s\S]*?-->/)
|
53
|
+
('closed', /<(tag)[\s\S]+?<\/\1>/)
|
54
|
+
('closing', /<tag(?:"[^"]*"|'[^']*'|[^'">])*?>/)
|
55
|
+
(/tag/g, block._tag)
|
56
|
+
();
|
57
|
+
|
58
|
+
block.paragraph = replace(block.paragraph)
|
59
|
+
('hr', block.hr)
|
60
|
+
('heading', block.heading)
|
61
|
+
('lheading', block.lheading)
|
62
|
+
('blockquote', block.blockquote)
|
63
|
+
('tag', '<' + block._tag)
|
64
|
+
('def', block.def)
|
65
|
+
();
|
66
|
+
|
67
|
+
/**
|
68
|
+
* Normal Block Grammar
|
69
|
+
*/
|
70
|
+
|
71
|
+
block.normal = merge({}, block);
|
72
|
+
|
73
|
+
/**
|
74
|
+
* GFM Block Grammar
|
75
|
+
*/
|
76
|
+
|
77
|
+
block.gfm = merge({}, block.normal, {
|
78
|
+
fences: /^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\s*\1 *(?:\n+|$)/,
|
79
|
+
paragraph: /^/,
|
80
|
+
heading: /^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/
|
81
|
+
});
|
82
|
+
|
83
|
+
block.gfm.paragraph = replace(block.paragraph)
|
84
|
+
('(?!', '(?!'
|
85
|
+
+ block.gfm.fences.source.replace('\\1', '\\2') + '|'
|
86
|
+
+ block.list.source.replace('\\1', '\\3') + '|')
|
87
|
+
();
|
88
|
+
|
89
|
+
/**
|
90
|
+
* GFM + Tables Block Grammar
|
91
|
+
*/
|
92
|
+
|
93
|
+
block.tables = merge({}, block.gfm, {
|
94
|
+
nptable: /^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,
|
95
|
+
table: /^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/
|
96
|
+
});
|
97
|
+
|
98
|
+
/**
|
99
|
+
* Block Lexer
|
100
|
+
*/
|
101
|
+
|
102
|
+
function Lexer(options) {
|
103
|
+
this.tokens = [];
|
104
|
+
this.tokens.links = {};
|
105
|
+
this.options = options || marked.defaults;
|
106
|
+
this.rules = block.normal;
|
107
|
+
|
108
|
+
if (this.options.gfm) {
|
109
|
+
if (this.options.tables) {
|
110
|
+
this.rules = block.tables;
|
111
|
+
} else {
|
112
|
+
this.rules = block.gfm;
|
113
|
+
}
|
114
|
+
}
|
115
|
+
}
|
116
|
+
|
117
|
+
/**
|
118
|
+
* Expose Block Rules
|
119
|
+
*/
|
120
|
+
|
121
|
+
Lexer.rules = block;
|
122
|
+
|
123
|
+
/**
|
124
|
+
* Static Lex Method
|
125
|
+
*/
|
126
|
+
|
127
|
+
Lexer.lex = function(src, options) {
|
128
|
+
var lexer = new Lexer(options);
|
129
|
+
return lexer.lex(src);
|
130
|
+
};
|
131
|
+
|
132
|
+
/**
|
133
|
+
* Preprocessing
|
134
|
+
*/
|
135
|
+
|
136
|
+
Lexer.prototype.lex = function(src) {
|
137
|
+
src = src
|
138
|
+
.replace(/\r\n|\r/g, '\n')
|
139
|
+
.replace(/\t/g, ' ')
|
140
|
+
.replace(/\u00a0/g, ' ')
|
141
|
+
.replace(/\u2424/g, '\n');
|
142
|
+
|
143
|
+
return this.token(src, true);
|
144
|
+
};
|
145
|
+
|
146
|
+
/**
|
147
|
+
* Lexing
|
148
|
+
*/
|
149
|
+
|
150
|
+
Lexer.prototype.token = function(src, top, bq) {
|
151
|
+
var src = src.replace(/^ +$/gm, '')
|
152
|
+
, next
|
153
|
+
, loose
|
154
|
+
, cap
|
155
|
+
, bull
|
156
|
+
, b
|
157
|
+
, item
|
158
|
+
, space
|
159
|
+
, i
|
160
|
+
, l;
|
161
|
+
|
162
|
+
while (src) {
|
163
|
+
// newline
|
164
|
+
if (cap = this.rules.newline.exec(src)) {
|
165
|
+
src = src.substring(cap[0].length);
|
166
|
+
if (cap[0].length > 1) {
|
167
|
+
this.tokens.push({
|
168
|
+
type: 'space'
|
169
|
+
});
|
170
|
+
}
|
171
|
+
}
|
172
|
+
|
173
|
+
// code
|
174
|
+
if (cap = this.rules.code.exec(src)) {
|
175
|
+
src = src.substring(cap[0].length);
|
176
|
+
cap = cap[0].replace(/^ {4}/gm, '');
|
177
|
+
this.tokens.push({
|
178
|
+
type: 'code',
|
179
|
+
text: !this.options.pedantic
|
180
|
+
? cap.replace(/\n+$/, '')
|
181
|
+
: cap
|
182
|
+
});
|
183
|
+
continue;
|
184
|
+
}
|
185
|
+
|
186
|
+
// fences (gfm)
|
187
|
+
if (cap = this.rules.fences.exec(src)) {
|
188
|
+
src = src.substring(cap[0].length);
|
189
|
+
this.tokens.push({
|
190
|
+
type: 'code',
|
191
|
+
lang: cap[2],
|
192
|
+
text: cap[3] || ''
|
193
|
+
});
|
194
|
+
continue;
|
195
|
+
}
|
196
|
+
|
197
|
+
// heading
|
198
|
+
if (cap = this.rules.heading.exec(src)) {
|
199
|
+
src = src.substring(cap[0].length);
|
200
|
+
this.tokens.push({
|
201
|
+
type: 'heading',
|
202
|
+
depth: cap[1].length,
|
203
|
+
text: cap[2]
|
204
|
+
});
|
205
|
+
continue;
|
206
|
+
}
|
207
|
+
|
208
|
+
// table no leading pipe (gfm)
|
209
|
+
if (top && (cap = this.rules.nptable.exec(src))) {
|
210
|
+
src = src.substring(cap[0].length);
|
211
|
+
|
212
|
+
item = {
|
213
|
+
type: 'table',
|
214
|
+
header: cap[1].replace(/^ *| *\| *$/g, '').split(/ *\| */),
|
215
|
+
align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
|
216
|
+
cells: cap[3].replace(/\n$/, '').split('\n')
|
217
|
+
};
|
218
|
+
|
219
|
+
for (i = 0; i < item.align.length; i++) {
|
220
|
+
if (/^ *-+: *$/.test(item.align[i])) {
|
221
|
+
item.align[i] = 'right';
|
222
|
+
} else if (/^ *:-+: *$/.test(item.align[i])) {
|
223
|
+
item.align[i] = 'center';
|
224
|
+
} else if (/^ *:-+ *$/.test(item.align[i])) {
|
225
|
+
item.align[i] = 'left';
|
226
|
+
} else {
|
227
|
+
item.align[i] = null;
|
228
|
+
}
|
229
|
+
}
|
230
|
+
|
231
|
+
for (i = 0; i < item.cells.length; i++) {
|
232
|
+
item.cells[i] = item.cells[i].split(/ *\| */);
|
233
|
+
}
|
234
|
+
|
235
|
+
this.tokens.push(item);
|
236
|
+
|
237
|
+
continue;
|
238
|
+
}
|
239
|
+
|
240
|
+
// lheading
|
241
|
+
if (cap = this.rules.lheading.exec(src)) {
|
242
|
+
src = src.substring(cap[0].length);
|
243
|
+
this.tokens.push({
|
244
|
+
type: 'heading',
|
245
|
+
depth: cap[2] === '=' ? 1 : 2,
|
246
|
+
text: cap[1]
|
247
|
+
});
|
248
|
+
continue;
|
249
|
+
}
|
250
|
+
|
251
|
+
// hr
|
252
|
+
if (cap = this.rules.hr.exec(src)) {
|
253
|
+
src = src.substring(cap[0].length);
|
254
|
+
this.tokens.push({
|
255
|
+
type: 'hr'
|
256
|
+
});
|
257
|
+
continue;
|
258
|
+
}
|
259
|
+
|
260
|
+
// blockquote
|
261
|
+
if (cap = this.rules.blockquote.exec(src)) {
|
262
|
+
src = src.substring(cap[0].length);
|
263
|
+
|
264
|
+
this.tokens.push({
|
265
|
+
type: 'blockquote_start'
|
266
|
+
});
|
267
|
+
|
268
|
+
cap = cap[0].replace(/^ *> ?/gm, '');
|
269
|
+
|
270
|
+
// Pass `top` to keep the current
|
271
|
+
// "toplevel" state. This is exactly
|
272
|
+
// how markdown.pl works.
|
273
|
+
this.token(cap, top, true);
|
274
|
+
|
275
|
+
this.tokens.push({
|
276
|
+
type: 'blockquote_end'
|
277
|
+
});
|
278
|
+
|
279
|
+
continue;
|
280
|
+
}
|
281
|
+
|
282
|
+
// list
|
283
|
+
if (cap = this.rules.list.exec(src)) {
|
284
|
+
src = src.substring(cap[0].length);
|
285
|
+
bull = cap[2];
|
286
|
+
|
287
|
+
this.tokens.push({
|
288
|
+
type: 'list_start',
|
289
|
+
ordered: bull.length > 1
|
290
|
+
});
|
291
|
+
|
292
|
+
// Get each top-level item.
|
293
|
+
cap = cap[0].match(this.rules.item);
|
294
|
+
|
295
|
+
next = false;
|
296
|
+
l = cap.length;
|
297
|
+
i = 0;
|
298
|
+
|
299
|
+
for (; i < l; i++) {
|
300
|
+
item = cap[i];
|
301
|
+
|
302
|
+
// Remove the list item's bullet
|
303
|
+
// so it is seen as the next token.
|
304
|
+
space = item.length;
|
305
|
+
item = item.replace(/^ *([*+-]|\d+\.) +/, '');
|
306
|
+
|
307
|
+
// Outdent whatever the
|
308
|
+
// list item contains. Hacky.
|
309
|
+
if (~item.indexOf('\n ')) {
|
310
|
+
space -= item.length;
|
311
|
+
item = !this.options.pedantic
|
312
|
+
? item.replace(new RegExp('^ {1,' + space + '}', 'gm'), '')
|
313
|
+
: item.replace(/^ {1,4}/gm, '');
|
314
|
+
}
|
315
|
+
|
316
|
+
// Determine whether the next list item belongs here.
|
317
|
+
// Backpedal if it does not belong in this list.
|
318
|
+
if (this.options.smartLists && i !== l - 1) {
|
319
|
+
b = block.bullet.exec(cap[i + 1])[0];
|
320
|
+
if (bull !== b && !(bull.length > 1 && b.length > 1)) {
|
321
|
+
src = cap.slice(i + 1).join('\n') + src;
|
322
|
+
i = l - 1;
|
323
|
+
}
|
324
|
+
}
|
325
|
+
|
326
|
+
// Determine whether item is loose or not.
|
327
|
+
// Use: /(^|\n)(?! )[^\n]+\n\n(?!\s*$)/
|
328
|
+
// for discount behavior.
|
329
|
+
loose = next || /\n\n(?!\s*$)/.test(item);
|
330
|
+
if (i !== l - 1) {
|
331
|
+
next = item.charAt(item.length - 1) === '\n';
|
332
|
+
if (!loose) loose = next;
|
333
|
+
}
|
334
|
+
|
335
|
+
this.tokens.push({
|
336
|
+
type: loose
|
337
|
+
? 'loose_item_start'
|
338
|
+
: 'list_item_start'
|
339
|
+
});
|
340
|
+
|
341
|
+
// Recurse.
|
342
|
+
this.token(item, false, bq);
|
343
|
+
|
344
|
+
this.tokens.push({
|
345
|
+
type: 'list_item_end'
|
346
|
+
});
|
347
|
+
}
|
348
|
+
|
349
|
+
this.tokens.push({
|
350
|
+
type: 'list_end'
|
351
|
+
});
|
352
|
+
|
353
|
+
continue;
|
354
|
+
}
|
355
|
+
|
356
|
+
// html
|
357
|
+
if (cap = this.rules.html.exec(src)) {
|
358
|
+
src = src.substring(cap[0].length);
|
359
|
+
this.tokens.push({
|
360
|
+
type: this.options.sanitize
|
361
|
+
? 'paragraph'
|
362
|
+
: 'html',
|
363
|
+
pre: !this.options.sanitizer
|
364
|
+
&& (cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style'),
|
365
|
+
text: cap[0]
|
366
|
+
});
|
367
|
+
continue;
|
368
|
+
}
|
369
|
+
|
370
|
+
// def
|
371
|
+
if ((!bq && top) && (cap = this.rules.def.exec(src))) {
|
372
|
+
src = src.substring(cap[0].length);
|
373
|
+
this.tokens.links[cap[1].toLowerCase()] = {
|
374
|
+
href: cap[2],
|
375
|
+
title: cap[3]
|
376
|
+
};
|
377
|
+
continue;
|
378
|
+
}
|
379
|
+
|
380
|
+
// table (gfm)
|
381
|
+
if (top && (cap = this.rules.table.exec(src))) {
|
382
|
+
src = src.substring(cap[0].length);
|
383
|
+
|
384
|
+
item = {
|
385
|
+
type: 'table',
|
386
|
+
header: cap[1].replace(/^ *| *\| *$/g, '').split(/ *\| */),
|
387
|
+
align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
|
388
|
+
cells: cap[3].replace(/(?: *\| *)?\n$/, '').split('\n')
|
389
|
+
};
|
390
|
+
|
391
|
+
for (i = 0; i < item.align.length; i++) {
|
392
|
+
if (/^ *-+: *$/.test(item.align[i])) {
|
393
|
+
item.align[i] = 'right';
|
394
|
+
} else if (/^ *:-+: *$/.test(item.align[i])) {
|
395
|
+
item.align[i] = 'center';
|
396
|
+
} else if (/^ *:-+ *$/.test(item.align[i])) {
|
397
|
+
item.align[i] = 'left';
|
398
|
+
} else {
|
399
|
+
item.align[i] = null;
|
400
|
+
}
|
401
|
+
}
|
402
|
+
|
403
|
+
for (i = 0; i < item.cells.length; i++) {
|
404
|
+
item.cells[i] = item.cells[i]
|
405
|
+
.replace(/^ *\| *| *\| *$/g, '')
|
406
|
+
.split(/ *\| */);
|
407
|
+
}
|
408
|
+
|
409
|
+
this.tokens.push(item);
|
410
|
+
|
411
|
+
continue;
|
412
|
+
}
|
413
|
+
|
414
|
+
// top-level paragraph
|
415
|
+
if (top && (cap = this.rules.paragraph.exec(src))) {
|
416
|
+
src = src.substring(cap[0].length);
|
417
|
+
this.tokens.push({
|
418
|
+
type: 'paragraph',
|
419
|
+
text: cap[1].charAt(cap[1].length - 1) === '\n'
|
420
|
+
? cap[1].slice(0, -1)
|
421
|
+
: cap[1]
|
422
|
+
});
|
423
|
+
continue;
|
424
|
+
}
|
425
|
+
|
426
|
+
// text
|
427
|
+
if (cap = this.rules.text.exec(src)) {
|
428
|
+
// Top-level should never reach here.
|
429
|
+
src = src.substring(cap[0].length);
|
430
|
+
this.tokens.push({
|
431
|
+
type: 'text',
|
432
|
+
text: cap[0]
|
433
|
+
});
|
434
|
+
continue;
|
435
|
+
}
|
436
|
+
|
437
|
+
if (src) {
|
438
|
+
throw new
|
439
|
+
Error('Infinite loop on byte: ' + src.charCodeAt(0));
|
440
|
+
}
|
441
|
+
}
|
442
|
+
|
443
|
+
return this.tokens;
|
444
|
+
};
|
445
|
+
|
446
|
+
/**
|
447
|
+
* Inline-Level Grammar
|
448
|
+
*/
|
449
|
+
|
450
|
+
var inline = {
|
451
|
+
escape: /^\\([\\`*{}\[\]()#+\-.!_>])/,
|
452
|
+
autolink: /^<([^ >]+(@|:\/)[^ >]+)>/,
|
453
|
+
url: noop,
|
454
|
+
tag: /^<!--[\s\S]*?-->|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,
|
455
|
+
link: /^!?\[(inside)\]\(href\)/,
|
456
|
+
reflink: /^!?\[(inside)\]\s*\[([^\]]*)\]/,
|
457
|
+
nolink: /^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,
|
458
|
+
strong: /^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,
|
459
|
+
em: /^\b_((?:[^_]|__)+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,
|
460
|
+
code: /^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,
|
461
|
+
br: /^ {2,}\n(?!\s*$)/,
|
462
|
+
del: noop,
|
463
|
+
text: /^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/
|
464
|
+
};
|
465
|
+
|
466
|
+
inline._inside = /(?:\[[^\]]*\]|[^\[\]]|\](?=[^\[]*\]))*/;
|
467
|
+
inline._href = /\s*<?([\s\S]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/;
|
468
|
+
|
469
|
+
inline.link = replace(inline.link)
|
470
|
+
('inside', inline._inside)
|
471
|
+
('href', inline._href)
|
472
|
+
();
|
473
|
+
|
474
|
+
inline.reflink = replace(inline.reflink)
|
475
|
+
('inside', inline._inside)
|
476
|
+
();
|
477
|
+
|
478
|
+
/**
|
479
|
+
* Normal Inline Grammar
|
480
|
+
*/
|
481
|
+
|
482
|
+
inline.normal = merge({}, inline);
|
483
|
+
|
484
|
+
/**
|
485
|
+
* Pedantic Inline Grammar
|
486
|
+
*/
|
487
|
+
|
488
|
+
inline.pedantic = merge({}, inline.normal, {
|
489
|
+
strong: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
|
490
|
+
em: /^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/
|
491
|
+
});
|
492
|
+
|
493
|
+
/**
|
494
|
+
* GFM Inline Grammar
|
495
|
+
*/
|
496
|
+
|
497
|
+
inline.gfm = merge({}, inline.normal, {
|
498
|
+
escape: replace(inline.escape)('])', '~|])')(),
|
499
|
+
url: /^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,
|
500
|
+
del: /^~~(?=\S)([\s\S]*?\S)~~/,
|
501
|
+
text: replace(inline.text)
|
502
|
+
(']|', '~]|')
|
503
|
+
('|', '|https?://|')
|
504
|
+
()
|
505
|
+
});
|
506
|
+
|
507
|
+
/**
|
508
|
+
* GFM + Line Breaks Inline Grammar
|
509
|
+
*/
|
510
|
+
|
511
|
+
inline.breaks = merge({}, inline.gfm, {
|
512
|
+
br: replace(inline.br)('{2,}', '*')(),
|
513
|
+
text: replace(inline.gfm.text)('{2,}', '*')()
|
514
|
+
});
|
515
|
+
|
516
|
+
/**
|
517
|
+
* Inline Lexer & Compiler
|
518
|
+
*/
|
519
|
+
|
520
|
+
function InlineLexer(links, options) {
|
521
|
+
this.options = options || marked.defaults;
|
522
|
+
this.links = links;
|
523
|
+
this.rules = inline.normal;
|
524
|
+
this.renderer = this.options.renderer || new Renderer;
|
525
|
+
this.renderer.options = this.options;
|
526
|
+
|
527
|
+
if (!this.links) {
|
528
|
+
throw new
|
529
|
+
Error('Tokens array requires a `links` property.');
|
530
|
+
}
|
531
|
+
|
532
|
+
if (this.options.gfm) {
|
533
|
+
if (this.options.breaks) {
|
534
|
+
this.rules = inline.breaks;
|
535
|
+
} else {
|
536
|
+
this.rules = inline.gfm;
|
537
|
+
}
|
538
|
+
} else if (this.options.pedantic) {
|
539
|
+
this.rules = inline.pedantic;
|
540
|
+
}
|
541
|
+
}
|
542
|
+
|
543
|
+
/**
|
544
|
+
* Expose Inline Rules
|
545
|
+
*/
|
546
|
+
|
547
|
+
InlineLexer.rules = inline;
|
548
|
+
|
549
|
+
/**
|
550
|
+
* Static Lexing/Compiling Method
|
551
|
+
*/
|
552
|
+
|
553
|
+
InlineLexer.output = function(src, links, options) {
|
554
|
+
var inline = new InlineLexer(links, options);
|
555
|
+
return inline.output(src);
|
556
|
+
};
|
557
|
+
|
558
|
+
/**
|
559
|
+
* Lexing/Compiling
|
560
|
+
*/
|
561
|
+
|
562
|
+
InlineLexer.prototype.output = function(src) {
|
563
|
+
var out = ''
|
564
|
+
, link
|
565
|
+
, text
|
566
|
+
, href
|
567
|
+
, cap;
|
568
|
+
|
569
|
+
while (src) {
|
570
|
+
// escape
|
571
|
+
if (cap = this.rules.escape.exec(src)) {
|
572
|
+
src = src.substring(cap[0].length);
|
573
|
+
out += cap[1];
|
574
|
+
continue;
|
575
|
+
}
|
576
|
+
|
577
|
+
// autolink
|
578
|
+
if (cap = this.rules.autolink.exec(src)) {
|
579
|
+
src = src.substring(cap[0].length);
|
580
|
+
if (cap[2] === '@') {
|
581
|
+
text = cap[1].charAt(6) === ':'
|
582
|
+
? this.mangle(cap[1].substring(7))
|
583
|
+
: this.mangle(cap[1]);
|
584
|
+
href = this.mangle('mailto:') + text;
|
585
|
+
} else {
|
586
|
+
text = escape(cap[1]);
|
587
|
+
href = text;
|
588
|
+
}
|
589
|
+
out += this.renderer.link(href, null, text);
|
590
|
+
continue;
|
591
|
+
}
|
592
|
+
|
593
|
+
// url (gfm)
|
594
|
+
if (!this.inLink && (cap = this.rules.url.exec(src))) {
|
595
|
+
src = src.substring(cap[0].length);
|
596
|
+
text = escape(cap[1]);
|
597
|
+
href = text;
|
598
|
+
out += this.renderer.link(href, null, text);
|
599
|
+
continue;
|
600
|
+
}
|
601
|
+
|
602
|
+
// tag
|
603
|
+
if (cap = this.rules.tag.exec(src)) {
|
604
|
+
if (!this.inLink && /^<a /i.test(cap[0])) {
|
605
|
+
this.inLink = true;
|
606
|
+
} else if (this.inLink && /^<\/a>/i.test(cap[0])) {
|
607
|
+
this.inLink = false;
|
608
|
+
}
|
609
|
+
src = src.substring(cap[0].length);
|
610
|
+
out += this.options.sanitize
|
611
|
+
? this.options.sanitizer
|
612
|
+
? this.options.sanitizer(cap[0])
|
613
|
+
: escape(cap[0])
|
614
|
+
: cap[0]
|
615
|
+
continue;
|
616
|
+
}
|
617
|
+
|
618
|
+
// link
|
619
|
+
if (cap = this.rules.link.exec(src)) {
|
620
|
+
src = src.substring(cap[0].length);
|
621
|
+
this.inLink = true;
|
622
|
+
out += this.outputLink(cap, {
|
623
|
+
href: cap[2],
|
624
|
+
title: cap[3]
|
625
|
+
});
|
626
|
+
this.inLink = false;
|
627
|
+
continue;
|
628
|
+
}
|
629
|
+
|
630
|
+
// reflink, nolink
|
631
|
+
if ((cap = this.rules.reflink.exec(src))
|
632
|
+
|| (cap = this.rules.nolink.exec(src))) {
|
633
|
+
src = src.substring(cap[0].length);
|
634
|
+
link = (cap[2] || cap[1]).replace(/\s+/g, ' ');
|
635
|
+
link = this.links[link.toLowerCase()];
|
636
|
+
if (!link || !link.href) {
|
637
|
+
out += cap[0].charAt(0);
|
638
|
+
src = cap[0].substring(1) + src;
|
639
|
+
continue;
|
640
|
+
}
|
641
|
+
this.inLink = true;
|
642
|
+
out += this.outputLink(cap, link);
|
643
|
+
this.inLink = false;
|
644
|
+
continue;
|
645
|
+
}
|
646
|
+
|
647
|
+
// strong
|
648
|
+
if (cap = this.rules.strong.exec(src)) {
|
649
|
+
src = src.substring(cap[0].length);
|
650
|
+
out += this.renderer.strong(this.output(cap[2] || cap[1]));
|
651
|
+
continue;
|
652
|
+
}
|
653
|
+
|
654
|
+
// em
|
655
|
+
if (cap = this.rules.em.exec(src)) {
|
656
|
+
src = src.substring(cap[0].length);
|
657
|
+
out += this.renderer.em(this.output(cap[2] || cap[1]));
|
658
|
+
continue;
|
659
|
+
}
|
660
|
+
|
661
|
+
// code
|
662
|
+
if (cap = this.rules.code.exec(src)) {
|
663
|
+
src = src.substring(cap[0].length);
|
664
|
+
out += this.renderer.codespan(escape(cap[2], true));
|
665
|
+
continue;
|
666
|
+
}
|
667
|
+
|
668
|
+
// br
|
669
|
+
if (cap = this.rules.br.exec(src)) {
|
670
|
+
src = src.substring(cap[0].length);
|
671
|
+
out += this.renderer.br();
|
672
|
+
continue;
|
673
|
+
}
|
674
|
+
|
675
|
+
// del (gfm)
|
676
|
+
if (cap = this.rules.del.exec(src)) {
|
677
|
+
src = src.substring(cap[0].length);
|
678
|
+
out += this.renderer.del(this.output(cap[1]));
|
679
|
+
continue;
|
680
|
+
}
|
681
|
+
|
682
|
+
// text
|
683
|
+
if (cap = this.rules.text.exec(src)) {
|
684
|
+
src = src.substring(cap[0].length);
|
685
|
+
out += this.renderer.text(escape(this.smartypants(cap[0])));
|
686
|
+
continue;
|
687
|
+
}
|
688
|
+
|
689
|
+
if (src) {
|
690
|
+
throw new
|
691
|
+
Error('Infinite loop on byte: ' + src.charCodeAt(0));
|
692
|
+
}
|
693
|
+
}
|
694
|
+
|
695
|
+
return out;
|
696
|
+
};
|
697
|
+
|
698
|
+
/**
|
699
|
+
* Compile Link
|
700
|
+
*/
|
701
|
+
|
702
|
+
InlineLexer.prototype.outputLink = function(cap, link) {
|
703
|
+
var href = escape(link.href)
|
704
|
+
, title = link.title ? escape(link.title) : null;
|
705
|
+
|
706
|
+
return cap[0].charAt(0) !== '!'
|
707
|
+
? this.renderer.link(href, title, this.output(cap[1]))
|
708
|
+
: this.renderer.image(href, title, escape(cap[1]));
|
709
|
+
};
|
710
|
+
|
711
|
+
/**
|
712
|
+
* Smartypants Transformations
|
713
|
+
*/
|
714
|
+
|
715
|
+
InlineLexer.prototype.smartypants = function(text) {
|
716
|
+
if (!this.options.smartypants) return text;
|
717
|
+
return text
|
718
|
+
// em-dashes
|
719
|
+
.replace(/---/g, '\u2014')
|
720
|
+
// en-dashes
|
721
|
+
.replace(/--/g, '\u2013')
|
722
|
+
// opening singles
|
723
|
+
.replace(/(^|[-\u2014/(\[{"\s])'/g, '$1\u2018')
|
724
|
+
// closing singles & apostrophes
|
725
|
+
.replace(/'/g, '\u2019')
|
726
|
+
// opening doubles
|
727
|
+
.replace(/(^|[-\u2014/(\[{\u2018\s])"/g, '$1\u201c')
|
728
|
+
// closing doubles
|
729
|
+
.replace(/"/g, '\u201d')
|
730
|
+
// ellipses
|
731
|
+
.replace(/\.{3}/g, '\u2026');
|
732
|
+
};
|
733
|
+
|
734
|
+
/**
|
735
|
+
* Mangle Links
|
736
|
+
*/
|
737
|
+
|
738
|
+
InlineLexer.prototype.mangle = function(text) {
|
739
|
+
if (!this.options.mangle) return text;
|
740
|
+
var out = ''
|
741
|
+
, l = text.length
|
742
|
+
, i = 0
|
743
|
+
, ch;
|
744
|
+
|
745
|
+
for (; i < l; i++) {
|
746
|
+
ch = text.charCodeAt(i);
|
747
|
+
if (Math.random() > 0.5) {
|
748
|
+
ch = 'x' + ch.toString(16);
|
749
|
+
}
|
750
|
+
out += '&#' + ch + ';';
|
751
|
+
}
|
752
|
+
|
753
|
+
return out;
|
754
|
+
};
|
755
|
+
|
756
|
+
/**
|
757
|
+
* Renderer
|
758
|
+
*/
|
759
|
+
|
760
|
+
function Renderer(options) {
|
761
|
+
this.options = options || {};
|
762
|
+
}
|
763
|
+
|
764
|
+
Renderer.prototype.code = function(code, lang, escaped) {
|
765
|
+
if (this.options.highlight) {
|
766
|
+
var out = this.options.highlight(code, lang);
|
767
|
+
if (out != null && out !== code) {
|
768
|
+
escaped = true;
|
769
|
+
code = out;
|
770
|
+
}
|
771
|
+
}
|
772
|
+
|
773
|
+
if (!lang) {
|
774
|
+
return '<pre><code>'
|
775
|
+
+ (escaped ? code : escape(code, true))
|
776
|
+
+ '\n</code></pre>';
|
777
|
+
}
|
778
|
+
|
779
|
+
return '<pre><code class="'
|
780
|
+
+ this.options.langPrefix
|
781
|
+
+ escape(lang, true)
|
782
|
+
+ '">'
|
783
|
+
+ (escaped ? code : escape(code, true))
|
784
|
+
+ '\n</code></pre>\n';
|
785
|
+
};
|
786
|
+
|
787
|
+
Renderer.prototype.blockquote = function(quote) {
|
788
|
+
return '<blockquote>\n' + quote + '</blockquote>\n';
|
789
|
+
};
|
790
|
+
|
791
|
+
Renderer.prototype.html = function(html) {
|
792
|
+
return html;
|
793
|
+
};
|
794
|
+
|
795
|
+
Renderer.prototype.heading = function(text, level, raw) {
|
796
|
+
return '<h'
|
797
|
+
+ level
|
798
|
+
+ ' id="'
|
799
|
+
+ this.options.headerPrefix
|
800
|
+
+ raw.toLowerCase().replace(/[^\w]+/g, '-')
|
801
|
+
+ '">'
|
802
|
+
+ text
|
803
|
+
+ '</h'
|
804
|
+
+ level
|
805
|
+
+ '>\n';
|
806
|
+
};
|
807
|
+
|
808
|
+
Renderer.prototype.hr = function() {
|
809
|
+
return this.options.xhtml ? '<hr/>\n' : '<hr>\n';
|
810
|
+
};
|
811
|
+
|
812
|
+
Renderer.prototype.list = function(body, ordered) {
|
813
|
+
var type = ordered ? 'ol' : 'ul';
|
814
|
+
return '<' + type + '>\n' + body + '</' + type + '>\n';
|
815
|
+
};
|
816
|
+
|
817
|
+
Renderer.prototype.listitem = function(text) {
|
818
|
+
return '<li>' + text + '</li>\n';
|
819
|
+
};
|
820
|
+
|
821
|
+
Renderer.prototype.paragraph = function(text) {
|
822
|
+
return '<p>' + text + '</p>\n';
|
823
|
+
};
|
824
|
+
|
825
|
+
Renderer.prototype.table = function(header, body) {
|
826
|
+
return '<table>\n'
|
827
|
+
+ '<thead>\n'
|
828
|
+
+ header
|
829
|
+
+ '</thead>\n'
|
830
|
+
+ '<tbody>\n'
|
831
|
+
+ body
|
832
|
+
+ '</tbody>\n'
|
833
|
+
+ '</table>\n';
|
834
|
+
};
|
835
|
+
|
836
|
+
Renderer.prototype.tablerow = function(content) {
|
837
|
+
return '<tr>\n' + content + '</tr>\n';
|
838
|
+
};
|
839
|
+
|
840
|
+
Renderer.prototype.tablecell = function(content, flags) {
|
841
|
+
var type = flags.header ? 'th' : 'td';
|
842
|
+
var tag = flags.align
|
843
|
+
? '<' + type + ' style="text-align:' + flags.align + '">'
|
844
|
+
: '<' + type + '>';
|
845
|
+
return tag + content + '</' + type + '>\n';
|
846
|
+
};
|
847
|
+
|
848
|
+
// span level renderer
|
849
|
+
Renderer.prototype.strong = function(text) {
|
850
|
+
return '<strong>' + text + '</strong>';
|
851
|
+
};
|
852
|
+
|
853
|
+
Renderer.prototype.em = function(text) {
|
854
|
+
return '<em>' + text + '</em>';
|
855
|
+
};
|
856
|
+
|
857
|
+
Renderer.prototype.codespan = function(text) {
|
858
|
+
return '<code>' + text + '</code>';
|
859
|
+
};
|
860
|
+
|
861
|
+
Renderer.prototype.br = function() {
|
862
|
+
return this.options.xhtml ? '<br/>' : '<br>';
|
863
|
+
};
|
864
|
+
|
865
|
+
Renderer.prototype.del = function(text) {
|
866
|
+
return '<del>' + text + '</del>';
|
867
|
+
};
|
868
|
+
|
869
|
+
Renderer.prototype.link = function(href, title, text) {
|
870
|
+
if (this.options.sanitize) {
|
871
|
+
try {
|
872
|
+
var prot = decodeURIComponent(unescape(href))
|
873
|
+
.replace(/[^\w:]/g, '')
|
874
|
+
.toLowerCase();
|
875
|
+
} catch (e) {
|
876
|
+
return '';
|
877
|
+
}
|
878
|
+
if (prot.indexOf('javascript:') === 0 || prot.indexOf('vbscript:') === 0) {
|
879
|
+
return '';
|
880
|
+
}
|
881
|
+
}
|
882
|
+
var out = '<a href="' + href + '"';
|
883
|
+
if (title) {
|
884
|
+
out += ' title="' + title + '"';
|
885
|
+
}
|
886
|
+
out += '>' + text + '</a>';
|
887
|
+
return out;
|
888
|
+
};
|
889
|
+
|
890
|
+
Renderer.prototype.image = function(href, title, text) {
|
891
|
+
var out = '<img src="' + href + '" alt="' + text + '"';
|
892
|
+
if (title) {
|
893
|
+
out += ' title="' + title + '"';
|
894
|
+
}
|
895
|
+
out += this.options.xhtml ? '/>' : '>';
|
896
|
+
return out;
|
897
|
+
};
|
898
|
+
|
899
|
+
Renderer.prototype.text = function(text) {
|
900
|
+
return text;
|
901
|
+
};
|
902
|
+
|
903
|
+
/**
|
904
|
+
* Parsing & Compiling
|
905
|
+
*/
|
906
|
+
|
907
|
+
function Parser(options) {
|
908
|
+
this.tokens = [];
|
909
|
+
this.token = null;
|
910
|
+
this.options = options || marked.defaults;
|
911
|
+
this.options.renderer = this.options.renderer || new Renderer;
|
912
|
+
this.renderer = this.options.renderer;
|
913
|
+
this.renderer.options = this.options;
|
914
|
+
}
|
915
|
+
|
916
|
+
/**
|
917
|
+
* Static Parse Method
|
918
|
+
*/
|
919
|
+
|
920
|
+
Parser.parse = function(src, options, renderer) {
|
921
|
+
var parser = new Parser(options, renderer);
|
922
|
+
return parser.parse(src);
|
923
|
+
};
|
924
|
+
|
925
|
+
/**
|
926
|
+
* Parse Loop
|
927
|
+
*/
|
928
|
+
|
929
|
+
Parser.prototype.parse = function(src) {
|
930
|
+
this.inline = new InlineLexer(src.links, this.options, this.renderer);
|
931
|
+
this.tokens = src.reverse();
|
932
|
+
|
933
|
+
var out = '';
|
934
|
+
while (this.next()) {
|
935
|
+
out += this.tok();
|
936
|
+
}
|
937
|
+
|
938
|
+
return out;
|
939
|
+
};
|
940
|
+
|
941
|
+
/**
|
942
|
+
* Next Token
|
943
|
+
*/
|
944
|
+
|
945
|
+
Parser.prototype.next = function() {
|
946
|
+
return this.token = this.tokens.pop();
|
947
|
+
};
|
948
|
+
|
949
|
+
/**
|
950
|
+
* Preview Next Token
|
951
|
+
*/
|
952
|
+
|
953
|
+
Parser.prototype.peek = function() {
|
954
|
+
return this.tokens[this.tokens.length - 1] || 0;
|
955
|
+
};
|
956
|
+
|
957
|
+
/**
|
958
|
+
* Parse Text Tokens
|
959
|
+
*/
|
960
|
+
|
961
|
+
Parser.prototype.parseText = function() {
|
962
|
+
var body = this.token.text;
|
963
|
+
|
964
|
+
while (this.peek().type === 'text') {
|
965
|
+
body += '\n' + this.next().text;
|
966
|
+
}
|
967
|
+
|
968
|
+
return this.inline.output(body);
|
969
|
+
};
|
970
|
+
|
971
|
+
/**
|
972
|
+
* Parse Current Token
|
973
|
+
*/
|
974
|
+
|
975
|
+
Parser.prototype.tok = function() {
|
976
|
+
switch (this.token.type) {
|
977
|
+
case 'space': {
|
978
|
+
return '';
|
979
|
+
}
|
980
|
+
case 'hr': {
|
981
|
+
return this.renderer.hr();
|
982
|
+
}
|
983
|
+
case 'heading': {
|
984
|
+
return this.renderer.heading(
|
985
|
+
this.inline.output(this.token.text),
|
986
|
+
this.token.depth,
|
987
|
+
this.token.text);
|
988
|
+
}
|
989
|
+
case 'code': {
|
990
|
+
return this.renderer.code(this.token.text,
|
991
|
+
this.token.lang,
|
992
|
+
this.token.escaped);
|
993
|
+
}
|
994
|
+
case 'table': {
|
995
|
+
var header = ''
|
996
|
+
, body = ''
|
997
|
+
, i
|
998
|
+
, row
|
999
|
+
, cell
|
1000
|
+
, flags
|
1001
|
+
, j;
|
1002
|
+
|
1003
|
+
// header
|
1004
|
+
cell = '';
|
1005
|
+
for (i = 0; i < this.token.header.length; i++) {
|
1006
|
+
flags = { header: true, align: this.token.align[i] };
|
1007
|
+
cell += this.renderer.tablecell(
|
1008
|
+
this.inline.output(this.token.header[i]),
|
1009
|
+
{ header: true, align: this.token.align[i] }
|
1010
|
+
);
|
1011
|
+
}
|
1012
|
+
header += this.renderer.tablerow(cell);
|
1013
|
+
|
1014
|
+
for (i = 0; i < this.token.cells.length; i++) {
|
1015
|
+
row = this.token.cells[i];
|
1016
|
+
|
1017
|
+
cell = '';
|
1018
|
+
for (j = 0; j < row.length; j++) {
|
1019
|
+
cell += this.renderer.tablecell(
|
1020
|
+
this.inline.output(row[j]),
|
1021
|
+
{ header: false, align: this.token.align[j] }
|
1022
|
+
);
|
1023
|
+
}
|
1024
|
+
|
1025
|
+
body += this.renderer.tablerow(cell);
|
1026
|
+
}
|
1027
|
+
return this.renderer.table(header, body);
|
1028
|
+
}
|
1029
|
+
case 'blockquote_start': {
|
1030
|
+
var body = '';
|
1031
|
+
|
1032
|
+
while (this.next().type !== 'blockquote_end') {
|
1033
|
+
body += this.tok();
|
1034
|
+
}
|
1035
|
+
|
1036
|
+
return this.renderer.blockquote(body);
|
1037
|
+
}
|
1038
|
+
case 'list_start': {
|
1039
|
+
var body = ''
|
1040
|
+
, ordered = this.token.ordered;
|
1041
|
+
|
1042
|
+
while (this.next().type !== 'list_end') {
|
1043
|
+
body += this.tok();
|
1044
|
+
}
|
1045
|
+
|
1046
|
+
return this.renderer.list(body, ordered);
|
1047
|
+
}
|
1048
|
+
case 'list_item_start': {
|
1049
|
+
var body = '';
|
1050
|
+
|
1051
|
+
while (this.next().type !== 'list_item_end') {
|
1052
|
+
body += this.token.type === 'text'
|
1053
|
+
? this.parseText()
|
1054
|
+
: this.tok();
|
1055
|
+
}
|
1056
|
+
|
1057
|
+
return this.renderer.listitem(body);
|
1058
|
+
}
|
1059
|
+
case 'loose_item_start': {
|
1060
|
+
var body = '';
|
1061
|
+
|
1062
|
+
while (this.next().type !== 'list_item_end') {
|
1063
|
+
body += this.tok();
|
1064
|
+
}
|
1065
|
+
|
1066
|
+
return this.renderer.listitem(body);
|
1067
|
+
}
|
1068
|
+
case 'html': {
|
1069
|
+
var html = !this.token.pre && !this.options.pedantic
|
1070
|
+
? this.inline.output(this.token.text)
|
1071
|
+
: this.token.text;
|
1072
|
+
return this.renderer.html(html);
|
1073
|
+
}
|
1074
|
+
case 'paragraph': {
|
1075
|
+
return this.renderer.paragraph(this.inline.output(this.token.text));
|
1076
|
+
}
|
1077
|
+
case 'text': {
|
1078
|
+
return this.renderer.paragraph(this.parseText());
|
1079
|
+
}
|
1080
|
+
}
|
1081
|
+
};
|
1082
|
+
|
1083
|
+
/**
|
1084
|
+
* Helpers
|
1085
|
+
*/
|
1086
|
+
|
1087
|
+
function escape(html, encode) {
|
1088
|
+
return html
|
1089
|
+
.replace(!encode ? /&(?!#?\w+;)/g : /&/g, '&')
|
1090
|
+
.replace(/</g, '<')
|
1091
|
+
.replace(/>/g, '>')
|
1092
|
+
.replace(/"/g, '"')
|
1093
|
+
.replace(/'/g, ''');
|
1094
|
+
}
|
1095
|
+
|
1096
|
+
function unescape(html) {
|
1097
|
+
return html.replace(/&([#\w]+);/g, function(_, n) {
|
1098
|
+
n = n.toLowerCase();
|
1099
|
+
if (n === 'colon') return ':';
|
1100
|
+
if (n.charAt(0) === '#') {
|
1101
|
+
return n.charAt(1) === 'x'
|
1102
|
+
? String.fromCharCode(parseInt(n.substring(2), 16))
|
1103
|
+
: String.fromCharCode(+n.substring(1));
|
1104
|
+
}
|
1105
|
+
return '';
|
1106
|
+
});
|
1107
|
+
}
|
1108
|
+
|
1109
|
+
function replace(regex, opt) {
|
1110
|
+
regex = regex.source;
|
1111
|
+
opt = opt || '';
|
1112
|
+
return function self(name, val) {
|
1113
|
+
if (!name) return new RegExp(regex, opt);
|
1114
|
+
val = val.source || val;
|
1115
|
+
val = val.replace(/(^|[^\[])\^/g, '$1');
|
1116
|
+
regex = regex.replace(name, val);
|
1117
|
+
return self;
|
1118
|
+
};
|
1119
|
+
}
|
1120
|
+
|
1121
|
+
function noop() {}
|
1122
|
+
noop.exec = noop;
|
1123
|
+
|
1124
|
+
function merge(obj) {
|
1125
|
+
var i = 1
|
1126
|
+
, target
|
1127
|
+
, key;
|
1128
|
+
|
1129
|
+
for (; i < arguments.length; i++) {
|
1130
|
+
target = arguments[i];
|
1131
|
+
for (key in target) {
|
1132
|
+
if (Object.prototype.hasOwnProperty.call(target, key)) {
|
1133
|
+
obj[key] = target[key];
|
1134
|
+
}
|
1135
|
+
}
|
1136
|
+
}
|
1137
|
+
|
1138
|
+
return obj;
|
1139
|
+
}
|
1140
|
+
|
1141
|
+
|
1142
|
+
/**
|
1143
|
+
* Marked
|
1144
|
+
*/
|
1145
|
+
|
1146
|
+
function marked(src, opt, callback) {
|
1147
|
+
if (callback || typeof opt === 'function') {
|
1148
|
+
if (!callback) {
|
1149
|
+
callback = opt;
|
1150
|
+
opt = null;
|
1151
|
+
}
|
1152
|
+
|
1153
|
+
opt = merge({}, marked.defaults, opt || {});
|
1154
|
+
|
1155
|
+
var highlight = opt.highlight
|
1156
|
+
, tokens
|
1157
|
+
, pending
|
1158
|
+
, i = 0;
|
1159
|
+
|
1160
|
+
try {
|
1161
|
+
tokens = Lexer.lex(src, opt)
|
1162
|
+
} catch (e) {
|
1163
|
+
return callback(e);
|
1164
|
+
}
|
1165
|
+
|
1166
|
+
pending = tokens.length;
|
1167
|
+
|
1168
|
+
var done = function(err) {
|
1169
|
+
if (err) {
|
1170
|
+
opt.highlight = highlight;
|
1171
|
+
return callback(err);
|
1172
|
+
}
|
1173
|
+
|
1174
|
+
var out;
|
1175
|
+
|
1176
|
+
try {
|
1177
|
+
out = Parser.parse(tokens, opt);
|
1178
|
+
} catch (e) {
|
1179
|
+
err = e;
|
1180
|
+
}
|
1181
|
+
|
1182
|
+
opt.highlight = highlight;
|
1183
|
+
|
1184
|
+
return err
|
1185
|
+
? callback(err)
|
1186
|
+
: callback(null, out);
|
1187
|
+
};
|
1188
|
+
|
1189
|
+
if (!highlight || highlight.length < 3) {
|
1190
|
+
return done();
|
1191
|
+
}
|
1192
|
+
|
1193
|
+
delete opt.highlight;
|
1194
|
+
|
1195
|
+
if (!pending) return done();
|
1196
|
+
|
1197
|
+
for (; i < tokens.length; i++) {
|
1198
|
+
(function(token) {
|
1199
|
+
if (token.type !== 'code') {
|
1200
|
+
return --pending || done();
|
1201
|
+
}
|
1202
|
+
return highlight(token.text, token.lang, function(err, code) {
|
1203
|
+
if (err) return done(err);
|
1204
|
+
if (code == null || code === token.text) {
|
1205
|
+
return --pending || done();
|
1206
|
+
}
|
1207
|
+
token.text = code;
|
1208
|
+
token.escaped = true;
|
1209
|
+
--pending || done();
|
1210
|
+
});
|
1211
|
+
})(tokens[i]);
|
1212
|
+
}
|
1213
|
+
|
1214
|
+
return;
|
1215
|
+
}
|
1216
|
+
try {
|
1217
|
+
if (opt) opt = merge({}, marked.defaults, opt);
|
1218
|
+
return Parser.parse(Lexer.lex(src, opt), opt);
|
1219
|
+
} catch (e) {
|
1220
|
+
e.message += '\nPlease report this to https://github.com/chjj/marked.';
|
1221
|
+
if ((opt || marked.defaults).silent) {
|
1222
|
+
return '<p>An error occured:</p><pre>'
|
1223
|
+
+ escape(e.message + '', true)
|
1224
|
+
+ '</pre>';
|
1225
|
+
}
|
1226
|
+
throw e;
|
1227
|
+
}
|
1228
|
+
}
|
1229
|
+
|
1230
|
+
/**
|
1231
|
+
* Options
|
1232
|
+
*/
|
1233
|
+
|
1234
|
+
marked.options =
|
1235
|
+
marked.setOptions = function(opt) {
|
1236
|
+
merge(marked.defaults, opt);
|
1237
|
+
return marked;
|
1238
|
+
};
|
1239
|
+
|
1240
|
+
marked.defaults = {
|
1241
|
+
gfm: true,
|
1242
|
+
tables: true,
|
1243
|
+
breaks: false,
|
1244
|
+
pedantic: false,
|
1245
|
+
sanitize: false,
|
1246
|
+
sanitizer: null,
|
1247
|
+
mangle: true,
|
1248
|
+
smartLists: false,
|
1249
|
+
silent: false,
|
1250
|
+
highlight: null,
|
1251
|
+
langPrefix: 'lang-',
|
1252
|
+
smartypants: false,
|
1253
|
+
headerPrefix: '',
|
1254
|
+
renderer: new Renderer,
|
1255
|
+
xhtml: false
|
1256
|
+
};
|
1257
|
+
|
1258
|
+
/**
|
1259
|
+
* Expose
|
1260
|
+
*/
|
1261
|
+
|
1262
|
+
marked.Parser = Parser;
|
1263
|
+
marked.parser = Parser.parse;
|
1264
|
+
|
1265
|
+
marked.Renderer = Renderer;
|
1266
|
+
|
1267
|
+
marked.Lexer = Lexer;
|
1268
|
+
marked.lexer = Lexer.lex;
|
1269
|
+
|
1270
|
+
marked.InlineLexer = InlineLexer;
|
1271
|
+
marked.inlineLexer = InlineLexer.output;
|
1272
|
+
|
1273
|
+
marked.parse = marked;
|
1274
|
+
|
1275
|
+
if (typeof module !== 'undefined' && typeof exports === 'object') {
|
1276
|
+
module.exports = marked;
|
1277
|
+
} else if (typeof define === 'function' && define.amd) {
|
1278
|
+
define(function() { return marked; });
|
1279
|
+
} else {
|
1280
|
+
this.marked = marked;
|
1281
|
+
}
|
1282
|
+
|
1283
|
+
}).call(function() {
|
1284
|
+
return this || (typeof window !== 'undefined' ? window : global);
|
1285
|
+
}());
|