Merge pull request #1358 from gollum/fix_1340

Make mathjax.config.js the standard filename. Fixes #1340.
This commit is contained in:
Bart Kamphorst
2018-12-28 23:10:48 +01:00
committed by GitHub
3 changed files with 9 additions and 8 deletions
+1 -4
View File
@@ -134,6 +134,7 @@ MSG
opts.on("--mathjax", "Enable MathJax (renders mathematical equations).",
"By default, uses the 'TeX-AMS-MML_HTMLorMML' config with the 'autoload-all' extension.") do
wiki_options[:mathjax] = true
wiki_options[:mathjax_config] = 'mathjax.config.js'
end
opts.on("--critic-markup", "Enable support for annotations using CriticMarkup.") do
wiki_options[:critic_markup] = true
@@ -155,10 +156,6 @@ MSG
"Can be set to 'gravatar', 'identicon' or 'none'. Default: 'none'.") do |mode|
wiki_options[:user_icons] = mode
end
opts.on("--mathjax-config [FILE]", "Specify path to a custom MathJax configuration.",
"If not specified, uses the '<git-repo>/mathjax.config.js' file.") do |file|
wiki_options[:mathjax_config] = file || 'mathjax.config.js'
end
opts.on("--template-dir [PATH]", "Specify custom mustache template directory.") do |path|
wiki_options[:template_dir] = path
end
+3 -3
View File
@@ -152,15 +152,15 @@ module Precious
end
end
get %r{/(edit|create)/custom\.(js|css)} do
get %r{/(edit|create)/(custom|mathjax\.config)\.(js|css)} do
forbid('Changing this resource is not allowed.')
end
post %r{/(delete|rename|edit|create)/custom\.(js|css)} do
post %r{/(delete|rename|edit|create)/(custom|mathjax\.config)\.(js|css)} do
forbid('Changing this resource is not allowed.')
end
post %r{/revert/custom\.(js|css)/.*/.*} do
post %r{/revert/(custom|mathjax\.config\.)\.(js|css)/.*/.*} do
forbid('Changing this resource is not allowed.')
end
+5 -1
View File
@@ -54,7 +54,7 @@ context "Frontend" do
{ :name => 'user1', :email => 'user1' });
get page
expected = "<h2><a class=\"anchor\" (href|id)=\"(#)?#{text}\" (href|id)=\"(#)?#{text}\"><i class=\"fa fa-link\"></i></a>#{text}</h2>"
expected = "<h2 class=\"editable\"><a class=\"anchor\" (href|id)=\"(#)?#{text}\" (href|id)=\"(#)?#{text}\"><i class=\"fa fa-link\"></i></a>#{text}</h2>"
actual = nfd(last_response.body)
assert_match /#{expected}/, actual
@@ -524,6 +524,8 @@ context "Frontend" do
get "/gollum/#{route}/custom#{ext}"
assert_equal 403, last_response.status, "get /gollum/#{route}/custom#{ext} -- #{last_response.inspect}"
end
get "/gollum/#{route}/mathjax.config.js"
assert_equal 403, last_response.status, "get /gollum/#{route}/mathjax.config.js -- #{last_response.inspect}"
end
['delete', 'rename', 'edit', 'create'].each do |route|
@@ -531,6 +533,8 @@ context "Frontend" do
post "/gollum/#{route}/custom#{ext}"
assert_equal 403, last_response.status, "post /gollum/#{route}/custom#{ext} -- #{last_response.inspect}"
end
post "/gollum/#{route}/mathjax.config.js"
assert_equal 403, last_response.status, "post /gollum/#{route}/mathjax.config.js -- #{last_response.inspect}"
end
['.css', '.js'].each do |ext|