elabs 4.0.0 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitlab-ci.yml +9 -0
- data/.node-version +1 -1
- data/.rubocop.yml +4 -0
- data/.stylelintrc.yml +12 -2
- data/CHANGELOG.md +81 -12
- data/Gemfile +1 -1
- data/Gemfile.lock +96 -94
- data/README.md +2 -0
- data/ROADMAP.md +4 -2
- data/app/assets/config/elabs_manifest.js +2 -1
- data/app/assets/fonts/elabs/FontAwesome/fa-brands-400.eot +0 -0
- data/app/assets/fonts/elabs/FontAwesome/fa-brands-400.svg +1148 -0
- data/app/assets/fonts/elabs/FontAwesome/fa-brands-400.ttf +0 -0
- data/app/assets/fonts/elabs/FontAwesome/fa-brands-400.woff +0 -0
- data/app/assets/fonts/elabs/FontAwesome/fa-brands-400.woff2 +0 -0
- data/app/assets/fonts/elabs/FontAwesome/fa-regular-400.eot +0 -0
- data/app/assets/fonts/elabs/FontAwesome/fa-regular-400.svg +467 -0
- data/app/assets/fonts/elabs/FontAwesome/fa-regular-400.ttf +0 -0
- data/app/assets/fonts/elabs/FontAwesome/fa-regular-400.woff +0 -0
- data/app/assets/fonts/elabs/FontAwesome/fa-regular-400.woff2 +0 -0
- data/app/assets/fonts/elabs/FontAwesome/fa-solid-900.eot +0 -0
- data/app/assets/fonts/elabs/FontAwesome/fa-solid-900.svg +2231 -0
- data/app/assets/fonts/elabs/FontAwesome/fa-solid-900.ttf +0 -0
- data/app/assets/fonts/elabs/FontAwesome/fa-solid-900.woff +0 -0
- data/app/assets/fonts/elabs/FontAwesome/fa-solid-900.woff2 +0 -0
- data/app/assets/fonts/elabs/OpenSans/Apache License.txt +201 -0
- data/app/assets/fonts/elabs/OpenSans/OpenSans-Bold.ttf +0 -0
- data/app/assets/fonts/elabs/OpenSans/OpenSans-Light.ttf +0 -0
- data/app/assets/fonts/elabs/OpenSans/OpenSans-Regular.ttf +0 -0
- data/app/assets/fonts/elabs/OpenSans/OpenSans-Semibold.ttf +0 -0
- data/app/assets/fonts/elabs/license-icons/license-icons.eot +0 -0
- data/app/assets/fonts/elabs/license-icons/license-icons.svg +51 -0
- data/app/assets/fonts/elabs/license-icons/license-icons.ttf +0 -0
- data/app/assets/fonts/elabs/license-icons/license-icons.woff +0 -0
- data/app/assets/fonts/elabs/license-icons/license-icons.woff2 +0 -0
- data/app/assets/images/elabs/preview_placeholder.png +0 -0
- data/app/assets/images/elabs/preview_placeholder_nsfw.png +0 -0
- data/app/assets/javascripts/elabs/announcements.js +33 -0
- data/app/assets/javascripts/elabs/application.js.erb +17 -14
- data/app/assets/javascripts/elabs/forms.js +0 -1
- data/app/assets/javascripts/elabs/helpers-markdown.js +2 -2
- data/app/assets/javascripts/elabs/helpers.js +17 -0
- data/app/assets/javascripts/elabs/menu.js +5 -0
- data/app/assets/stylesheets/elabs/_fonts.scss +32 -0
- data/app/assets/stylesheets/elabs/_variables.scss +286 -5
- data/app/assets/stylesheets/elabs/app/components/_act.scss +83 -0
- data/app/assets/stylesheets/elabs/app/components/_announcement.scss +41 -0
- data/app/assets/stylesheets/elabs/app/components/_classifier_types.scss +43 -0
- data/app/assets/stylesheets/elabs/app/components/_comment.scss +29 -0
- data/app/assets/stylesheets/elabs/app/components/_content_relations.scss +53 -0
- data/app/assets/stylesheets/elabs/app/components/_content_statuses.scss +39 -0
- data/app/assets/stylesheets/elabs/app/components/_content_types.scss +41 -0
- data/app/assets/stylesheets/elabs/app/components/_git_cards.scss +122 -0
- data/app/assets/stylesheets/elabs/app/elements/_alerts.scss +3 -0
- data/app/assets/stylesheets/elabs/app/elements/_badges.scss +17 -0
- data/app/assets/stylesheets/elabs/app/elements/_buttons.scss +34 -0
- data/app/assets/stylesheets/elabs/app/elements/_dropdowns.scss +78 -0
- data/app/assets/stylesheets/elabs/app/elements/_empty.scss +31 -0
- data/app/assets/stylesheets/elabs/app/elements/_errors.scss +15 -0
- data/app/assets/stylesheets/elabs/app/elements/_filter_link.scss +23 -0
- data/app/assets/stylesheets/elabs/app/elements/_fixed_links.scss +19 -0
- data/app/assets/stylesheets/elabs/app/elements/_forms.scss +123 -0
- data/app/assets/stylesheets/elabs/app/elements/_icons.scss +74 -0
- data/app/assets/stylesheets/elabs/app/{_medias.scss → elements/_medias.scss} +2 -0
- data/app/assets/stylesheets/elabs/app/{_modals.scss → elements/_modals.scss} +8 -4
- data/app/assets/stylesheets/elabs/app/elements/_nsfw.scss +41 -0
- data/app/assets/stylesheets/elabs/app/{_pagination.scss → elements/_pagination.scss} +0 -0
- data/app/assets/stylesheets/elabs/app/{_tables.scss → elements/_tables.scss} +2 -2
- data/app/assets/stylesheets/elabs/app/elements/_tabs.scss +73 -0
- data/app/assets/stylesheets/elabs/app/helpers/_cards.scss +80 -0
- data/app/assets/stylesheets/elabs/app/helpers/_containers.scss +7 -0
- data/app/assets/stylesheets/elabs/app/helpers/_states.scss +3 -0
- data/app/assets/stylesheets/elabs/app/{_helpers.scss → helpers/_typo.scss} +6 -4
- data/app/assets/stylesheets/elabs/app/layouts/_acts.scss +25 -0
- data/app/assets/stylesheets/elabs/app/layouts/_classifiers.scss +32 -0
- data/app/assets/stylesheets/elabs/app/{_comments.scss → layouts/_comments.scss} +0 -2
- data/app/assets/stylesheets/elabs/app/layouts/_devise.scss +65 -0
- data/app/assets/stylesheets/elabs/app/layouts/_layout.scss +40 -0
- data/app/assets/stylesheets/elabs/app/layouts/_page.scss +14 -0
- data/app/assets/stylesheets/elabs/app/layouts/_page_content.scss +13 -0
- data/app/assets/stylesheets/elabs/app/layouts/_page_footer.scss +20 -0
- data/app/assets/stylesheets/elabs/app/layouts/_page_header.scss +146 -0
- data/app/assets/stylesheets/elabs/app/layouts/_page_menu.scss +232 -0
- data/app/assets/stylesheets/elabs/app/layouts/_page_messages.scss +4 -0
- data/app/assets/stylesheets/elabs/app/layouts/_private_layout.scss +78 -0
- data/app/assets/stylesheets/elabs/app/{_typo.scss → layouts/_typo.scss} +3 -0
- data/app/assets/stylesheets/elabs/app/mixins/_classifier_card.scss +43 -0
- data/app/assets/stylesheets/elabs/app/mixins/_content_card.scss +103 -0
- data/app/assets/stylesheets/elabs/app/mixins/_content_full.scss +158 -0
- data/app/assets/stylesheets/elabs/app/mixins/{_content-inline.scss → _content_inline.scss} +0 -0
- data/app/assets/stylesheets/elabs/lib/_codemirror.scss +2 -2
- data/app/assets/stylesheets/elabs/{_colors.scss → lib/_colors_reference.scss} +0 -52
- data/app/assets/stylesheets/elabs/lib/_license_icons.scss +121 -0
- data/app/assets/stylesheets/elabs/lib/fontawesome/_fontawesome.scss +1 -1
- data/app/assets/stylesheets/elabs/lib/fontawesome/_fonts.scss +18 -18
- data/app/assets/stylesheets/elabs/lib/knacss/_knacss.scss +1 -1
- data/app/assets/stylesheets/elabs/lib/knacss/_knacss_variables.scss +227 -0
- data/app/assets/stylesheets/elabs/style.scss +62 -57
- data/app/controllers/elabs/admin/admin_application_controller.rb +1 -1
- data/app/controllers/elabs/admin/announcements_controller.rb +71 -0
- data/app/controllers/elabs/concerns/elabs_controller.rb +3 -0
- data/app/controllers/elabs/content_application_controller.rb +4 -0
- data/app/controllers/elabs/elabs_public_controller.rb +15 -0
- data/app/controllers/elabs/languages_controller.rb +1 -5
- data/app/controllers/elabs/member/comments_controller.rb +42 -0
- data/app/controllers/elabs/member/member_application_controller.rb +1 -1
- data/app/controllers/elabs/reports_controller.rb +2 -0
- data/app/helpers/elabs/acts_helper.rb +7 -2
- data/app/helpers/elabs/application_helper.rb +8 -50
- data/app/helpers/elabs/content_filters_helper.rb +17 -24
- data/app/helpers/elabs/content_helper.rb +8 -35
- data/app/helpers/elabs/content_renderer_helper.rb +4 -112
- data/app/helpers/elabs/form_helper.rb +11 -11
- data/app/helpers/elabs/icons_helper.rb +63 -0
- data/app/helpers/elabs/{admin_content_helper.rb → links_admin_helper.rb} +1 -1
- data/app/helpers/elabs/links_helper.rb +58 -0
- data/app/helpers/elabs/{member_content_helper.rb → links_member_helper.rb} +2 -2
- data/app/helpers/elabs/notification_helper.rb +17 -3
- data/app/helpers/elabs/shortcodes_helper.rb +108 -0
- data/app/helpers/elabs/thumbnails_helper.rb +1 -1
- data/app/models/elabs/album.rb +14 -0
- data/app/models/elabs/announcement.rb +33 -0
- data/app/models/elabs/article.rb +14 -0
- data/app/models/elabs/comment.rb +10 -4
- data/app/models/elabs/note.rb +14 -0
- data/app/models/elabs/project.rb +12 -0
- data/app/models/elabs/report.rb +1 -0
- data/app/models/elabs/upload.rb +16 -0
- data/app/models/elabs/user.rb +2 -1
- data/app/views/elabs/acts/_filters.html.haml +3 -2
- data/app/views/elabs/acts/index.html.haml +2 -13
- data/app/views/elabs/admin/announcements/_announcement.json.jbuilder +10 -0
- data/app/views/elabs/admin/announcements/_form.html.haml +52 -0
- data/app/views/elabs/admin/announcements/edit.html.haml +3 -0
- data/app/views/elabs/admin/announcements/index.html.haml +28 -0
- data/app/views/elabs/admin/announcements/index.json.jbuilder +1 -0
- data/app/views/elabs/admin/announcements/new.html.haml +3 -0
- data/app/views/elabs/admin/licenses/index.html.haml +2 -2
- data/app/views/elabs/admin/uploads/_upload.json.jbuilder +3 -3
- data/app/views/elabs/albums/_card_content.html.haml +8 -0
- data/app/views/elabs/albums/_filters.html.haml +5 -3
- data/app/views/elabs/albums/index.html.haml +1 -1
- data/app/views/elabs/albums/show.html.haml +38 -29
- data/app/views/elabs/articles/_filters.html.haml +5 -3
- data/app/views/elabs/articles/index.html.haml +1 -1
- data/app/views/elabs/articles/show.html.haml +33 -25
- data/app/views/elabs/auth/confirmations/new.html.haml +1 -1
- data/app/views/elabs/auth/passwords/edit.html.haml +1 -1
- data/app/views/elabs/auth/passwords/new.html.haml +1 -1
- data/app/views/elabs/auth/registrations/new.html.haml +7 -2
- data/app/views/elabs/auth/sessions/_new.html.haml +1 -1
- data/app/views/elabs/auth/unlocks/new.html.haml +1 -1
- data/app/views/elabs/comments/_comments.html.haml +29 -20
- data/app/views/elabs/comments/_form.html.haml +40 -36
- data/app/views/elabs/languages/_filters.html.haml +3 -5
- data/app/views/elabs/languages/index.html.haml +12 -13
- data/app/views/elabs/languages/show.html.haml +36 -31
- data/app/views/elabs/layouts/_announcements.html.haml +9 -0
- data/app/views/elabs/layouts/_content_associations.html.haml +89 -0
- data/app/views/elabs/layouts/_content_card.html.haml +41 -0
- data/app/views/elabs/layouts/_flash_messages.html.haml +4 -0
- data/app/views/elabs/layouts/_footer.html.haml +18 -10
- data/app/views/elabs/layouts/_form_honeypot.html.haml +12 -0
- data/app/views/elabs/layouts/_hidden_entry.html.haml +1 -1
- data/app/views/elabs/layouts/_hidden_entry_full.html.haml +4 -2
- data/app/views/elabs/layouts/_hidden_entry_inline.html.haml +1 -1
- data/app/views/elabs/layouts/_language_menu.html.haml +2 -2
- data/app/views/elabs/layouts/_menu.html.haml +58 -75
- data/app/views/elabs/layouts/_menu_admin.html.haml +40 -0
- data/app/views/elabs/layouts/_menu_member.html.haml +57 -0
- data/app/views/elabs/layouts/application.html.haml +24 -13
- data/app/views/elabs/layouts/application_admin.html.haml +33 -0
- data/app/views/elabs/layouts/application_member.html.haml +36 -0
- data/app/views/elabs/layouts/{lists → content_classifiers_lists}/_albums.html.haml +0 -0
- data/app/views/elabs/layouts/{lists → content_classifiers_lists}/_projects.html.haml +0 -0
- data/app/views/elabs/layouts/{lists → content_classifiers_lists}/_tags.html.haml +0 -0
- data/app/views/elabs/layouts/{_shortcode_infinite_loop.html.haml → shortcodes/_infinite_loop.html.haml} +1 -1
- data/app/views/elabs/layouts/{_shortcode_infinite_loop_inline.html.haml → shortcodes/_infinite_loop_inline.html.haml} +0 -0
- data/app/views/elabs/layouts/{_shortcode_missing_content.html.haml → shortcodes/_missing_content.html.haml} +1 -1
- data/app/views/elabs/layouts/{_shortcode_missing_content_inline.html.haml → shortcodes/_missing_content_inline.html.haml} +0 -0
- data/app/views/elabs/layouts/shortcodes/_open_to_see.html.haml +2 -0
- data/app/views/elabs/layouts/{widgets → shortcodes/widgets}/_github_repo_card.html.haml +1 -1
- data/app/views/elabs/layouts/{widgets → shortcodes/widgets}/_github_repo_inline.html.haml +0 -0
- data/app/views/elabs/layouts/{widgets → shortcodes/widgets}/_github_user_card.html.haml +0 -0
- data/app/views/elabs/layouts/{widgets → shortcodes/widgets}/_gitlab_group_card.html.haml +1 -1
- data/app/views/elabs/layouts/{widgets → shortcodes/widgets}/_gitlab_repo_card.html.haml +1 -1
- data/app/views/elabs/layouts/{widgets → shortcodes/widgets}/_gitlab_repo_inline.html.haml +0 -0
- data/app/views/elabs/layouts/{widgets → shortcodes/widgets}/_gitlab_user_card.html.haml +1 -1
- data/app/views/elabs/layouts/shortcodes/widgets/vue/_all_widgets.html.haml +5 -0
- data/app/views/elabs/layouts/{widgets → shortcodes/widgets}/vue/_github_repo_card_vue.html.haml +8 -8
- data/app/views/elabs/layouts/{widgets → shortcodes/widgets}/vue/_github_user_card_vue.html.haml +5 -5
- data/app/views/elabs/layouts/{widgets → shortcodes/widgets}/vue/_gitlab_group_card_vue.html.haml +5 -5
- data/app/views/elabs/layouts/{widgets → shortcodes/widgets}/vue/_gitlab_repo_card_vue.html.haml +8 -8
- data/app/views/elabs/layouts/{widgets → shortcodes/widgets}/vue/_gitlab_user_card_vue.html.haml +4 -4
- data/app/views/elabs/licenses/_filters.html.haml +3 -2
- data/app/views/elabs/licenses/index.html.haml +14 -12
- data/app/views/elabs/licenses/show.html.haml +40 -34
- data/app/views/elabs/member/albums/_form.html.haml +1 -43
- data/app/views/elabs/member/articles/_form.html.haml +1 -39
- data/app/views/elabs/member/layouts/_form_commons.html.haml +55 -0
- data/app/views/elabs/member/notes/_form.html.haml +1 -39
- data/app/views/elabs/member/preferences/edit.html.haml +1 -2
- data/app/views/elabs/member/projects/_form.html.haml +3 -38
- data/app/views/elabs/member/uploads/_form.html.haml +1 -42
- data/app/views/elabs/member/uploads/_upload.json.jbuilder +3 -3
- data/app/views/elabs/member/users/edit.html.haml +3 -4
- data/app/views/elabs/notes/_filters.html.haml +5 -3
- data/app/views/elabs/notes/index.html.haml +1 -1
- data/app/views/elabs/notes/show.html.haml +33 -25
- data/app/views/elabs/projects/_filters.html.haml +5 -3
- data/app/views/elabs/projects/index.html.haml +1 -1
- data/app/views/elabs/projects/show.html.haml +68 -62
- data/app/views/elabs/reports/_form.html.haml +2 -0
- data/app/views/elabs/tags/_filters.html.haml +3 -2
- data/app/views/elabs/tags/index.html.haml +11 -11
- data/app/views/elabs/tags/show.html.haml +31 -28
- data/app/views/elabs/uploads/_filters.html.haml +5 -3
- data/app/views/elabs/uploads/_preview.html.haml +5 -4
- data/app/views/elabs/uploads/_thumbnail.html.haml +9 -0
- data/app/views/elabs/uploads/_upload.json.jbuilder +3 -3
- data/app/views/elabs/uploads/index.html.haml +1 -1
- data/app/views/elabs/uploads/show.html.haml +45 -39
- data/app/views/elabs/users/_filters.html.haml +3 -2
- data/app/views/elabs/users/_user.html.haml +3 -3
- data/app/views/elabs/users/show.html.haml +48 -43
- data/config/routes.rb +13 -8
- data/db/migrate/20181025084232_add_archived_field_to_comments.rb +5 -0
- data/db/migrate/20181026071743_delete_comment_notifications.rb +5 -0
- data/db/migrate/20181030063505_create_announcements.rb +14 -0
- data/docs/CODEOWNERS +10 -0
- data/docs/migrating.md +16 -1
- data/docs/shortcodes_guide.md +51 -0
- data/lib/assets/javascripts/README-highlight.js.md +5 -5
- data/lib/assets/javascripts/highlight.js-9.13.1/highlight.pack.js +2 -0
- data/lib/assets/stylesheets/{highlight.js-9.12.0 → highlight.js-9.13.1}/styles/atelier-sulphurpool-light.css +0 -0
- data/lib/elabs.rb +8 -0
- data/lib/elabs/version.rb +1 -1
- data/lib/generators/elabs/{devise_views_generator.rb → devise_mailer_views_generator.rb} +2 -2
- data/lib/generators/elabs/images_generator.rb +24 -0
- data/lib/generators/elabs/required_assets_generator.rb +0 -2
- data/lib/generators/templates/elabs.rb +3 -0
- data/locale/app.pot +132 -19
- data/locale/en/app.edit.po +130 -17
- data/locale/en/app.po +130 -17
- data/locale/fr/app.edit.po +145 -28
- data/locale/fr/app.po +141 -27
- data/package.json +10 -12
- data/yarn.lock +885 -668
- metadata +136 -97
- data/app/assets/stylesheets/elabs/_icons.scss +0 -17
- data/app/assets/stylesheets/elabs/app/_acts.scss +0 -69
- data/app/assets/stylesheets/elabs/app/_alerts.scss +0 -3
- data/app/assets/stylesheets/elabs/app/_badges.scss +0 -11
- data/app/assets/stylesheets/elabs/app/_buttons.scss +0 -29
- data/app/assets/stylesheets/elabs/app/_content.scss +0 -25
- data/app/assets/stylesheets/elabs/app/_content_statuses.scss +0 -32
- data/app/assets/stylesheets/elabs/app/_content_uploads.scss +0 -39
- data/app/assets/stylesheets/elabs/app/_empty.scss +0 -19
- data/app/assets/stylesheets/elabs/app/_errors.scss +0 -9
- data/app/assets/stylesheets/elabs/app/_filter_links.scss +0 -27
- data/app/assets/stylesheets/elabs/app/_forms.scss +0 -74
- data/app/assets/stylesheets/elabs/app/_languages.scss +0 -6
- data/app/assets/stylesheets/elabs/app/_layout.scss +0 -206
- data/app/assets/stylesheets/elabs/app/_licenses.scss +0 -6
- data/app/assets/stylesheets/elabs/app/_link-to-top.scss +0 -8
- data/app/assets/stylesheets/elabs/app/_tabs.scss +0 -54
- data/app/assets/stylesheets/elabs/app/_tags.scss +0 -6
- data/app/assets/stylesheets/elabs/app/_toolbars.scss +0 -3
- data/app/assets/stylesheets/elabs/app/_users.scss +0 -21
- data/app/assets/stylesheets/elabs/app/admin-members/_forms.scss +0 -13
- data/app/assets/stylesheets/elabs/app/admin-members/_indexes.scss +0 -46
- data/app/assets/stylesheets/elabs/app/admin-members/_layout.scss +0 -17
- data/app/assets/stylesheets/elabs/app/areas/_devise.scss +0 -31
- data/app/assets/stylesheets/elabs/app/components/_cards.scss +0 -16
- data/app/assets/stylesheets/elabs/app/components/_container.scss +0 -4
- data/app/assets/stylesheets/elabs/app/mixins/_classifier-card.scss +0 -16
- data/app/assets/stylesheets/elabs/app/mixins/_content-card.scss +0 -72
- data/app/assets/stylesheets/elabs/app/mixins/_content-full.scss +0 -77
- data/app/assets/stylesheets/elabs/app/widgets/_git-cards.scss +0 -88
- data/app/assets/stylesheets/elabs/lib/fontawesome/_icons.scss +0 -1118
- data/app/assets/stylesheets/elabs/lib/knacss/_knacss-variables.scss +0 -239
- data/app/views/elabs/albums/_album.html.haml +0 -38
- data/app/views/elabs/articles/_article.html.haml +0 -30
- data/app/views/elabs/languages/_associations.html.haml +0 -61
- data/app/views/elabs/layouts/_shortcode_open_to_see.html.haml +0 -2
- data/app/views/elabs/layouts/admin_application.html.haml +0 -21
- data/app/views/elabs/layouts/member_application.html.haml +0 -24
- data/app/views/elabs/layouts/widgets/vue/_all_widgets.html.haml +0 -5
- data/app/views/elabs/licenses/_associations.html.haml +0 -61
- data/app/views/elabs/notes/_note.html.haml +0 -31
- data/app/views/elabs/projects/_associations.html.haml +0 -54
- data/app/views/elabs/projects/_project.html.haml +0 -29
- data/app/views/elabs/tags/_associations.html.haml +0 -61
- data/app/views/elabs/uploads/_upload.html.haml +0 -41
- data/app/views/elabs/users/_associations.html.haml +0 -61
- data/db/seeds.rb +0 -10
- data/db/seeds_development.rb +0 -21
- data/db/seeds_production.rb +0 -0
- data/lib/assets/javascripts/codemirror-5.39.2/addon/mode/overlay.js +0 -90
- data/lib/assets/javascripts/codemirror-5.39.2/lib/codemirror.js +0 -9684
- data/lib/assets/javascripts/codemirror-5.39.2/mode/clike/clike.js +0 -834
- data/lib/assets/javascripts/codemirror-5.39.2/mode/css/css.js +0 -832
- data/lib/assets/javascripts/codemirror-5.39.2/mode/gfm/gfm.js +0 -129
- data/lib/assets/javascripts/codemirror-5.39.2/mode/htmlmixed/htmlmixed.js +0 -152
- data/lib/assets/javascripts/codemirror-5.39.2/mode/javascript/javascript.js +0 -896
- data/lib/assets/javascripts/codemirror-5.39.2/mode/markdown/markdown.js +0 -882
- data/lib/assets/javascripts/codemirror-5.39.2/mode/meta.js +0 -217
- data/lib/assets/javascripts/codemirror-5.39.2/mode/xml/xml.js +0 -402
- data/lib/assets/javascripts/highlight.js-9.12.0/highlight.pack.js +0 -2
- data/lib/assets/stylesheets/codemirror-5.39.2/lib/codemirror.css +0 -346
- data/lib/assets/stylesheets/codemirror-5.39.2/theme/base16-dark.css +0 -38
- data/lib/assets/stylesheets/codemirror-5.39.2/theme/base16-light.css +0 -38
@@ -1,882 +0,0 @@
|
|
1
|
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2
|
-
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
3
|
-
|
4
|
-
(function(mod) {
|
5
|
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6
|
-
mod(require("../../lib/codemirror"), require("../xml/xml"), require("../meta"));
|
7
|
-
else if (typeof define == "function" && define.amd) // AMD
|
8
|
-
define(["../../lib/codemirror", "../xml/xml", "../meta"], mod);
|
9
|
-
else // Plain browser env
|
10
|
-
mod(CodeMirror);
|
11
|
-
})(function(CodeMirror) {
|
12
|
-
"use strict";
|
13
|
-
|
14
|
-
CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
15
|
-
|
16
|
-
var htmlMode = CodeMirror.getMode(cmCfg, "text/html");
|
17
|
-
var htmlModeMissing = htmlMode.name == "null"
|
18
|
-
|
19
|
-
function getMode(name) {
|
20
|
-
if (CodeMirror.findModeByName) {
|
21
|
-
var found = CodeMirror.findModeByName(name);
|
22
|
-
if (found) name = found.mime || found.mimes[0];
|
23
|
-
}
|
24
|
-
var mode = CodeMirror.getMode(cmCfg, name);
|
25
|
-
return mode.name == "null" ? null : mode;
|
26
|
-
}
|
27
|
-
|
28
|
-
// Should characters that affect highlighting be highlighted separate?
|
29
|
-
// Does not include characters that will be output (such as `1.` and `-` for lists)
|
30
|
-
if (modeCfg.highlightFormatting === undefined)
|
31
|
-
modeCfg.highlightFormatting = false;
|
32
|
-
|
33
|
-
// Maximum number of nested blockquotes. Set to 0 for infinite nesting.
|
34
|
-
// Excess `>` will emit `error` token.
|
35
|
-
if (modeCfg.maxBlockquoteDepth === undefined)
|
36
|
-
modeCfg.maxBlockquoteDepth = 0;
|
37
|
-
|
38
|
-
// Turn on task lists? ("- [ ] " and "- [x] ")
|
39
|
-
if (modeCfg.taskLists === undefined) modeCfg.taskLists = false;
|
40
|
-
|
41
|
-
// Turn on strikethrough syntax
|
42
|
-
if (modeCfg.strikethrough === undefined)
|
43
|
-
modeCfg.strikethrough = false;
|
44
|
-
|
45
|
-
if (modeCfg.emoji === undefined)
|
46
|
-
modeCfg.emoji = false;
|
47
|
-
|
48
|
-
if (modeCfg.fencedCodeBlockHighlighting === undefined)
|
49
|
-
modeCfg.fencedCodeBlockHighlighting = true;
|
50
|
-
|
51
|
-
if (modeCfg.xml === undefined)
|
52
|
-
modeCfg.xml = true;
|
53
|
-
|
54
|
-
// Allow token types to be overridden by user-provided token types.
|
55
|
-
if (modeCfg.tokenTypeOverrides === undefined)
|
56
|
-
modeCfg.tokenTypeOverrides = {};
|
57
|
-
|
58
|
-
var tokenTypes = {
|
59
|
-
header: "header",
|
60
|
-
code: "comment",
|
61
|
-
quote: "quote",
|
62
|
-
list1: "variable-2",
|
63
|
-
list2: "variable-3",
|
64
|
-
list3: "keyword",
|
65
|
-
hr: "hr",
|
66
|
-
image: "image",
|
67
|
-
imageAltText: "image-alt-text",
|
68
|
-
imageMarker: "image-marker",
|
69
|
-
formatting: "formatting",
|
70
|
-
linkInline: "link",
|
71
|
-
linkEmail: "link",
|
72
|
-
linkText: "link",
|
73
|
-
linkHref: "string",
|
74
|
-
em: "em",
|
75
|
-
strong: "strong",
|
76
|
-
strikethrough: "strikethrough",
|
77
|
-
emoji: "builtin"
|
78
|
-
};
|
79
|
-
|
80
|
-
for (var tokenType in tokenTypes) {
|
81
|
-
if (tokenTypes.hasOwnProperty(tokenType) && modeCfg.tokenTypeOverrides[tokenType]) {
|
82
|
-
tokenTypes[tokenType] = modeCfg.tokenTypeOverrides[tokenType];
|
83
|
-
}
|
84
|
-
}
|
85
|
-
|
86
|
-
var hrRE = /^([*\-_])(?:\s*\1){2,}\s*$/
|
87
|
-
, listRE = /^(?:[*\-+]|^[0-9]+([.)]))\s+/
|
88
|
-
, taskListRE = /^\[(x| )\](?=\s)/i // Must follow listRE
|
89
|
-
, atxHeaderRE = modeCfg.allowAtxHeaderWithoutSpace ? /^(#+)/ : /^(#+)(?: |$)/
|
90
|
-
, setextHeaderRE = /^ *(?:\={1,}|-{1,})\s*$/
|
91
|
-
, textRE = /^[^#!\[\]*_\\<>` "'(~:]+/
|
92
|
-
, fencedCodeRE = /^(~~~+|```+)[ \t]*([\w+#-]*)[^\n`]*$/
|
93
|
-
, linkDefRE = /^\s*\[[^\]]+?\]:.*$/ // naive link-definition
|
94
|
-
, punctuation = /[!\"#$%&\'()*+,\-\.\/:;<=>?@\[\\\]^_`{|}~—]/
|
95
|
-
, expandedTab = " " // CommonMark specifies tab as 4 spaces
|
96
|
-
|
97
|
-
function switchInline(stream, state, f) {
|
98
|
-
state.f = state.inline = f;
|
99
|
-
return f(stream, state);
|
100
|
-
}
|
101
|
-
|
102
|
-
function switchBlock(stream, state, f) {
|
103
|
-
state.f = state.block = f;
|
104
|
-
return f(stream, state);
|
105
|
-
}
|
106
|
-
|
107
|
-
function lineIsEmpty(line) {
|
108
|
-
return !line || !/\S/.test(line.string)
|
109
|
-
}
|
110
|
-
|
111
|
-
// Blocks
|
112
|
-
|
113
|
-
function blankLine(state) {
|
114
|
-
// Reset linkTitle state
|
115
|
-
state.linkTitle = false;
|
116
|
-
state.linkHref = false;
|
117
|
-
state.linkText = false;
|
118
|
-
// Reset EM state
|
119
|
-
state.em = false;
|
120
|
-
// Reset STRONG state
|
121
|
-
state.strong = false;
|
122
|
-
// Reset strikethrough state
|
123
|
-
state.strikethrough = false;
|
124
|
-
// Reset state.quote
|
125
|
-
state.quote = 0;
|
126
|
-
// Reset state.indentedCode
|
127
|
-
state.indentedCode = false;
|
128
|
-
if (state.f == htmlBlock) {
|
129
|
-
var exit = htmlModeMissing
|
130
|
-
if (!exit) {
|
131
|
-
var inner = CodeMirror.innerMode(htmlMode, state.htmlState)
|
132
|
-
exit = inner.mode.name == "xml" && inner.state.tagStart === null &&
|
133
|
-
(!inner.state.context && inner.state.tokenize.isInText)
|
134
|
-
}
|
135
|
-
if (exit) {
|
136
|
-
state.f = inlineNormal;
|
137
|
-
state.block = blockNormal;
|
138
|
-
state.htmlState = null;
|
139
|
-
}
|
140
|
-
}
|
141
|
-
// Reset state.trailingSpace
|
142
|
-
state.trailingSpace = 0;
|
143
|
-
state.trailingSpaceNewLine = false;
|
144
|
-
// Mark this line as blank
|
145
|
-
state.prevLine = state.thisLine
|
146
|
-
state.thisLine = {stream: null}
|
147
|
-
return null;
|
148
|
-
}
|
149
|
-
|
150
|
-
function blockNormal(stream, state) {
|
151
|
-
var firstTokenOnLine = stream.column() === state.indentation;
|
152
|
-
var prevLineLineIsEmpty = lineIsEmpty(state.prevLine.stream);
|
153
|
-
var prevLineIsIndentedCode = state.indentedCode;
|
154
|
-
var prevLineIsHr = state.prevLine.hr;
|
155
|
-
var prevLineIsList = state.list !== false;
|
156
|
-
var maxNonCodeIndentation = (state.listStack[state.listStack.length - 1] || 0) + 3;
|
157
|
-
|
158
|
-
state.indentedCode = false;
|
159
|
-
|
160
|
-
var lineIndentation = state.indentation;
|
161
|
-
// compute once per line (on first token)
|
162
|
-
if (state.indentationDiff === null) {
|
163
|
-
state.indentationDiff = state.indentation;
|
164
|
-
if (prevLineIsList) {
|
165
|
-
// Reset inline styles which shouldn't propagate aross list items
|
166
|
-
state.em = false;
|
167
|
-
state.strong = false;
|
168
|
-
state.code = false;
|
169
|
-
state.strikethrough = false;
|
170
|
-
|
171
|
-
state.list = null;
|
172
|
-
// While this list item's marker's indentation is less than the deepest
|
173
|
-
// list item's content's indentation,pop the deepest list item
|
174
|
-
// indentation off the stack, and update block indentation state
|
175
|
-
while (lineIndentation < state.listStack[state.listStack.length - 1]) {
|
176
|
-
state.listStack.pop();
|
177
|
-
if (state.listStack.length) {
|
178
|
-
state.indentation = state.listStack[state.listStack.length - 1];
|
179
|
-
// less than the first list's indent -> the line is no longer a list
|
180
|
-
} else {
|
181
|
-
state.list = false;
|
182
|
-
}
|
183
|
-
}
|
184
|
-
if (state.list !== false) {
|
185
|
-
state.indentationDiff = lineIndentation - state.listStack[state.listStack.length - 1]
|
186
|
-
}
|
187
|
-
}
|
188
|
-
}
|
189
|
-
|
190
|
-
// not comprehensive (currently only for setext detection purposes)
|
191
|
-
var allowsInlineContinuation = (
|
192
|
-
!prevLineLineIsEmpty && !prevLineIsHr && !state.prevLine.header &&
|
193
|
-
(!prevLineIsList || !prevLineIsIndentedCode) &&
|
194
|
-
!state.prevLine.fencedCodeEnd
|
195
|
-
);
|
196
|
-
|
197
|
-
var isHr = (state.list === false || prevLineIsHr || prevLineLineIsEmpty) &&
|
198
|
-
state.indentation <= maxNonCodeIndentation && stream.match(hrRE);
|
199
|
-
|
200
|
-
var match = null;
|
201
|
-
if (state.indentationDiff >= 4 && (prevLineIsIndentedCode || state.prevLine.fencedCodeEnd ||
|
202
|
-
state.prevLine.header || prevLineLineIsEmpty)) {
|
203
|
-
stream.skipToEnd();
|
204
|
-
state.indentedCode = true;
|
205
|
-
return tokenTypes.code;
|
206
|
-
} else if (stream.eatSpace()) {
|
207
|
-
return null;
|
208
|
-
} else if (firstTokenOnLine && state.indentation <= maxNonCodeIndentation && (match = stream.match(atxHeaderRE)) && match[1].length <= 6) {
|
209
|
-
state.quote = 0;
|
210
|
-
state.header = match[1].length;
|
211
|
-
state.thisLine.header = true;
|
212
|
-
if (modeCfg.highlightFormatting) state.formatting = "header";
|
213
|
-
state.f = state.inline;
|
214
|
-
return getType(state);
|
215
|
-
} else if (state.indentation <= maxNonCodeIndentation && stream.eat('>')) {
|
216
|
-
state.quote = firstTokenOnLine ? 1 : state.quote + 1;
|
217
|
-
if (modeCfg.highlightFormatting) state.formatting = "quote";
|
218
|
-
stream.eatSpace();
|
219
|
-
return getType(state);
|
220
|
-
} else if (!isHr && !state.setext && firstTokenOnLine && state.indentation <= maxNonCodeIndentation && (match = stream.match(listRE))) {
|
221
|
-
var listType = match[1] ? "ol" : "ul";
|
222
|
-
|
223
|
-
state.indentation = lineIndentation + stream.current().length;
|
224
|
-
state.list = true;
|
225
|
-
state.quote = 0;
|
226
|
-
|
227
|
-
// Add this list item's content's indentation to the stack
|
228
|
-
state.listStack.push(state.indentation);
|
229
|
-
|
230
|
-
if (modeCfg.taskLists && stream.match(taskListRE, false)) {
|
231
|
-
state.taskList = true;
|
232
|
-
}
|
233
|
-
state.f = state.inline;
|
234
|
-
if (modeCfg.highlightFormatting) state.formatting = ["list", "list-" + listType];
|
235
|
-
return getType(state);
|
236
|
-
} else if (firstTokenOnLine && state.indentation <= maxNonCodeIndentation && (match = stream.match(fencedCodeRE, true))) {
|
237
|
-
state.quote = 0;
|
238
|
-
state.fencedEndRE = new RegExp(match[1] + "+ *$");
|
239
|
-
// try switching mode
|
240
|
-
state.localMode = modeCfg.fencedCodeBlockHighlighting && getMode(match[2]);
|
241
|
-
if (state.localMode) state.localState = CodeMirror.startState(state.localMode);
|
242
|
-
state.f = state.block = local;
|
243
|
-
if (modeCfg.highlightFormatting) state.formatting = "code-block";
|
244
|
-
state.code = -1
|
245
|
-
return getType(state);
|
246
|
-
// SETEXT has lowest block-scope precedence after HR, so check it after
|
247
|
-
// the others (code, blockquote, list...)
|
248
|
-
} else if (
|
249
|
-
// if setext set, indicates line after ---/===
|
250
|
-
state.setext || (
|
251
|
-
// line before ---/===
|
252
|
-
(!allowsInlineContinuation || !prevLineIsList) && !state.quote && state.list === false &&
|
253
|
-
!state.code && !isHr && !linkDefRE.test(stream.string) &&
|
254
|
-
(match = stream.lookAhead(1)) && (match = match.match(setextHeaderRE))
|
255
|
-
)
|
256
|
-
) {
|
257
|
-
if ( !state.setext ) {
|
258
|
-
state.header = match[0].charAt(0) == '=' ? 1 : 2;
|
259
|
-
state.setext = state.header;
|
260
|
-
} else {
|
261
|
-
state.header = state.setext;
|
262
|
-
// has no effect on type so we can reset it now
|
263
|
-
state.setext = 0;
|
264
|
-
stream.skipToEnd();
|
265
|
-
if (modeCfg.highlightFormatting) state.formatting = "header";
|
266
|
-
}
|
267
|
-
state.thisLine.header = true;
|
268
|
-
state.f = state.inline;
|
269
|
-
return getType(state);
|
270
|
-
} else if (isHr) {
|
271
|
-
stream.skipToEnd();
|
272
|
-
state.hr = true;
|
273
|
-
state.thisLine.hr = true;
|
274
|
-
return tokenTypes.hr;
|
275
|
-
} else if (stream.peek() === '[') {
|
276
|
-
return switchInline(stream, state, footnoteLink);
|
277
|
-
}
|
278
|
-
|
279
|
-
return switchInline(stream, state, state.inline);
|
280
|
-
}
|
281
|
-
|
282
|
-
function htmlBlock(stream, state) {
|
283
|
-
var style = htmlMode.token(stream, state.htmlState);
|
284
|
-
if (!htmlModeMissing) {
|
285
|
-
var inner = CodeMirror.innerMode(htmlMode, state.htmlState)
|
286
|
-
if ((inner.mode.name == "xml" && inner.state.tagStart === null &&
|
287
|
-
(!inner.state.context && inner.state.tokenize.isInText)) ||
|
288
|
-
(state.md_inside && stream.current().indexOf(">") > -1)) {
|
289
|
-
state.f = inlineNormal;
|
290
|
-
state.block = blockNormal;
|
291
|
-
state.htmlState = null;
|
292
|
-
}
|
293
|
-
}
|
294
|
-
return style;
|
295
|
-
}
|
296
|
-
|
297
|
-
function local(stream, state) {
|
298
|
-
var currListInd = state.listStack[state.listStack.length - 1] || 0;
|
299
|
-
var hasExitedList = state.indentation < currListInd;
|
300
|
-
var maxFencedEndInd = currListInd + 3;
|
301
|
-
if (state.fencedEndRE && state.indentation <= maxFencedEndInd && (hasExitedList || stream.match(state.fencedEndRE))) {
|
302
|
-
if (modeCfg.highlightFormatting) state.formatting = "code-block";
|
303
|
-
var returnType;
|
304
|
-
if (!hasExitedList) returnType = getType(state)
|
305
|
-
state.localMode = state.localState = null;
|
306
|
-
state.block = blockNormal;
|
307
|
-
state.f = inlineNormal;
|
308
|
-
state.fencedEndRE = null;
|
309
|
-
state.code = 0
|
310
|
-
state.thisLine.fencedCodeEnd = true;
|
311
|
-
if (hasExitedList) return switchBlock(stream, state, state.block);
|
312
|
-
return returnType;
|
313
|
-
} else if (state.localMode) {
|
314
|
-
return state.localMode.token(stream, state.localState);
|
315
|
-
} else {
|
316
|
-
stream.skipToEnd();
|
317
|
-
return tokenTypes.code;
|
318
|
-
}
|
319
|
-
}
|
320
|
-
|
321
|
-
// Inline
|
322
|
-
function getType(state) {
|
323
|
-
var styles = [];
|
324
|
-
|
325
|
-
if (state.formatting) {
|
326
|
-
styles.push(tokenTypes.formatting);
|
327
|
-
|
328
|
-
if (typeof state.formatting === "string") state.formatting = [state.formatting];
|
329
|
-
|
330
|
-
for (var i = 0; i < state.formatting.length; i++) {
|
331
|
-
styles.push(tokenTypes.formatting + "-" + state.formatting[i]);
|
332
|
-
|
333
|
-
if (state.formatting[i] === "header") {
|
334
|
-
styles.push(tokenTypes.formatting + "-" + state.formatting[i] + "-" + state.header);
|
335
|
-
}
|
336
|
-
|
337
|
-
// Add `formatting-quote` and `formatting-quote-#` for blockquotes
|
338
|
-
// Add `error` instead if the maximum blockquote nesting depth is passed
|
339
|
-
if (state.formatting[i] === "quote") {
|
340
|
-
if (!modeCfg.maxBlockquoteDepth || modeCfg.maxBlockquoteDepth >= state.quote) {
|
341
|
-
styles.push(tokenTypes.formatting + "-" + state.formatting[i] + "-" + state.quote);
|
342
|
-
} else {
|
343
|
-
styles.push("error");
|
344
|
-
}
|
345
|
-
}
|
346
|
-
}
|
347
|
-
}
|
348
|
-
|
349
|
-
if (state.taskOpen) {
|
350
|
-
styles.push("meta");
|
351
|
-
return styles.length ? styles.join(' ') : null;
|
352
|
-
}
|
353
|
-
if (state.taskClosed) {
|
354
|
-
styles.push("property");
|
355
|
-
return styles.length ? styles.join(' ') : null;
|
356
|
-
}
|
357
|
-
|
358
|
-
if (state.linkHref) {
|
359
|
-
styles.push(tokenTypes.linkHref, "url");
|
360
|
-
} else { // Only apply inline styles to non-url text
|
361
|
-
if (state.strong) { styles.push(tokenTypes.strong); }
|
362
|
-
if (state.em) { styles.push(tokenTypes.em); }
|
363
|
-
if (state.strikethrough) { styles.push(tokenTypes.strikethrough); }
|
364
|
-
if (state.emoji) { styles.push(tokenTypes.emoji); }
|
365
|
-
if (state.linkText) { styles.push(tokenTypes.linkText); }
|
366
|
-
if (state.code) { styles.push(tokenTypes.code); }
|
367
|
-
if (state.image) { styles.push(tokenTypes.image); }
|
368
|
-
if (state.imageAltText) { styles.push(tokenTypes.imageAltText, "link"); }
|
369
|
-
if (state.imageMarker) { styles.push(tokenTypes.imageMarker); }
|
370
|
-
}
|
371
|
-
|
372
|
-
if (state.header) { styles.push(tokenTypes.header, tokenTypes.header + "-" + state.header); }
|
373
|
-
|
374
|
-
if (state.quote) {
|
375
|
-
styles.push(tokenTypes.quote);
|
376
|
-
|
377
|
-
// Add `quote-#` where the maximum for `#` is modeCfg.maxBlockquoteDepth
|
378
|
-
if (!modeCfg.maxBlockquoteDepth || modeCfg.maxBlockquoteDepth >= state.quote) {
|
379
|
-
styles.push(tokenTypes.quote + "-" + state.quote);
|
380
|
-
} else {
|
381
|
-
styles.push(tokenTypes.quote + "-" + modeCfg.maxBlockquoteDepth);
|
382
|
-
}
|
383
|
-
}
|
384
|
-
|
385
|
-
if (state.list !== false) {
|
386
|
-
var listMod = (state.listStack.length - 1) % 3;
|
387
|
-
if (!listMod) {
|
388
|
-
styles.push(tokenTypes.list1);
|
389
|
-
} else if (listMod === 1) {
|
390
|
-
styles.push(tokenTypes.list2);
|
391
|
-
} else {
|
392
|
-
styles.push(tokenTypes.list3);
|
393
|
-
}
|
394
|
-
}
|
395
|
-
|
396
|
-
if (state.trailingSpaceNewLine) {
|
397
|
-
styles.push("trailing-space-new-line");
|
398
|
-
} else if (state.trailingSpace) {
|
399
|
-
styles.push("trailing-space-" + (state.trailingSpace % 2 ? "a" : "b"));
|
400
|
-
}
|
401
|
-
|
402
|
-
return styles.length ? styles.join(' ') : null;
|
403
|
-
}
|
404
|
-
|
405
|
-
function handleText(stream, state) {
|
406
|
-
if (stream.match(textRE, true)) {
|
407
|
-
return getType(state);
|
408
|
-
}
|
409
|
-
return undefined;
|
410
|
-
}
|
411
|
-
|
412
|
-
function inlineNormal(stream, state) {
|
413
|
-
var style = state.text(stream, state);
|
414
|
-
if (typeof style !== 'undefined')
|
415
|
-
return style;
|
416
|
-
|
417
|
-
if (state.list) { // List marker (*, +, -, 1., etc)
|
418
|
-
state.list = null;
|
419
|
-
return getType(state);
|
420
|
-
}
|
421
|
-
|
422
|
-
if (state.taskList) {
|
423
|
-
var taskOpen = stream.match(taskListRE, true)[1] === " ";
|
424
|
-
if (taskOpen) state.taskOpen = true;
|
425
|
-
else state.taskClosed = true;
|
426
|
-
if (modeCfg.highlightFormatting) state.formatting = "task";
|
427
|
-
state.taskList = false;
|
428
|
-
return getType(state);
|
429
|
-
}
|
430
|
-
|
431
|
-
state.taskOpen = false;
|
432
|
-
state.taskClosed = false;
|
433
|
-
|
434
|
-
if (state.header && stream.match(/^#+$/, true)) {
|
435
|
-
if (modeCfg.highlightFormatting) state.formatting = "header";
|
436
|
-
return getType(state);
|
437
|
-
}
|
438
|
-
|
439
|
-
var ch = stream.next();
|
440
|
-
|
441
|
-
// Matches link titles present on next line
|
442
|
-
if (state.linkTitle) {
|
443
|
-
state.linkTitle = false;
|
444
|
-
var matchCh = ch;
|
445
|
-
if (ch === '(') {
|
446
|
-
matchCh = ')';
|
447
|
-
}
|
448
|
-
matchCh = (matchCh+'').replace(/([.?*+^\[\]\\(){}|-])/g, "\\$1");
|
449
|
-
var regex = '^\\s*(?:[^' + matchCh + '\\\\]+|\\\\\\\\|\\\\.)' + matchCh;
|
450
|
-
if (stream.match(new RegExp(regex), true)) {
|
451
|
-
return tokenTypes.linkHref;
|
452
|
-
}
|
453
|
-
}
|
454
|
-
|
455
|
-
// If this block is changed, it may need to be updated in GFM mode
|
456
|
-
if (ch === '`') {
|
457
|
-
var previousFormatting = state.formatting;
|
458
|
-
if (modeCfg.highlightFormatting) state.formatting = "code";
|
459
|
-
stream.eatWhile('`');
|
460
|
-
var count = stream.current().length
|
461
|
-
if (state.code == 0 && (!state.quote || count == 1)) {
|
462
|
-
state.code = count
|
463
|
-
return getType(state)
|
464
|
-
} else if (count == state.code) { // Must be exact
|
465
|
-
var t = getType(state)
|
466
|
-
state.code = 0
|
467
|
-
return t
|
468
|
-
} else {
|
469
|
-
state.formatting = previousFormatting
|
470
|
-
return getType(state)
|
471
|
-
}
|
472
|
-
} else if (state.code) {
|
473
|
-
return getType(state);
|
474
|
-
}
|
475
|
-
|
476
|
-
if (ch === '\\') {
|
477
|
-
stream.next();
|
478
|
-
if (modeCfg.highlightFormatting) {
|
479
|
-
var type = getType(state);
|
480
|
-
var formattingEscape = tokenTypes.formatting + "-escape";
|
481
|
-
return type ? type + " " + formattingEscape : formattingEscape;
|
482
|
-
}
|
483
|
-
}
|
484
|
-
|
485
|
-
if (ch === '!' && stream.match(/\[[^\]]*\] ?(?:\(|\[)/, false)) {
|
486
|
-
state.imageMarker = true;
|
487
|
-
state.image = true;
|
488
|
-
if (modeCfg.highlightFormatting) state.formatting = "image";
|
489
|
-
return getType(state);
|
490
|
-
}
|
491
|
-
|
492
|
-
if (ch === '[' && state.imageMarker && stream.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/, false)) {
|
493
|
-
state.imageMarker = false;
|
494
|
-
state.imageAltText = true
|
495
|
-
if (modeCfg.highlightFormatting) state.formatting = "image";
|
496
|
-
return getType(state);
|
497
|
-
}
|
498
|
-
|
499
|
-
if (ch === ']' && state.imageAltText) {
|
500
|
-
if (modeCfg.highlightFormatting) state.formatting = "image";
|
501
|
-
var type = getType(state);
|
502
|
-
state.imageAltText = false;
|
503
|
-
state.image = false;
|
504
|
-
state.inline = state.f = linkHref;
|
505
|
-
return type;
|
506
|
-
}
|
507
|
-
|
508
|
-
if (ch === '[' && !state.image) {
|
509
|
-
if (state.linkText && stream.match(/^.*?\]/)) return getType(state)
|
510
|
-
state.linkText = true;
|
511
|
-
if (modeCfg.highlightFormatting) state.formatting = "link";
|
512
|
-
return getType(state);
|
513
|
-
}
|
514
|
-
|
515
|
-
if (ch === ']' && state.linkText) {
|
516
|
-
if (modeCfg.highlightFormatting) state.formatting = "link";
|
517
|
-
var type = getType(state);
|
518
|
-
state.linkText = false;
|
519
|
-
state.inline = state.f = stream.match(/\(.*?\)| ?\[.*?\]/, false) ? linkHref : inlineNormal
|
520
|
-
return type;
|
521
|
-
}
|
522
|
-
|
523
|
-
if (ch === '<' && stream.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/, false)) {
|
524
|
-
state.f = state.inline = linkInline;
|
525
|
-
if (modeCfg.highlightFormatting) state.formatting = "link";
|
526
|
-
var type = getType(state);
|
527
|
-
if (type){
|
528
|
-
type += " ";
|
529
|
-
} else {
|
530
|
-
type = "";
|
531
|
-
}
|
532
|
-
return type + tokenTypes.linkInline;
|
533
|
-
}
|
534
|
-
|
535
|
-
if (ch === '<' && stream.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/, false)) {
|
536
|
-
state.f = state.inline = linkInline;
|
537
|
-
if (modeCfg.highlightFormatting) state.formatting = "link";
|
538
|
-
var type = getType(state);
|
539
|
-
if (type){
|
540
|
-
type += " ";
|
541
|
-
} else {
|
542
|
-
type = "";
|
543
|
-
}
|
544
|
-
return type + tokenTypes.linkEmail;
|
545
|
-
}
|
546
|
-
|
547
|
-
if (modeCfg.xml && ch === '<' && stream.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i, false)) {
|
548
|
-
var end = stream.string.indexOf(">", stream.pos);
|
549
|
-
if (end != -1) {
|
550
|
-
var atts = stream.string.substring(stream.start, end);
|
551
|
-
if (/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(atts)) state.md_inside = true;
|
552
|
-
}
|
553
|
-
stream.backUp(1);
|
554
|
-
state.htmlState = CodeMirror.startState(htmlMode);
|
555
|
-
return switchBlock(stream, state, htmlBlock);
|
556
|
-
}
|
557
|
-
|
558
|
-
if (modeCfg.xml && ch === '<' && stream.match(/^\/\w*?>/)) {
|
559
|
-
state.md_inside = false;
|
560
|
-
return "tag";
|
561
|
-
} else if (ch === "*" || ch === "_") {
|
562
|
-
var len = 1, before = stream.pos == 1 ? " " : stream.string.charAt(stream.pos - 2)
|
563
|
-
while (len < 3 && stream.eat(ch)) len++
|
564
|
-
var after = stream.peek() || " "
|
565
|
-
// See http://spec.commonmark.org/0.27/#emphasis-and-strong-emphasis
|
566
|
-
var leftFlanking = !/\s/.test(after) && (!punctuation.test(after) || /\s/.test(before) || punctuation.test(before))
|
567
|
-
var rightFlanking = !/\s/.test(before) && (!punctuation.test(before) || /\s/.test(after) || punctuation.test(after))
|
568
|
-
var setEm = null, setStrong = null
|
569
|
-
if (len % 2) { // Em
|
570
|
-
if (!state.em && leftFlanking && (ch === "*" || !rightFlanking || punctuation.test(before)))
|
571
|
-
setEm = true
|
572
|
-
else if (state.em == ch && rightFlanking && (ch === "*" || !leftFlanking || punctuation.test(after)))
|
573
|
-
setEm = false
|
574
|
-
}
|
575
|
-
if (len > 1) { // Strong
|
576
|
-
if (!state.strong && leftFlanking && (ch === "*" || !rightFlanking || punctuation.test(before)))
|
577
|
-
setStrong = true
|
578
|
-
else if (state.strong == ch && rightFlanking && (ch === "*" || !leftFlanking || punctuation.test(after)))
|
579
|
-
setStrong = false
|
580
|
-
}
|
581
|
-
if (setStrong != null || setEm != null) {
|
582
|
-
if (modeCfg.highlightFormatting) state.formatting = setEm == null ? "strong" : setStrong == null ? "em" : "strong em"
|
583
|
-
if (setEm === true) state.em = ch
|
584
|
-
if (setStrong === true) state.strong = ch
|
585
|
-
var t = getType(state)
|
586
|
-
if (setEm === false) state.em = false
|
587
|
-
if (setStrong === false) state.strong = false
|
588
|
-
return t
|
589
|
-
}
|
590
|
-
} else if (ch === ' ') {
|
591
|
-
if (stream.eat('*') || stream.eat('_')) { // Probably surrounded by spaces
|
592
|
-
if (stream.peek() === ' ') { // Surrounded by spaces, ignore
|
593
|
-
return getType(state);
|
594
|
-
} else { // Not surrounded by spaces, back up pointer
|
595
|
-
stream.backUp(1);
|
596
|
-
}
|
597
|
-
}
|
598
|
-
}
|
599
|
-
|
600
|
-
if (modeCfg.strikethrough) {
|
601
|
-
if (ch === '~' && stream.eatWhile(ch)) {
|
602
|
-
if (state.strikethrough) {// Remove strikethrough
|
603
|
-
if (modeCfg.highlightFormatting) state.formatting = "strikethrough";
|
604
|
-
var t = getType(state);
|
605
|
-
state.strikethrough = false;
|
606
|
-
return t;
|
607
|
-
} else if (stream.match(/^[^\s]/, false)) {// Add strikethrough
|
608
|
-
state.strikethrough = true;
|
609
|
-
if (modeCfg.highlightFormatting) state.formatting = "strikethrough";
|
610
|
-
return getType(state);
|
611
|
-
}
|
612
|
-
} else if (ch === ' ') {
|
613
|
-
if (stream.match(/^~~/, true)) { // Probably surrounded by space
|
614
|
-
if (stream.peek() === ' ') { // Surrounded by spaces, ignore
|
615
|
-
return getType(state);
|
616
|
-
} else { // Not surrounded by spaces, back up pointer
|
617
|
-
stream.backUp(2);
|
618
|
-
}
|
619
|
-
}
|
620
|
-
}
|
621
|
-
}
|
622
|
-
|
623
|
-
if (modeCfg.emoji && ch === ":" && stream.match(/^[a-z_\d+-]+:/)) {
|
624
|
-
state.emoji = true;
|
625
|
-
if (modeCfg.highlightFormatting) state.formatting = "emoji";
|
626
|
-
var retType = getType(state);
|
627
|
-
state.emoji = false;
|
628
|
-
return retType;
|
629
|
-
}
|
630
|
-
|
631
|
-
if (ch === ' ') {
|
632
|
-
if (stream.match(/^ +$/, false)) {
|
633
|
-
state.trailingSpace++;
|
634
|
-
} else if (state.trailingSpace) {
|
635
|
-
state.trailingSpaceNewLine = true;
|
636
|
-
}
|
637
|
-
}
|
638
|
-
|
639
|
-
return getType(state);
|
640
|
-
}
|
641
|
-
|
642
|
-
function linkInline(stream, state) {
|
643
|
-
var ch = stream.next();
|
644
|
-
|
645
|
-
if (ch === ">") {
|
646
|
-
state.f = state.inline = inlineNormal;
|
647
|
-
if (modeCfg.highlightFormatting) state.formatting = "link";
|
648
|
-
var type = getType(state);
|
649
|
-
if (type){
|
650
|
-
type += " ";
|
651
|
-
} else {
|
652
|
-
type = "";
|
653
|
-
}
|
654
|
-
return type + tokenTypes.linkInline;
|
655
|
-
}
|
656
|
-
|
657
|
-
stream.match(/^[^>]+/, true);
|
658
|
-
|
659
|
-
return tokenTypes.linkInline;
|
660
|
-
}
|
661
|
-
|
662
|
-
function linkHref(stream, state) {
|
663
|
-
// Check if space, and return NULL if so (to avoid marking the space)
|
664
|
-
if(stream.eatSpace()){
|
665
|
-
return null;
|
666
|
-
}
|
667
|
-
var ch = stream.next();
|
668
|
-
if (ch === '(' || ch === '[') {
|
669
|
-
state.f = state.inline = getLinkHrefInside(ch === "(" ? ")" : "]");
|
670
|
-
if (modeCfg.highlightFormatting) state.formatting = "link-string";
|
671
|
-
state.linkHref = true;
|
672
|
-
return getType(state);
|
673
|
-
}
|
674
|
-
return 'error';
|
675
|
-
}
|
676
|
-
|
677
|
-
var linkRE = {
|
678
|
-
")": /^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,
|
679
|
-
"]": /^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/
|
680
|
-
}
|
681
|
-
|
682
|
-
function getLinkHrefInside(endChar) {
|
683
|
-
return function(stream, state) {
|
684
|
-
var ch = stream.next();
|
685
|
-
|
686
|
-
if (ch === endChar) {
|
687
|
-
state.f = state.inline = inlineNormal;
|
688
|
-
if (modeCfg.highlightFormatting) state.formatting = "link-string";
|
689
|
-
var returnState = getType(state);
|
690
|
-
state.linkHref = false;
|
691
|
-
return returnState;
|
692
|
-
}
|
693
|
-
|
694
|
-
stream.match(linkRE[endChar])
|
695
|
-
state.linkHref = true;
|
696
|
-
return getType(state);
|
697
|
-
};
|
698
|
-
}
|
699
|
-
|
700
|
-
function footnoteLink(stream, state) {
|
701
|
-
if (stream.match(/^([^\]\\]|\\.)*\]:/, false)) {
|
702
|
-
state.f = footnoteLinkInside;
|
703
|
-
stream.next(); // Consume [
|
704
|
-
if (modeCfg.highlightFormatting) state.formatting = "link";
|
705
|
-
state.linkText = true;
|
706
|
-
return getType(state);
|
707
|
-
}
|
708
|
-
return switchInline(stream, state, inlineNormal);
|
709
|
-
}
|
710
|
-
|
711
|
-
function footnoteLinkInside(stream, state) {
|
712
|
-
if (stream.match(/^\]:/, true)) {
|
713
|
-
state.f = state.inline = footnoteUrl;
|
714
|
-
if (modeCfg.highlightFormatting) state.formatting = "link";
|
715
|
-
var returnType = getType(state);
|
716
|
-
state.linkText = false;
|
717
|
-
return returnType;
|
718
|
-
}
|
719
|
-
|
720
|
-
stream.match(/^([^\]\\]|\\.)+/, true);
|
721
|
-
|
722
|
-
return tokenTypes.linkText;
|
723
|
-
}
|
724
|
-
|
725
|
-
function footnoteUrl(stream, state) {
|
726
|
-
// Check if space, and return NULL if so (to avoid marking the space)
|
727
|
-
if(stream.eatSpace()){
|
728
|
-
return null;
|
729
|
-
}
|
730
|
-
// Match URL
|
731
|
-
stream.match(/^[^\s]+/, true);
|
732
|
-
// Check for link title
|
733
|
-
if (stream.peek() === undefined) { // End of line, set flag to check next line
|
734
|
-
state.linkTitle = true;
|
735
|
-
} else { // More content on line, check if link title
|
736
|
-
stream.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/, true);
|
737
|
-
}
|
738
|
-
state.f = state.inline = inlineNormal;
|
739
|
-
return tokenTypes.linkHref + " url";
|
740
|
-
}
|
741
|
-
|
742
|
-
var mode = {
|
743
|
-
startState: function() {
|
744
|
-
return {
|
745
|
-
f: blockNormal,
|
746
|
-
|
747
|
-
prevLine: {stream: null},
|
748
|
-
thisLine: {stream: null},
|
749
|
-
|
750
|
-
block: blockNormal,
|
751
|
-
htmlState: null,
|
752
|
-
indentation: 0,
|
753
|
-
|
754
|
-
inline: inlineNormal,
|
755
|
-
text: handleText,
|
756
|
-
|
757
|
-
formatting: false,
|
758
|
-
linkText: false,
|
759
|
-
linkHref: false,
|
760
|
-
linkTitle: false,
|
761
|
-
code: 0,
|
762
|
-
em: false,
|
763
|
-
strong: false,
|
764
|
-
header: 0,
|
765
|
-
setext: 0,
|
766
|
-
hr: false,
|
767
|
-
taskList: false,
|
768
|
-
list: false,
|
769
|
-
listStack: [],
|
770
|
-
quote: 0,
|
771
|
-
trailingSpace: 0,
|
772
|
-
trailingSpaceNewLine: false,
|
773
|
-
strikethrough: false,
|
774
|
-
emoji: false,
|
775
|
-
fencedEndRE: null
|
776
|
-
};
|
777
|
-
},
|
778
|
-
|
779
|
-
copyState: function(s) {
|
780
|
-
return {
|
781
|
-
f: s.f,
|
782
|
-
|
783
|
-
prevLine: s.prevLine,
|
784
|
-
thisLine: s.thisLine,
|
785
|
-
|
786
|
-
block: s.block,
|
787
|
-
htmlState: s.htmlState && CodeMirror.copyState(htmlMode, s.htmlState),
|
788
|
-
indentation: s.indentation,
|
789
|
-
|
790
|
-
localMode: s.localMode,
|
791
|
-
localState: s.localMode ? CodeMirror.copyState(s.localMode, s.localState) : null,
|
792
|
-
|
793
|
-
inline: s.inline,
|
794
|
-
text: s.text,
|
795
|
-
formatting: false,
|
796
|
-
linkText: s.linkText,
|
797
|
-
linkTitle: s.linkTitle,
|
798
|
-
linkHref: s.linkHref,
|
799
|
-
code: s.code,
|
800
|
-
em: s.em,
|
801
|
-
strong: s.strong,
|
802
|
-
strikethrough: s.strikethrough,
|
803
|
-
emoji: s.emoji,
|
804
|
-
header: s.header,
|
805
|
-
setext: s.setext,
|
806
|
-
hr: s.hr,
|
807
|
-
taskList: s.taskList,
|
808
|
-
list: s.list,
|
809
|
-
listStack: s.listStack.slice(0),
|
810
|
-
quote: s.quote,
|
811
|
-
indentedCode: s.indentedCode,
|
812
|
-
trailingSpace: s.trailingSpace,
|
813
|
-
trailingSpaceNewLine: s.trailingSpaceNewLine,
|
814
|
-
md_inside: s.md_inside,
|
815
|
-
fencedEndRE: s.fencedEndRE
|
816
|
-
};
|
817
|
-
},
|
818
|
-
|
819
|
-
token: function(stream, state) {
|
820
|
-
|
821
|
-
// Reset state.formatting
|
822
|
-
state.formatting = false;
|
823
|
-
|
824
|
-
if (stream != state.thisLine.stream) {
|
825
|
-
state.header = 0;
|
826
|
-
state.hr = false;
|
827
|
-
|
828
|
-
if (stream.match(/^\s*$/, true)) {
|
829
|
-
blankLine(state);
|
830
|
-
return null;
|
831
|
-
}
|
832
|
-
|
833
|
-
state.prevLine = state.thisLine
|
834
|
-
state.thisLine = {stream: stream}
|
835
|
-
|
836
|
-
// Reset state.taskList
|
837
|
-
state.taskList = false;
|
838
|
-
|
839
|
-
// Reset state.trailingSpace
|
840
|
-
state.trailingSpace = 0;
|
841
|
-
state.trailingSpaceNewLine = false;
|
842
|
-
|
843
|
-
if (!state.localState) {
|
844
|
-
state.f = state.block;
|
845
|
-
if (state.f != htmlBlock) {
|
846
|
-
var indentation = stream.match(/^\s*/, true)[0].replace(/\t/g, expandedTab).length;
|
847
|
-
state.indentation = indentation;
|
848
|
-
state.indentationDiff = null;
|
849
|
-
if (indentation > 0) return null;
|
850
|
-
}
|
851
|
-
}
|
852
|
-
}
|
853
|
-
return state.f(stream, state);
|
854
|
-
},
|
855
|
-
|
856
|
-
innerMode: function(state) {
|
857
|
-
if (state.block == htmlBlock) return {state: state.htmlState, mode: htmlMode};
|
858
|
-
if (state.localState) return {state: state.localState, mode: state.localMode};
|
859
|
-
return {state: state, mode: mode};
|
860
|
-
},
|
861
|
-
|
862
|
-
indent: function(state, textAfter, line) {
|
863
|
-
if (state.block == htmlBlock && htmlMode.indent) return htmlMode.indent(state.htmlState, textAfter, line)
|
864
|
-
if (state.localState && state.localMode.indent) return state.localMode.indent(state.localState, textAfter, line)
|
865
|
-
return CodeMirror.Pass
|
866
|
-
},
|
867
|
-
|
868
|
-
blankLine: blankLine,
|
869
|
-
|
870
|
-
getType: getType,
|
871
|
-
|
872
|
-
closeBrackets: "()[]{}''\"\"``",
|
873
|
-
fold: "markdown"
|
874
|
-
};
|
875
|
-
return mode;
|
876
|
-
}, "xml");
|
877
|
-
|
878
|
-
CodeMirror.defineMIME("text/markdown", "markdown");
|
879
|
-
|
880
|
-
CodeMirror.defineMIME("text/x-markdown", "markdown");
|
881
|
-
|
882
|
-
});
|