proclaim 0.5.6 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Rakefile +5 -38
- data/app/assets/config/proclaim_manifest.js +2 -0
- data/app/assets/images/{ajax_loader.gif → proclaim/ajax_loader.gif} +0 -0
- data/app/assets/javascripts/proclaim.js +7 -7
- data/app/assets/javascripts/proclaim/{comments_handler.js.coffee → comments_handler.coffee} +16 -10
- data/app/assets/javascripts/proclaim/editor.coffee +55 -0
- data/app/assets/stylesheets/{proclaim.css.scss → proclaim.scss} +7 -8
- data/app/assets/stylesheets/proclaim/{comments.css.scss → comments.scss} +0 -0
- data/app/assets/stylesheets/proclaim/{posts.css.scss → posts.scss} +60 -25
- data/app/assets/stylesheets/proclaim/{subscriptions.css.scss → subscriptions.scss} +0 -0
- data/app/controllers/proclaim/application_controller.rb +60 -56
- data/app/controllers/proclaim/comments_controller.rb +13 -42
- data/app/controllers/proclaim/posts_controller.rb +25 -57
- data/app/controllers/proclaim/subscriptions_controller.rb +3 -3
- data/app/jobs/proclaim/application_job.rb +4 -0
- data/app/mailers/proclaim/application_mailer.rb +5 -0
- data/app/mailers/proclaim/subscription_mailer.rb +19 -17
- data/app/models/proclaim/application_record.rb +5 -0
- data/app/models/proclaim/comment.rb +6 -1
- data/app/models/proclaim/post.rb +20 -28
- data/app/models/proclaim/subscription.rb +33 -11
- data/app/views/layouts/proclaim/subscription_mailer.html.erb +15 -36
- data/app/views/proclaim/comments/_comment.html.erb +7 -7
- data/app/views/proclaim/comments/_form.html.erb +7 -5
- data/app/views/proclaim/posts/_form.html.erb +34 -21
- data/app/views/proclaim/posts/show.html.erb +16 -3
- data/app/views/proclaim/subscription_mailer/welcome_email.html.erb +2 -6
- data/config/initializers/friendly_id.rb +20 -1
- data/config/routes.rb +1 -5
- data/db/migrate/20141108222616_create_proclaim_posts.rb +8 -1
- data/db/migrate/20141114235359_create_proclaim_comments.rb +1 -1
- data/db/migrate/20141115022230_create_proclaim_comment_hierarchies.rb +1 -1
- data/db/migrate/20141210234057_create_proclaim_subscriptions.rb +5 -4
- data/db/migrate/20150213015321_create_friendly_id_slugs.rb +1 -1
- data/lib/generators/proclaim/install_generator.rb +1 -1
- data/lib/generators/proclaim/templates/initialize_proclaim.rb +31 -29
- data/lib/generators/proclaim/views_generator.rb +1 -1
- data/lib/proclaim.rb +15 -15
- data/lib/proclaim/engine.rb +21 -19
- data/lib/proclaim/version.rb +1 -1
- data/vendor/assets/fonts/KaTeX_AMS-Regular.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_AMS-Regular.woff +0 -0
- data/vendor/assets/fonts/KaTeX_AMS-Regular.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Caligraphic-Bold.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Caligraphic-Bold.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Caligraphic-Regular.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Caligraphic-Regular.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Fraktur-Bold.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Fraktur-Bold.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Fraktur-Regular.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Fraktur-Regular.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Main-Bold.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Main-Bold.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Main-Bold.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Main-BoldItalic.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Main-BoldItalic.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Main-Italic.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Main-Italic.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Main-Italic.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Main-Regular.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Main-Regular.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Main-Regular.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Math-BoldItalic.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Math-BoldItalic.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Math-Italic.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Math-Italic.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Math-Italic.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_SansSerif-Bold.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_SansSerif-Bold.woff +0 -0
- data/vendor/assets/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_SansSerif-Italic.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_SansSerif-Italic.woff +0 -0
- data/vendor/assets/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_SansSerif-Regular.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_SansSerif-Regular.woff +0 -0
- data/vendor/assets/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Script-Regular.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Script-Regular.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Script-Regular.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Size1-Regular.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Size1-Regular.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Size1-Regular.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Size2-Regular.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Size2-Regular.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Size2-Regular.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Size3-Regular.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Size3-Regular.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Size3-Regular.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Size4-Regular.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Size4-Regular.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Size4-Regular.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Typewriter-Regular.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Typewriter-Regular.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
- data/vendor/assets/javascripts/contrib/auto-render.js +339 -0
- data/vendor/assets/javascripts/contrib/auto-render.min.js +1 -0
- data/vendor/assets/javascripts/contrib/auto-render.mjs +215 -0
- data/vendor/assets/javascripts/contrib/copy-tex.css +14 -0
- data/vendor/assets/javascripts/contrib/copy-tex.js +213 -0
- data/vendor/assets/javascripts/contrib/copy-tex.min.css +1 -0
- data/vendor/assets/javascripts/contrib/copy-tex.min.js +1 -0
- data/vendor/assets/javascripts/contrib/copy-tex.mjs +85 -0
- data/vendor/assets/javascripts/contrib/mathtex-script-type.js +137 -0
- data/vendor/assets/javascripts/contrib/mathtex-script-type.min.js +1 -0
- data/vendor/assets/javascripts/contrib/mathtex-script-type.mjs +24 -0
- data/vendor/assets/javascripts/contrib/mhchem.js +3241 -0
- data/vendor/assets/javascripts/contrib/mhchem.min.js +1 -0
- data/vendor/assets/javascripts/contrib/mhchem.mjs +3109 -0
- data/vendor/assets/javascripts/katex.js +16517 -0
- data/vendor/assets/javascripts/katex.min.js +1 -0
- data/vendor/assets/javascripts/katex.mjs +16122 -0
- data/vendor/assets/javascripts/quill.core.js +8522 -0
- data/vendor/assets/javascripts/quill.js +11489 -0
- data/vendor/assets/javascripts/quill.min.js +8 -0
- data/vendor/assets/javascripts/quill.min.js.map +1 -0
- data/vendor/assets/stylesheets/katex.css +1011 -0
- data/vendor/assets/stylesheets/katex.min.css +1 -0
- data/vendor/assets/stylesheets/quill.bubble.css +952 -0
- data/vendor/assets/stylesheets/quill.core.css +397 -0
- data/vendor/assets/stylesheets/quill.snow.css +945 -0
- metadata +169 -278
- data/CHANGELOG +0 -77
- data/Gemfile +0 -14
- data/VERSION +0 -1
- data/app/assets/javascripts/proclaim/editor.js.coffee +0 -52
- data/app/assets/javascripts/proclaim/images.js.coffee +0 -3
- data/app/assets/javascripts/proclaim/subscriptions.js.coffee +0 -3
- data/app/assets/stylesheets/proclaim/images.scss +0 -3
- data/app/controllers/proclaim/images_controller.rb +0 -67
- data/app/helpers/proclaim/comments_helper.rb +0 -4
- data/app/helpers/proclaim/images_helper.rb +0 -4
- data/app/helpers/proclaim/subscriptions_helper.rb +0 -4
- data/app/models/proclaim/image.rb +0 -19
- data/app/policies/proclaim/image_policy.rb +0 -29
- data/app/uploaders/proclaim/image_uploader.rb +0 -82
- data/db/migrate/20141222224905_create_proclaim_images.rb +0 -12
- data/db/migrate/20150123115226_add_name_to_subscriptions.rb +0 -7
- data/db/migrate/20150213015850_add_slug_to_posts.rb +0 -20
- data/proclaim.gemspec +0 -51
- data/test/controllers/proclaim/comments_controller_test.rb +0 -228
- data/test/controllers/proclaim/images_controller_test.rb +0 -166
- data/test/controllers/proclaim/posts_controller_test.rb +0 -465
- data/test/controllers/proclaim/subscriptions_controller_test.rb +0 -154
- data/test/dummy/README.rdoc +0 -28
- data/test/dummy/Rakefile +0 -6
- data/test/dummy/app/assets/javascripts/application.js +0 -14
- data/test/dummy/app/assets/stylesheets/application.css +0 -16
- data/test/dummy/app/controllers/application_controller.rb +0 -15
- data/test/dummy/app/helpers/application_helper.rb +0 -28
- data/test/dummy/app/models/user.rb +0 -7
- data/test/dummy/app/views/layouts/application.html.erb +0 -16
- data/test/dummy/bin/bundle +0 -3
- data/test/dummy/bin/rails +0 -4
- data/test/dummy/bin/rake +0 -4
- data/test/dummy/config.ru +0 -4
- data/test/dummy/config/application.rb +0 -24
- data/test/dummy/config/boot.rb +0 -5
- data/test/dummy/config/database.yml +0 -25
- data/test/dummy/config/environment.rb +0 -5
- data/test/dummy/config/environments/development.rb +0 -45
- data/test/dummy/config/environments/production.rb +0 -80
- data/test/dummy/config/environments/test.rb +0 -49
- data/test/dummy/config/initializers/assets.rb +0 -8
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/test/dummy/config/initializers/cookies_serializer.rb +0 -3
- data/test/dummy/config/initializers/filter_parameter_logging.rb +0 -4
- data/test/dummy/config/initializers/inflections.rb +0 -16
- data/test/dummy/config/initializers/mime_types.rb +0 -4
- data/test/dummy/config/initializers/session_store.rb +0 -3
- data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/test/dummy/config/locales/en.yml +0 -23
- data/test/dummy/config/routes.rb +0 -5
- data/test/dummy/config/secrets.yml +0 -22
- data/test/dummy/db/migrate/20141117214323_create_users.rb +0 -10
- data/test/dummy/db/schema.rb +0 -91
- data/test/dummy/public/404.html +0 -67
- data/test/dummy/public/422.html +0 -67
- data/test/dummy/public/500.html +0 -66
- data/test/dummy/public/favicon.ico +0 -0
- data/test/factories/proclaim/comment.rb +0 -11
- data/test/factories/proclaim/image.rb +0 -6
- data/test/factories/proclaim/post.rb +0 -14
- data/test/factories/proclaim/subscription.rb +0 -14
- data/test/factories/user.rb +0 -6
- data/test/helpers/proclaim/comments_helper_test.rb +0 -6
- data/test/helpers/proclaim/posts_helper_test.rb +0 -6
- data/test/helpers/proclaim/subscriptions_helper_test.rb +0 -6
- data/test/integration/with_javascript/comment_test.rb +0 -391
- data/test/integration/with_javascript/post_form_test.rb +0 -225
- data/test/integration/with_javascript/post_show_test.rb +0 -47
- data/test/integration/with_javascript/post_subscription_test.rb +0 -302
- data/test/integration/without_javascript/blog_subscription_test.rb +0 -114
- data/test/integration/without_javascript/manage_subscriptions_test.rb +0 -37
- data/test/integration/without_javascript/post_test.rb +0 -234
- data/test/integration/without_javascript/subscription_email_test.rb +0 -95
- data/test/integration/without_javascript/unsubscribe_test.rb +0 -32
- data/test/mailers/previews/proclaim/subscription_mailer_preview.rb +0 -22
- data/test/mailers/proclaim/subscription_mailer_test.rb +0 -91
- data/test/models/proclaim/comment_test.rb +0 -41
- data/test/models/proclaim/image_test.rb +0 -70
- data/test/models/proclaim/post_test.rb +0 -193
- data/test/models/proclaim/subscription_test.rb +0 -77
- data/test/policies/application_policy_test.rb +0 -87
- data/test/policies/proclaim/comment_policy_test.rb +0 -71
- data/test/policies/proclaim/image_policy_test.rb +0 -83
- data/test/policies/proclaim/post_policy_test.rb +0 -98
- data/test/policies/proclaim/subscription_policy_test.rb +0 -103
- data/test/proclaim_test.rb +0 -7
- data/test/support/images/test.jpg +0 -0
- data/test/support/pages/posts/edit_page.rb +0 -5
- data/test/support/pages/posts/show_page.rb +0 -47
- data/test/support/wait_for_ajax.rb +0 -11
- data/test/test_helper.rb +0 -71
- data/test/unit/proclaim/new_comment_callback_test.rb +0 -62
- data/test/unit/proclaim/new_subscription_callback_test.rb +0 -62
- data/test/unit/proclaim/post_published_callback_test.rb +0 -74
- data/vendor/assets/images/link.png +0 -0
- data/vendor/assets/images/remove.png +0 -0
- data/vendor/assets/images/resize-bigger.png +0 -0
- data/vendor/assets/images/resize-smaller.png +0 -0
- data/vendor/assets/images/unlink.png +0 -0
- data/vendor/assets/javascripts/addons/medium-editor-insert-embeds.js +0 -197
- data/vendor/assets/javascripts/addons/medium-editor-insert-images.js +0 -572
- data/vendor/assets/javascripts/addons/medium-editor-insert-maps.js +0 -50
- data/vendor/assets/javascripts/addons/medium-editor-insert-plugin.js +0 -496
- data/vendor/assets/javascripts/addons/medium-editor-insert-tables.js +0 -132
- data/vendor/assets/javascripts/medium-editor-insert-plugin.all.js +0 -1415
- data/vendor/assets/stylesheets/medium-editor-insert-plugin-frontend.css.scss +0 -55
- data/vendor/assets/stylesheets/medium-editor-insert-plugin.css.scss +0 -277
data/lib/proclaim.rb
CHANGED
@@ -16,21 +16,21 @@ module Proclaim
|
|
16
16
|
mattr_accessor :excerpt_length
|
17
17
|
@@excerpt_length = 500 # 500 characters (won't interrupt words)
|
18
18
|
|
19
|
-
mattr_accessor :
|
20
|
-
@@
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
19
|
+
mattr_accessor :editor_toolbar
|
20
|
+
@@editor_toolbar = [
|
21
|
+
['bold', 'italic', 'underline', 'strike', 'code'],
|
22
|
+
[{ 'header': 1 }, { 'header': 2 }],
|
23
|
+
['code-block'],
|
24
|
+
[{ 'align': []}],
|
25
|
+
[{ 'list': 'ordered'}, { 'list': 'bullet'}],
|
26
|
+
['link', 'image', 'video', 'formula']
|
27
|
+
]
|
28
|
+
|
29
|
+
mattr_accessor :editor_formats
|
30
|
+
@@editor_formats = [
|
31
|
+
'align', 'blockquote', 'bold', 'code', 'code-block', 'formula', 'header',
|
32
|
+
'image', 'italic', 'link', 'list', 'strike', 'underline', 'video'
|
33
|
+
]
|
34
34
|
|
35
35
|
mattr_accessor :mailer_sender
|
36
36
|
@@mailer_sender = nil
|
data/lib/proclaim/engine.rb
CHANGED
@@ -1,13 +1,11 @@
|
|
1
1
|
require 'rails'
|
2
2
|
require 'coffee-rails'
|
3
|
-
require '
|
3
|
+
require 'sassc-rails'
|
4
4
|
require 'jquery-rails'
|
5
5
|
require 'htmlentities'
|
6
6
|
require 'friendly_id'
|
7
7
|
require 'closure_tree'
|
8
8
|
require 'font-awesome-rails'
|
9
|
-
require 'medium-editor-rails'
|
10
|
-
require 'carrierwave'
|
11
9
|
require 'aasm'
|
12
10
|
require 'rails-timeago'
|
13
11
|
require 'pundit'
|
@@ -19,19 +17,13 @@ module Proclaim
|
|
19
17
|
|
20
18
|
initializer :assets do
|
21
19
|
Rails.application.config.assets.precompile += %w{
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
medium-editor-insert-plugin.all.js
|
30
|
-
addons/medium-editor-insert-embeds.js
|
31
|
-
addons/medium-editor-insert-maps.js
|
32
|
-
addons/medium-editor-insert-tables.js
|
33
|
-
addons/medium-editor-insert-images.js
|
34
|
-
addons/medium-editor-insert-plugin.js
|
20
|
+
quill.core.js
|
21
|
+
quill.js
|
22
|
+
quill.min.js
|
23
|
+
quill.min.js.map
|
24
|
+
quill.bubble.css
|
25
|
+
quill.core.css
|
26
|
+
quill.snow.css
|
35
27
|
}
|
36
28
|
end
|
37
29
|
|
@@ -49,14 +41,18 @@ module Proclaim
|
|
49
41
|
end
|
50
42
|
|
51
43
|
config.generators do |g|
|
52
|
-
g.fixture_replacement :
|
44
|
+
g.fixture_replacement :factory_bot, :dir => 'test/factories'
|
53
45
|
end
|
54
46
|
|
55
47
|
initializer :ensure_secret_key_presence do |app|
|
56
|
-
if app.respond_to?(:
|
48
|
+
if app.respond_to?(:credentials) && key_exists?(app.credentials)
|
49
|
+
Proclaim.secret_key ||= app.credentials.secret_key_base
|
50
|
+
elsif app.respond_to?(:secrets) && key_exists?(app.secrets)
|
57
51
|
Proclaim.secret_key ||= app.secrets.secret_key_base
|
58
|
-
elsif app.config.respond_to?(:secret_key_base)
|
52
|
+
elsif app.config.respond_to?(:secret_key_base) && key_exists?(app.config)
|
59
53
|
Proclaim.secret_key ||= app.config.secret_key_base
|
54
|
+
elsif app.respond_to?(:secret_key_base) && key_exists?(app)
|
55
|
+
Proclaim.secret_key ||= app.secret_key_base
|
60
56
|
end
|
61
57
|
|
62
58
|
if Proclaim.secret_key.nil?
|
@@ -69,5 +65,11 @@ Please ensure you restarted your application after installing Proclaim or settin
|
|
69
65
|
ERROR
|
70
66
|
end
|
71
67
|
end
|
68
|
+
|
69
|
+
private
|
70
|
+
|
71
|
+
def key_exists?(object)
|
72
|
+
object.secret_key_base.present?
|
73
|
+
end
|
72
74
|
end
|
73
75
|
end
|
data/lib/proclaim/version.rb
CHANGED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,339 @@
|
|
1
|
+
(function webpackUniversalModuleDefinition(root, factory) {
|
2
|
+
if(typeof exports === 'object' && typeof module === 'object')
|
3
|
+
module.exports = factory(require("katex"));
|
4
|
+
else if(typeof define === 'function' && define.amd)
|
5
|
+
define(["katex"], factory);
|
6
|
+
else if(typeof exports === 'object')
|
7
|
+
exports["renderMathInElement"] = factory(require("katex"));
|
8
|
+
else
|
9
|
+
root["renderMathInElement"] = factory(root["katex"]);
|
10
|
+
})((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE__0__) {
|
11
|
+
return /******/ (function(modules) { // webpackBootstrap
|
12
|
+
/******/ // The module cache
|
13
|
+
/******/ var installedModules = {};
|
14
|
+
/******/
|
15
|
+
/******/ // The require function
|
16
|
+
/******/ function __webpack_require__(moduleId) {
|
17
|
+
/******/
|
18
|
+
/******/ // Check if module is in cache
|
19
|
+
/******/ if(installedModules[moduleId]) {
|
20
|
+
/******/ return installedModules[moduleId].exports;
|
21
|
+
/******/ }
|
22
|
+
/******/ // Create a new module (and put it into the cache)
|
23
|
+
/******/ var module = installedModules[moduleId] = {
|
24
|
+
/******/ i: moduleId,
|
25
|
+
/******/ l: false,
|
26
|
+
/******/ exports: {}
|
27
|
+
/******/ };
|
28
|
+
/******/
|
29
|
+
/******/ // Execute the module function
|
30
|
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
31
|
+
/******/
|
32
|
+
/******/ // Flag the module as loaded
|
33
|
+
/******/ module.l = true;
|
34
|
+
/******/
|
35
|
+
/******/ // Return the exports of the module
|
36
|
+
/******/ return module.exports;
|
37
|
+
/******/ }
|
38
|
+
/******/
|
39
|
+
/******/
|
40
|
+
/******/ // expose the modules object (__webpack_modules__)
|
41
|
+
/******/ __webpack_require__.m = modules;
|
42
|
+
/******/
|
43
|
+
/******/ // expose the module cache
|
44
|
+
/******/ __webpack_require__.c = installedModules;
|
45
|
+
/******/
|
46
|
+
/******/ // define getter function for harmony exports
|
47
|
+
/******/ __webpack_require__.d = function(exports, name, getter) {
|
48
|
+
/******/ if(!__webpack_require__.o(exports, name)) {
|
49
|
+
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
50
|
+
/******/ }
|
51
|
+
/******/ };
|
52
|
+
/******/
|
53
|
+
/******/ // define __esModule on exports
|
54
|
+
/******/ __webpack_require__.r = function(exports) {
|
55
|
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
56
|
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
57
|
+
/******/ }
|
58
|
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
59
|
+
/******/ };
|
60
|
+
/******/
|
61
|
+
/******/ // create a fake namespace object
|
62
|
+
/******/ // mode & 1: value is a module id, require it
|
63
|
+
/******/ // mode & 2: merge all properties of value into the ns
|
64
|
+
/******/ // mode & 4: return value when already ns object
|
65
|
+
/******/ // mode & 8|1: behave like require
|
66
|
+
/******/ __webpack_require__.t = function(value, mode) {
|
67
|
+
/******/ if(mode & 1) value = __webpack_require__(value);
|
68
|
+
/******/ if(mode & 8) return value;
|
69
|
+
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
70
|
+
/******/ var ns = Object.create(null);
|
71
|
+
/******/ __webpack_require__.r(ns);
|
72
|
+
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
73
|
+
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
74
|
+
/******/ return ns;
|
75
|
+
/******/ };
|
76
|
+
/******/
|
77
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
78
|
+
/******/ __webpack_require__.n = function(module) {
|
79
|
+
/******/ var getter = module && module.__esModule ?
|
80
|
+
/******/ function getDefault() { return module['default']; } :
|
81
|
+
/******/ function getModuleExports() { return module; };
|
82
|
+
/******/ __webpack_require__.d(getter, 'a', getter);
|
83
|
+
/******/ return getter;
|
84
|
+
/******/ };
|
85
|
+
/******/
|
86
|
+
/******/ // Object.prototype.hasOwnProperty.call
|
87
|
+
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
88
|
+
/******/
|
89
|
+
/******/ // __webpack_public_path__
|
90
|
+
/******/ __webpack_require__.p = "";
|
91
|
+
/******/
|
92
|
+
/******/
|
93
|
+
/******/ // Load entry module and return exports
|
94
|
+
/******/ return __webpack_require__(__webpack_require__.s = 1);
|
95
|
+
/******/ })
|
96
|
+
/************************************************************************/
|
97
|
+
/******/ ([
|
98
|
+
/* 0 */
|
99
|
+
/***/ (function(module, exports) {
|
100
|
+
|
101
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__0__;
|
102
|
+
|
103
|
+
/***/ }),
|
104
|
+
/* 1 */
|
105
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
106
|
+
|
107
|
+
"use strict";
|
108
|
+
__webpack_require__.r(__webpack_exports__);
|
109
|
+
|
110
|
+
// EXTERNAL MODULE: external "katex"
|
111
|
+
var external_katex_ = __webpack_require__(0);
|
112
|
+
var external_katex_default = /*#__PURE__*/__webpack_require__.n(external_katex_);
|
113
|
+
|
114
|
+
// CONCATENATED MODULE: ./contrib/auto-render/splitAtDelimiters.js
|
115
|
+
/* eslint no-constant-condition:0 */
|
116
|
+
var findEndOfMath = function findEndOfMath(delimiter, text, startIndex) {
|
117
|
+
// Adapted from
|
118
|
+
// https://github.com/Khan/perseus/blob/master/src/perseus-markdown.jsx
|
119
|
+
var index = startIndex;
|
120
|
+
var braceLevel = 0;
|
121
|
+
var delimLength = delimiter.length;
|
122
|
+
|
123
|
+
while (index < text.length) {
|
124
|
+
var character = text[index];
|
125
|
+
|
126
|
+
if (braceLevel <= 0 && text.slice(index, index + delimLength) === delimiter) {
|
127
|
+
return index;
|
128
|
+
} else if (character === "\\") {
|
129
|
+
index++;
|
130
|
+
} else if (character === "{") {
|
131
|
+
braceLevel++;
|
132
|
+
} else if (character === "}") {
|
133
|
+
braceLevel--;
|
134
|
+
}
|
135
|
+
|
136
|
+
index++;
|
137
|
+
}
|
138
|
+
|
139
|
+
return -1;
|
140
|
+
};
|
141
|
+
|
142
|
+
var splitAtDelimiters = function splitAtDelimiters(startData, leftDelim, rightDelim, display) {
|
143
|
+
var finalData = [];
|
144
|
+
|
145
|
+
for (var i = 0; i < startData.length; i++) {
|
146
|
+
if (startData[i].type === "text") {
|
147
|
+
var text = startData[i].data;
|
148
|
+
var lookingForLeft = true;
|
149
|
+
var currIndex = 0;
|
150
|
+
var nextIndex = void 0;
|
151
|
+
nextIndex = text.indexOf(leftDelim);
|
152
|
+
|
153
|
+
if (nextIndex !== -1) {
|
154
|
+
currIndex = nextIndex;
|
155
|
+
finalData.push({
|
156
|
+
type: "text",
|
157
|
+
data: text.slice(0, currIndex)
|
158
|
+
});
|
159
|
+
lookingForLeft = false;
|
160
|
+
}
|
161
|
+
|
162
|
+
while (true) {
|
163
|
+
if (lookingForLeft) {
|
164
|
+
nextIndex = text.indexOf(leftDelim, currIndex);
|
165
|
+
|
166
|
+
if (nextIndex === -1) {
|
167
|
+
break;
|
168
|
+
}
|
169
|
+
|
170
|
+
finalData.push({
|
171
|
+
type: "text",
|
172
|
+
data: text.slice(currIndex, nextIndex)
|
173
|
+
});
|
174
|
+
currIndex = nextIndex;
|
175
|
+
} else {
|
176
|
+
nextIndex = findEndOfMath(rightDelim, text, currIndex + leftDelim.length);
|
177
|
+
|
178
|
+
if (nextIndex === -1) {
|
179
|
+
break;
|
180
|
+
}
|
181
|
+
|
182
|
+
finalData.push({
|
183
|
+
type: "math",
|
184
|
+
data: text.slice(currIndex + leftDelim.length, nextIndex),
|
185
|
+
rawData: text.slice(currIndex, nextIndex + rightDelim.length),
|
186
|
+
display: display
|
187
|
+
});
|
188
|
+
currIndex = nextIndex + rightDelim.length;
|
189
|
+
}
|
190
|
+
|
191
|
+
lookingForLeft = !lookingForLeft;
|
192
|
+
}
|
193
|
+
|
194
|
+
finalData.push({
|
195
|
+
type: "text",
|
196
|
+
data: text.slice(currIndex)
|
197
|
+
});
|
198
|
+
} else {
|
199
|
+
finalData.push(startData[i]);
|
200
|
+
}
|
201
|
+
}
|
202
|
+
|
203
|
+
return finalData;
|
204
|
+
};
|
205
|
+
|
206
|
+
/* harmony default export */ var auto_render_splitAtDelimiters = (splitAtDelimiters);
|
207
|
+
// CONCATENATED MODULE: ./contrib/auto-render/auto-render.js
|
208
|
+
/* eslint no-console:0 */
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
var auto_render_splitWithDelimiters = function splitWithDelimiters(text, delimiters) {
|
213
|
+
var data = [{
|
214
|
+
type: "text",
|
215
|
+
data: text
|
216
|
+
}];
|
217
|
+
|
218
|
+
for (var i = 0; i < delimiters.length; i++) {
|
219
|
+
var delimiter = delimiters[i];
|
220
|
+
data = auto_render_splitAtDelimiters(data, delimiter.left, delimiter.right, delimiter.display || false);
|
221
|
+
}
|
222
|
+
|
223
|
+
return data;
|
224
|
+
};
|
225
|
+
/* Note: optionsCopy is mutated by this method. If it is ever exposed in the
|
226
|
+
* API, we should copy it before mutating.
|
227
|
+
*/
|
228
|
+
|
229
|
+
|
230
|
+
var auto_render_renderMathInText = function renderMathInText(text, optionsCopy) {
|
231
|
+
var data = auto_render_splitWithDelimiters(text, optionsCopy.delimiters);
|
232
|
+
var fragment = document.createDocumentFragment();
|
233
|
+
|
234
|
+
for (var i = 0; i < data.length; i++) {
|
235
|
+
if (data[i].type === "text") {
|
236
|
+
fragment.appendChild(document.createTextNode(data[i].data));
|
237
|
+
} else {
|
238
|
+
var span = document.createElement("span");
|
239
|
+
var math = data[i].data; // Override any display mode defined in the settings with that
|
240
|
+
// defined by the text itself
|
241
|
+
|
242
|
+
optionsCopy.displayMode = data[i].display;
|
243
|
+
|
244
|
+
try {
|
245
|
+
if (optionsCopy.preProcess) {
|
246
|
+
math = optionsCopy.preProcess(math);
|
247
|
+
}
|
248
|
+
|
249
|
+
external_katex_default.a.render(math, span, optionsCopy);
|
250
|
+
} catch (e) {
|
251
|
+
if (!(e instanceof external_katex_default.a.ParseError)) {
|
252
|
+
throw e;
|
253
|
+
}
|
254
|
+
|
255
|
+
optionsCopy.errorCallback("KaTeX auto-render: Failed to parse `" + data[i].data + "` with ", e);
|
256
|
+
fragment.appendChild(document.createTextNode(data[i].rawData));
|
257
|
+
continue;
|
258
|
+
}
|
259
|
+
|
260
|
+
fragment.appendChild(span);
|
261
|
+
}
|
262
|
+
}
|
263
|
+
|
264
|
+
return fragment;
|
265
|
+
};
|
266
|
+
|
267
|
+
var renderElem = function renderElem(elem, optionsCopy) {
|
268
|
+
for (var i = 0; i < elem.childNodes.length; i++) {
|
269
|
+
var childNode = elem.childNodes[i];
|
270
|
+
|
271
|
+
if (childNode.nodeType === 3) {
|
272
|
+
// Text node
|
273
|
+
var frag = auto_render_renderMathInText(childNode.textContent, optionsCopy);
|
274
|
+
i += frag.childNodes.length - 1;
|
275
|
+
elem.replaceChild(frag, childNode);
|
276
|
+
} else if (childNode.nodeType === 1) {
|
277
|
+
(function () {
|
278
|
+
// Element node
|
279
|
+
var className = ' ' + childNode.className + ' ';
|
280
|
+
var shouldRender = optionsCopy.ignoredTags.indexOf(childNode.nodeName.toLowerCase()) === -1 && optionsCopy.ignoredClasses.every(function (x) {
|
281
|
+
return className.indexOf(' ' + x + ' ') === -1;
|
282
|
+
});
|
283
|
+
|
284
|
+
if (shouldRender) {
|
285
|
+
renderElem(childNode, optionsCopy);
|
286
|
+
}
|
287
|
+
})();
|
288
|
+
} // Otherwise, it's something else, and ignore it.
|
289
|
+
|
290
|
+
}
|
291
|
+
};
|
292
|
+
|
293
|
+
var renderMathInElement = function renderMathInElement(elem, options) {
|
294
|
+
if (!elem) {
|
295
|
+
throw new Error("No element provided to render");
|
296
|
+
}
|
297
|
+
|
298
|
+
var optionsCopy = {}; // Object.assign(optionsCopy, option)
|
299
|
+
|
300
|
+
for (var option in options) {
|
301
|
+
if (options.hasOwnProperty(option)) {
|
302
|
+
optionsCopy[option] = options[option];
|
303
|
+
}
|
304
|
+
} // default options
|
305
|
+
|
306
|
+
|
307
|
+
optionsCopy.delimiters = optionsCopy.delimiters || [{
|
308
|
+
left: "$$",
|
309
|
+
right: "$$",
|
310
|
+
display: true
|
311
|
+
}, {
|
312
|
+
left: "\\(",
|
313
|
+
right: "\\)",
|
314
|
+
display: false
|
315
|
+
}, // LaTeX uses $…$, but it ruins the display of normal `$` in text:
|
316
|
+
// {left: "$", right: "$", display: false},
|
317
|
+
// \[…\] must come last in this array. Otherwise, renderMathInElement
|
318
|
+
// will search for \[ before it searches for $$ or \(
|
319
|
+
// That makes it susceptible to finding a \\[0.3em] row delimiter and
|
320
|
+
// treating it as if it were the start of a KaTeX math zone.
|
321
|
+
{
|
322
|
+
left: "\\[",
|
323
|
+
right: "\\]",
|
324
|
+
display: true
|
325
|
+
}];
|
326
|
+
optionsCopy.ignoredTags = optionsCopy.ignoredTags || ["script", "noscript", "style", "textarea", "pre", "code"];
|
327
|
+
optionsCopy.ignoredClasses = optionsCopy.ignoredClasses || [];
|
328
|
+
optionsCopy.errorCallback = optionsCopy.errorCallback || console.error; // Enable sharing of global macros defined via `\gdef` between different
|
329
|
+
// math elements within a single call to `renderMathInElement`.
|
330
|
+
|
331
|
+
optionsCopy.macros = optionsCopy.macros || {};
|
332
|
+
renderElem(elem, optionsCopy);
|
333
|
+
};
|
334
|
+
|
335
|
+
/* harmony default export */ var auto_render = __webpack_exports__["default"] = (renderMathInElement);
|
336
|
+
|
337
|
+
/***/ })
|
338
|
+
/******/ ])["default"];
|
339
|
+
});
|