Merge pull request #847 from hardywu/master

add --mathjax-config to inject root-repo/mathjax.config.js. Closes #842.
This commit is contained in:
Dawa Ometto
2014-10-05 12:41:03 +02:00
5 changed files with 19 additions and 3 deletions
+1
View File
@@ -112,6 +112,7 @@ Options:
--live-preview Enables livepreview.
--allow-uploads [MODE] Allows file uploads. Modes: dir (default, store all uploads in the same directory), page (store each upload at the same location as the page).
--mathjax Enables mathjax.
--mathjax-config [SOURCE] Inject custom mathjax config. Uses mathjax.config.js from root repository by default
--user-icons [SOURCE] Set the history user icons. Valid values: gravatar, identicon, none. Default: none.
--show-all Shows all files in file view. By default only valid pages are shown.
--collapse-tree Collapse file view tree. By default, expanded tree is shown.
+4
View File
@@ -93,6 +93,10 @@ opts = OptionParser.new do |opts|
wiki_options[:mathjax] = true
end
opts.on("--mathjax-config [SOURCE]", "Inject custom mathjax config file. Uses mathjax.config.js from root repository by default") do |source|
wiki_options[:mathjax_config] = source || 'mathjax.config.js'
end
opts.on("--user-icons [SOURCE]", "Set the history user icons. Valid values: gravatar, identicon, none. Default: none.") do |source|
wiki_options[:user_icons] = source
end
+1
View File
@@ -91,6 +91,7 @@ module Precious
settings.wiki_options.merge!({ :base_path => @base_url })
@css = settings.wiki_options[:css]
@js = settings.wiki_options[:js]
@mathjax_config = settings.wiki_options[:mathjax_config]
end
get '/' do
+9 -3
View File
@@ -31,15 +31,21 @@
<script type="text/javascript" src="{{base_url}}/javascript/identicon_canvas.js"></script>
{{/use_identicon}}
{{#mathjax}}
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
{{^mathjax_config}}
<script type="text/javascript">
window.MathJax = {
tex2jax: {
inlineMath: [ ['\\(','\\)'] ],
displayMath: [ ['$$','$$'], ['\\[','\\]'] ],
processEscapes: true
},
TeX: { extensions: ["autoload-all.js"] }});
TeX: { extensions: ["autoload-all.js"] }
};
</script>
{{/mathjax_config}}
{{#mathjax_config}}
<script type="text/javascript" src="{{base_url}}/{{mathjax_config}}"></script>
{{/mathjax_config}}
<script>(function(d,j){
j = d.createElement('script');
j.src = '//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML';
+4
View File
@@ -110,6 +110,10 @@ module Precious
@mathjax
end
def mathjax_config
@mathjax_config
end
def use_identicon
@page.wiki.user_icons == 'identicon'
end