elabs 2.0.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.eslintrc.yml +26 -0
- data/.gitignore +49 -0
- data/.gitlab-ci.yml +93 -0
- data/.haml-lint.yml +4 -0
- data/.node-version +1 -0
- data/.rspec +1 -0
- data/.rubocop.yml +59 -0
- data/.ruby-version +1 -0
- data/.simplecov +5 -0
- data/.stylelintrc.yml +218 -0
- data/CHANGELOG.md +273 -0
- data/CODE_OF_CONDUCT.md +78 -0
- data/Gemfile +75 -0
- data/Gemfile.lock +376 -0
- data/LICENSE +21 -0
- data/LICENSES.md +6 -0
- data/README.md +41 -0
- data/ROADMAP.md +61 -0
- data/Rakefile +32 -0
- data/app/assets/config/elabs_manifest.js +3 -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/application.js +27 -0
- data/app/assets/javascripts/elabs/helpers-codemirror.js +29 -0
- data/app/assets/javascripts/elabs/helpers-markdown.js +42 -0
- data/app/assets/javascripts/elabs/helpers.js +17 -0
- data/app/assets/javascripts/elabs/modals.js +19 -0
- data/app/assets/javascripts/elabs/tabs.js +32 -0
- data/app/assets/stylesheets/elabs/_colors.scss +345 -0
- data/app/assets/stylesheets/elabs/_icons.scss +9 -0
- data/app/assets/stylesheets/elabs/_variables.scss +13 -0
- data/app/assets/stylesheets/elabs/app/_acts.scss +58 -0
- data/app/assets/stylesheets/elabs/app/_alerts.scss +3 -0
- data/app/assets/stylesheets/elabs/app/_buttons.scss +21 -0
- data/app/assets/stylesheets/elabs/app/_comments.scss +1 -0
- data/app/assets/stylesheets/elabs/app/_content.scss +10 -0
- data/app/assets/stylesheets/elabs/app/_content_uploads.scss +39 -0
- data/app/assets/stylesheets/elabs/app/_empty.scss +19 -0
- data/app/assets/stylesheets/elabs/app/_errors.scss +9 -0
- data/app/assets/stylesheets/elabs/app/_filter_links.scss +27 -0
- data/app/assets/stylesheets/elabs/app/_forms.scss +69 -0
- data/app/assets/stylesheets/elabs/app/_helpers.scss +3 -0
- data/app/assets/stylesheets/elabs/app/_languages.scss +6 -0
- data/app/assets/stylesheets/elabs/app/_layout.scss +194 -0
- data/app/assets/stylesheets/elabs/app/_licenses.scss +6 -0
- data/app/assets/stylesheets/elabs/app/_link-to-top.scss +8 -0
- data/app/assets/stylesheets/elabs/app/_medias.scss +12 -0
- data/app/assets/stylesheets/elabs/app/_modals.scss +53 -0
- data/app/assets/stylesheets/elabs/app/_nsfw.scss +5 -0
- data/app/assets/stylesheets/elabs/app/_pagination.scss +16 -0
- data/app/assets/stylesheets/elabs/app/_tabs.scss +54 -0
- data/app/assets/stylesheets/elabs/app/_tags.scss +6 -0
- data/app/assets/stylesheets/elabs/app/_toolbars.scss +3 -0
- data/app/assets/stylesheets/elabs/app/_users.scss +6 -0
- data/app/assets/stylesheets/elabs/app/admin-members/_forms.scss +6 -0
- data/app/assets/stylesheets/elabs/app/admin-members/_indexes.scss +70 -0
- data/app/assets/stylesheets/elabs/app/admin-members/_layout.scss +17 -0
- data/app/assets/stylesheets/elabs/app/areas/_devise.scss +31 -0
- data/app/assets/stylesheets/elabs/app/components/_cards.scss +16 -0
- data/app/assets/stylesheets/elabs/app/components/_container.scss +4 -0
- data/app/assets/stylesheets/elabs/app/mixins/_classifier-card.scss +16 -0
- data/app/assets/stylesheets/elabs/app/mixins/_content-card.scss +58 -0
- data/app/assets/stylesheets/elabs/app/mixins/_content-full.scss +39 -0
- data/app/assets/stylesheets/elabs/app/mixins/_icon.scss +9 -0
- data/app/assets/stylesheets/elabs/application.css +14 -0
- data/app/assets/stylesheets/elabs/lib/_codemirror.scss +26 -0
- data/app/assets/stylesheets/elabs/lib/fontawesome/_fontawesome.scss +38 -0
- data/app/assets/stylesheets/elabs/lib/fontawesome/_fonts.scss +42 -0
- data/app/assets/stylesheets/elabs/lib/fontawesome/_icons.scss +1118 -0
- data/app/assets/stylesheets/elabs/lib/knacss/_knacss-variables.scss +230 -0
- data/app/assets/stylesheets/elabs/lib/knacss/_knacss.scss +59 -0
- data/app/assets/stylesheets/elabs/style.scss +72 -0
- data/app/controllers/elabs/acts_controller.rb +12 -0
- data/app/controllers/elabs/admin/admin_application_controller.rb +19 -0
- data/app/controllers/elabs/admin/admin_content_application_controller.rb +66 -0
- data/app/controllers/elabs/admin/albums_controller.rb +10 -0
- data/app/controllers/elabs/admin/articles_controller.rb +10 -0
- data/app/controllers/elabs/admin/languages_controller.rb +77 -0
- data/app/controllers/elabs/admin/licenses_controller.rb +77 -0
- data/app/controllers/elabs/admin/notes_controller.rb +10 -0
- data/app/controllers/elabs/admin/projects_controller.rb +10 -0
- data/app/controllers/elabs/admin/reports_controller.rb +34 -0
- data/app/controllers/elabs/admin/tags_controller.rb +56 -0
- data/app/controllers/elabs/admin/uploads_controller.rb +10 -0
- data/app/controllers/elabs/admin/users_controller.rb +43 -0
- data/app/controllers/elabs/albums_controller.rb +26 -0
- data/app/controllers/elabs/articles_controller.rb +25 -0
- data/app/controllers/elabs/auth/callbacks_controller.rb +38 -0
- data/app/controllers/elabs/auth/confirmations_controller.rb +43 -0
- data/app/controllers/elabs/auth/passwords_controller.rb +47 -0
- data/app/controllers/elabs/auth/registrations_controller.rb +70 -0
- data/app/controllers/elabs/auth/sessions_controller.rb +36 -0
- data/app/controllers/elabs/auth/unlocks_controller.rb +38 -0
- data/app/controllers/elabs/concerns/elabs_controller.rb +18 -0
- data/app/controllers/elabs/concerns/localizable.rb +11 -0
- data/app/controllers/elabs/concerns/reportable.rb +17 -0
- data/app/controllers/elabs/content_application_controller.rb +45 -0
- data/app/controllers/elabs/elabs_application_controller.rb +95 -0
- data/app/controllers/elabs/languages_controller.rb +36 -0
- data/app/controllers/elabs/licenses_controller.rb +31 -0
- data/app/controllers/elabs/member/albums_controller.rb +11 -0
- data/app/controllers/elabs/member/articles_controller.rb +11 -0
- data/app/controllers/elabs/member/member_application_controller.rb +12 -0
- data/app/controllers/elabs/member/member_content_application_controller.rb +128 -0
- data/app/controllers/elabs/member/notes_controller.rb +11 -0
- data/app/controllers/elabs/member/preferences_controller.rb +36 -0
- data/app/controllers/elabs/member/projects_controller.rb +11 -0
- data/app/controllers/elabs/member/uploads_controller.rb +11 -0
- data/app/controllers/elabs/member/users_controller.rb +28 -0
- data/app/controllers/elabs/notes_controller.rb +25 -0
- data/app/controllers/elabs/projects_controller.rb +30 -0
- data/app/controllers/elabs/reports_controller.rb +36 -0
- data/app/controllers/elabs/tags_controller.rb +36 -0
- data/app/controllers/elabs/uploads_controller.rb +24 -0
- data/app/controllers/elabs/users_controller.rb +36 -0
- data/app/helpers/elabs/acts_helper.rb +22 -0
- data/app/helpers/elabs/admin_content_helper.rb +54 -0
- data/app/helpers/elabs/application_helper.rb +54 -0
- data/app/helpers/elabs/content_filters_helper.rb +97 -0
- data/app/helpers/elabs/content_renderer_helper.rb +13 -0
- data/app/helpers/elabs/member_content_helper.rb +47 -0
- data/app/helpers/elabs/thumbnails_helper.rb +28 -0
- data/app/helpers/elabs/time_helper.rb +19 -0
- data/app/helpers/elabs/uploads_helper.rb +19 -0
- data/app/jobs/elabs/application_job.rb +4 -0
- data/app/mailers/elabs/application_mailer.rb +6 -0
- data/app/models/elabs/act.rb +7 -0
- data/app/models/elabs/album.rb +24 -0
- data/app/models/elabs/albums_tag.rb +21 -0
- data/app/models/elabs/albums_upload.rb +21 -0
- data/app/models/elabs/application_content_record.rb +10 -0
- data/app/models/elabs/application_record.rb +5 -0
- data/app/models/elabs/article.rb +23 -0
- data/app/models/elabs/articles_tag.rb +21 -0
- data/app/models/elabs/comment.rb +12 -0
- data/app/models/elabs/concerns/actable_entity.rb +52 -0
- data/app/models/elabs/concerns/content_entity.rb +70 -0
- data/app/models/elabs/concerns/countable_entity.rb +81 -0
- data/app/models/elabs/concerns/taggable.rb +33 -0
- data/app/models/elabs/language.rb +17 -0
- data/app/models/elabs/license.rb +15 -0
- data/app/models/elabs/note.rb +21 -0
- data/app/models/elabs/notes_tag.rb +21 -0
- data/app/models/elabs/preference.rb +9 -0
- data/app/models/elabs/project.rb +25 -0
- data/app/models/elabs/projects_album.rb +21 -0
- data/app/models/elabs/projects_article.rb +21 -0
- data/app/models/elabs/projects_note.rb +21 -0
- data/app/models/elabs/projects_tag.rb +21 -0
- data/app/models/elabs/projects_upload.rb +21 -0
- data/app/models/elabs/report.rb +11 -0
- data/app/models/elabs/tag.rb +18 -0
- data/app/models/elabs/upload.rb +28 -0
- data/app/models/elabs/uploads_tag.rb +21 -0
- data/app/models/elabs/user.rb +30 -0
- data/app/validators/elabs/associated_author_validator.rb +11 -0
- data/app/views/elabs/acts/_act.json.jbuilder +2 -0
- data/app/views/elabs/acts/_filters.html.haml +3 -0
- data/app/views/elabs/acts/index.html.haml +27 -0
- data/app/views/elabs/acts/index.json.jbuilder +1 -0
- data/app/views/elabs/admin/albums/_album.json.jbuilder +2 -0
- data/app/views/elabs/admin/albums/index.html.haml +43 -0
- data/app/views/elabs/admin/albums/index.json.jbuilder +1 -0
- data/app/views/elabs/admin/articles/_article.json.jbuilder +2 -0
- data/app/views/elabs/admin/articles/index.html.haml +41 -0
- data/app/views/elabs/admin/articles/index.json.jbuilder +1 -0
- data/app/views/elabs/admin/languages/_form.html.haml +18 -0
- data/app/views/elabs/admin/languages/_language.json.jbuilder +2 -0
- data/app/views/elabs/admin/languages/edit.html.haml +6 -0
- data/app/views/elabs/admin/languages/index.html.haml +34 -0
- data/app/views/elabs/admin/languages/index.json.jbuilder +1 -0
- data/app/views/elabs/admin/languages/new.html.haml +3 -0
- data/app/views/elabs/admin/licenses/_form.html.haml +25 -0
- data/app/views/elabs/admin/licenses/_license.json.jbuilder +2 -0
- data/app/views/elabs/admin/licenses/edit.html.haml +6 -0
- data/app/views/elabs/admin/licenses/index.html.haml +42 -0
- data/app/views/elabs/admin/licenses/index.json.jbuilder +1 -0
- data/app/views/elabs/admin/licenses/new.html.haml +3 -0
- data/app/views/elabs/admin/notes/_note.json.jbuilder +2 -0
- data/app/views/elabs/admin/notes/index.html.haml +40 -0
- data/app/views/elabs/admin/notes/index.json.jbuilder +1 -0
- data/app/views/elabs/admin/projects/_project.json.jbuilder +2 -0
- data/app/views/elabs/admin/projects/index.html.haml +45 -0
- data/app/views/elabs/admin/projects/index.json.jbuilder +1 -0
- data/app/views/elabs/admin/reports/index.html.haml +27 -0
- data/app/views/elabs/admin/reports/index.json.jbuilder +1 -0
- data/app/views/elabs/admin/tags/_form.html.haml +17 -0
- data/app/views/elabs/admin/tags/_tag.json.jbuilder +2 -0
- data/app/views/elabs/admin/tags/edit.html.haml +6 -0
- data/app/views/elabs/admin/tags/index.html.haml +27 -0
- data/app/views/elabs/admin/tags/index.json.jbuilder +1 -0
- data/app/views/elabs/admin/uploads/_upload.json.jbuilder +2 -0
- data/app/views/elabs/admin/uploads/index.html.haml +45 -0
- data/app/views/elabs/admin/uploads/index.json.jbuilder +1 -0
- data/app/views/elabs/admin/users/_admin_user.json.jbuilder +2 -0
- data/app/views/elabs/admin/users/index.html.haml +33 -0
- data/app/views/elabs/admin/users/index.json.jbuilder +1 -0
- data/app/views/elabs/admin/users/show.html.haml +26 -0
- data/app/views/elabs/admin/users/show.json.jbuilder +1 -0
- data/app/views/elabs/albums/_album.html.haml +38 -0
- data/app/views/elabs/albums/_album.json.jbuilder +2 -0
- data/app/views/elabs/albums/_filters.html.haml +8 -0
- data/app/views/elabs/albums/index.html.haml +9 -0
- data/app/views/elabs/albums/index.json.jbuilder +1 -0
- data/app/views/elabs/albums/show.html.haml +60 -0
- data/app/views/elabs/albums/show.json.jbuilder +1 -0
- data/app/views/elabs/articles/_article.html.haml +30 -0
- data/app/views/elabs/articles/_article.json.jbuilder +2 -0
- data/app/views/elabs/articles/_filters.html.haml +8 -0
- data/app/views/elabs/articles/index.html.haml +9 -0
- data/app/views/elabs/articles/index.json.jbuilder +1 -0
- data/app/views/elabs/articles/show.html.haml +45 -0
- data/app/views/elabs/articles/show.json.jbuilder +1 -0
- data/app/views/elabs/auth/confirmations/new.html.haml +26 -0
- data/app/views/elabs/auth/passwords/edit.html.haml +31 -0
- data/app/views/elabs/auth/passwords/new.html.haml +23 -0
- data/app/views/elabs/auth/registrations/edit.html.haml +48 -0
- data/app/views/elabs/auth/registrations/new.html.haml +34 -0
- data/app/views/elabs/auth/sessions/_new.html.haml +15 -0
- data/app/views/elabs/auth/sessions/new.html.haml +8 -0
- data/app/views/elabs/auth/shared/_links.html.haml +16 -0
- data/app/views/elabs/auth/unlocks/new.html.haml +23 -0
- data/app/views/elabs/comments/_comment.json.jbuilder +2 -0
- data/app/views/elabs/comments/_comments.html.haml +21 -0
- data/app/views/elabs/comments/_form.html.haml +31 -0
- data/app/views/elabs/languages/_associations.html.haml +51 -0
- data/app/views/elabs/languages/_filters.html.haml +6 -0
- data/app/views/elabs/languages/_language.json.jbuilder +2 -0
- data/app/views/elabs/languages/index.html.haml +33 -0
- data/app/views/elabs/languages/index.json.jbuilder +1 -0
- data/app/views/elabs/languages/show.html.haml +38 -0
- data/app/views/elabs/languages/show.json.jbuilder +1 -0
- data/app/views/elabs/layouts/_empty.html.haml +3 -0
- data/app/views/elabs/layouts/_footer.html.haml +6 -0
- data/app/views/elabs/layouts/_hidden_entry.html.haml +6 -0
- data/app/views/elabs/layouts/_hidden_entry_full.html.haml +6 -0
- data/app/views/elabs/layouts/_language_menu.html.haml +2 -0
- data/app/views/elabs/layouts/_menu.html.haml +72 -0
- data/app/views/elabs/layouts/admin_application.html.haml +21 -0
- data/app/views/elabs/layouts/application.html.haml +37 -0
- data/app/views/elabs/layouts/lists/_albums.html.haml +10 -0
- data/app/views/elabs/layouts/lists/_projects.html.haml +10 -0
- data/app/views/elabs/layouts/lists/_tags.html.haml +9 -0
- data/app/views/elabs/layouts/mailer.html.haml +8 -0
- data/app/views/elabs/layouts/mailer.text.haml +1 -0
- data/app/views/elabs/layouts/member_application.html.haml +21 -0
- data/app/views/elabs/licenses/_associations.html.haml +51 -0
- data/app/views/elabs/licenses/_filters.html.haml +3 -0
- data/app/views/elabs/licenses/_license.json.jbuilder +2 -0
- data/app/views/elabs/licenses/index.html.haml +27 -0
- data/app/views/elabs/licenses/index.json.jbuilder +1 -0
- data/app/views/elabs/licenses/show.html.haml +44 -0
- data/app/views/elabs/licenses/show.json.jbuilder +1 -0
- data/app/views/elabs/member/albums/_album.json.jbuilder +2 -0
- data/app/views/elabs/member/albums/_form.html.haml +64 -0
- data/app/views/elabs/member/albums/edit.html.haml +6 -0
- data/app/views/elabs/member/albums/index.html.haml +49 -0
- data/app/views/elabs/member/albums/index.json.jbuilder +1 -0
- data/app/views/elabs/member/albums/new.html.haml +3 -0
- data/app/views/elabs/member/articles/_article.json.jbuilder +2 -0
- data/app/views/elabs/member/articles/_form.html.haml +70 -0
- data/app/views/elabs/member/articles/edit.html.haml +6 -0
- data/app/views/elabs/member/articles/index.html.haml +47 -0
- data/app/views/elabs/member/articles/index.json.jbuilder +1 -0
- data/app/views/elabs/member/articles/new.html.haml +3 -0
- data/app/views/elabs/member/layouts/_empty.html.haml +4 -0
- data/app/views/elabs/member/layouts/_markdown-preview.html.haml +8 -0
- data/app/views/elabs/member/notes/_form.html.haml +54 -0
- data/app/views/elabs/member/notes/_note.json.jbuilder +2 -0
- data/app/views/elabs/member/notes/edit.html.haml +6 -0
- data/app/views/elabs/member/notes/index.html.haml +47 -0
- data/app/views/elabs/member/notes/index.json.jbuilder +1 -0
- data/app/views/elabs/member/notes/new.html.haml +3 -0
- data/app/views/elabs/member/preferences/_form.html.haml +20 -0
- data/app/views/elabs/member/preferences/edit.html.haml +3 -0
- data/app/views/elabs/member/projects/_form.html.haml +71 -0
- data/app/views/elabs/member/projects/_project.json.jbuilder +2 -0
- data/app/views/elabs/member/projects/edit.html.haml +6 -0
- data/app/views/elabs/member/projects/index.html.haml +53 -0
- data/app/views/elabs/member/projects/index.json.jbuilder +1 -0
- data/app/views/elabs/member/projects/new.html.haml +3 -0
- data/app/views/elabs/member/uploads/_form.html.haml +67 -0
- data/app/views/elabs/member/uploads/_upload.json.jbuilder +2 -0
- data/app/views/elabs/member/uploads/edit.html.haml +6 -0
- data/app/views/elabs/member/uploads/index.html.haml +61 -0
- data/app/views/elabs/member/uploads/index.json.jbuilder +1 -0
- data/app/views/elabs/member/uploads/new.html.haml +3 -0
- data/app/views/elabs/member/users/_form.html.haml +38 -0
- data/app/views/elabs/notes/_filters.html.haml +7 -0
- data/app/views/elabs/notes/_note.html.haml +31 -0
- data/app/views/elabs/notes/_note.json.jbuilder +2 -0
- data/app/views/elabs/notes/index.html.haml +9 -0
- data/app/views/elabs/notes/index.json.jbuilder +1 -0
- data/app/views/elabs/notes/show.html.haml +44 -0
- data/app/views/elabs/notes/show.json.jbuilder +1 -0
- data/app/views/elabs/projects/_associations.html.haml +46 -0
- data/app/views/elabs/projects/_filters.html.haml +8 -0
- data/app/views/elabs/projects/_project.html.haml +29 -0
- data/app/views/elabs/projects/index.html.haml +9 -0
- data/app/views/elabs/projects/index.json.jbuilder +1 -0
- data/app/views/elabs/projects/show.html.haml +71 -0
- data/app/views/elabs/projects/show.json.jbuilder +1 -0
- data/app/views/elabs/reports/_form.html.haml +29 -0
- data/app/views/elabs/tags/_associations.html.haml +51 -0
- data/app/views/elabs/tags/_filters.html.haml +3 -0
- data/app/views/elabs/tags/_tag.json.jbuilder +2 -0
- data/app/views/elabs/tags/index.html.haml +26 -0
- data/app/views/elabs/tags/index.json.jbuilder +1 -0
- data/app/views/elabs/tags/show.html.haml +34 -0
- data/app/views/elabs/tags/show.json.jbuilder +1 -0
- data/app/views/elabs/uploads/_filters.html.haml +7 -0
- data/app/views/elabs/uploads/_player.html.haml +10 -0
- data/app/views/elabs/uploads/_preview.html.haml +17 -0
- data/app/views/elabs/uploads/_upload.html.haml +41 -0
- data/app/views/elabs/uploads/_upload.json.jbuilder +2 -0
- data/app/views/elabs/uploads/index.html.haml +9 -0
- data/app/views/elabs/uploads/index.json.jbuilder +1 -0
- data/app/views/elabs/uploads/show.html.haml +58 -0
- data/app/views/elabs/uploads/show.json.jbuilder +1 -0
- data/app/views/elabs/users/_associations.html.haml +51 -0
- data/app/views/elabs/users/_filters.html.haml +4 -0
- data/app/views/elabs/users/_user.html.haml +31 -0
- data/app/views/elabs/users/_user.json.jbuilder +2 -0
- data/app/views/elabs/users/index.html.haml +7 -0
- data/app/views/elabs/users/index.json.jbuilder +1 -0
- data/app/views/elabs/users/show.html.haml +48 -0
- data/app/views/elabs/users/show.json.jbuilder +1 -0
- data/bin/rails +14 -0
- data/config.ru +5 -0
- data/config/brakeman.ignore +124 -0
- data/config/brakeman.yml +3 -0
- data/config/cucumber.yml +9 -0
- data/config/routes.rb +116 -0
- data/db/migrate/20180813000000_devise_update_users.rb +15 -0
- data/db/migrate/20180813000001_create_languages.rb +16 -0
- data/db/migrate/20180813000002_create_tags.rb +14 -0
- data/db/migrate/20180813000004_create_licenses.rb +17 -0
- data/db/migrate/20180813000005_create_reports.rb +15 -0
- data/db/migrate/20180813000006_create_comments.rb +15 -0
- data/db/migrate/20180813000007_create_acts.rb +10 -0
- data/db/migrate/20180813000008_create_preferences.rb +13 -0
- data/db/migrate/20180813000009_create_active_storage_tables.active_storage.rb +26 -0
- data/db/migrate/20180813000010_create_albums.rb +23 -0
- data/db/migrate/20180813000011_create_articles.rb +23 -0
- data/db/migrate/20180813000012_create_notes.rb +21 -0
- data/db/migrate/20180813000013_create_uploads.rb +26 -0
- data/db/migrate/20180813000014_create_projects.rb +44 -0
- data/db/seeds.rb +10 -0
- data/db/seeds_development.rb +21 -0
- data/db/seeds_production.rb +0 -0
- data/docs/contributing.md +52 -0
- data/docs/cucumber_terms.md +9 -0
- data/docs/migrating.md +4 -0
- data/docs/overriding.md +20 -0
- data/docs/setup.md +136 -0
- data/docs/tips.md +13 -0
- data/elabs.gemspec +25 -0
- data/lib/assets/javascripts/README-highlight.js.md +39 -0
- data/lib/assets/javascripts/codemirror-5.39.2/addon/mode/overlay.js +90 -0
- data/lib/assets/javascripts/codemirror-5.39.2/lib/codemirror.js +9684 -0
- data/lib/assets/javascripts/codemirror-5.39.2/mode/clike/clike.js +834 -0
- data/lib/assets/javascripts/codemirror-5.39.2/mode/css/css.js +832 -0
- data/lib/assets/javascripts/codemirror-5.39.2/mode/gfm/gfm.js +129 -0
- data/lib/assets/javascripts/codemirror-5.39.2/mode/htmlmixed/htmlmixed.js +152 -0
- data/lib/assets/javascripts/codemirror-5.39.2/mode/javascript/javascript.js +896 -0
- data/lib/assets/javascripts/codemirror-5.39.2/mode/markdown/markdown.js +882 -0
- data/lib/assets/javascripts/codemirror-5.39.2/mode/meta.js +217 -0
- data/lib/assets/javascripts/codemirror-5.39.2/mode/xml/xml.js +402 -0
- data/lib/assets/javascripts/highlight.js-9.12.0/highlight.pack.js +2 -0
- data/lib/assets/javascripts/markdown-it-8.4.2.min.js +1 -0
- data/lib/assets/stylesheets/codemirror-5.39.2/lib/codemirror.css +346 -0
- data/lib/assets/stylesheets/codemirror-5.39.2/theme/base16-dark.css +38 -0
- data/lib/assets/stylesheets/codemirror-5.39.2/theme/base16-light.css +38 -0
- data/lib/assets/stylesheets/highlight.js-9.12.0/styles/atelier-sulphurpool-light.css +69 -0
- data/lib/elabs.rb +41 -0
- data/lib/elabs/engine.rb +5 -0
- data/lib/elabs/version.rb +3 -0
- data/lib/generators/elabs/assets_generator.rb +36 -0
- data/lib/generators/elabs/devise_views_generator.rb +24 -0
- data/lib/generators/elabs/install_generator.rb +26 -0
- data/lib/generators/elabs/required_assets_generator.rb +26 -0
- data/lib/generators/elabs/views_generator.rb +25 -0
- data/lib/generators/templates/elabs.rb +25 -0
- data/lib/generators/templates/fast_gettext.rb +3 -0
- data/lib/tasks/.keep +0 -0
- data/lib/tasks/cucumber.rake +75 -0
- data/lib/tasks/elabs_tasks.rake +4 -0
- data/lib/tasks/factory_bot.rake +14 -0
- data/lib/tasks/wipe.rake +31 -0
- data/locale/app.pot +1124 -0
- data/locale/devise_strings.rb +88 -0
- data/locale/en/app.edit.po +1123 -0
- data/locale/en/app.po +1123 -0
- data/locale/en/app.po.time_stamp +0 -0
- data/locale/fr/app.edit.po +1126 -0
- data/locale/fr/app.po +1125 -0
- data/locale/fr/app.po.time_stamp +0 -0
- data/locale/model_attributes.rb +85 -0
- data/package.json +22 -0
- data/script/cucumber +10 -0
- data/tmp/pids/.keep +0 -0
- data/yarn.lock +2759 -0
- metadata +463 -0
@@ -0,0 +1,882 @@
|
|
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
|
+
});
|