From ee55b7489865f81da07a3c1fd14154958ea26851 Mon Sep 17 00:00:00 2001 From: Hardy Date: Thu, 14 Aug 2014 18:00:34 -0400 Subject: [PATCH] add --mathjax [CONFIG] to inject root-repo/[CONFIG] file, which is similar to the behavior of --css and --js. CONFIG is "mathjax.config.js" by default. --- README.md | 1 + bin/gollum | 4 ++++ lib/gollum/app.rb | 1 + lib/gollum/templates/layout.mustache | 12 +++++++++--- lib/gollum/views/page.rb | 4 ++++ 5 files changed, 19 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 43208fd4..f5a058a3 100644 --- a/README.md +++ b/README.md @@ -111,6 +111,7 @@ Options: --live-preview Enables livepreview. --allow-uploads Allows file uploads. --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. diff --git a/bin/gollum b/bin/gollum index 3a4908e2..4a5c1f4a 100755 --- a/bin/gollum +++ b/bin/gollum @@ -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 diff --git a/lib/gollum/app.rb b/lib/gollum/app.rb index 600ec654..d5000efe 100644 --- a/lib/gollum/app.rb +++ b/lib/gollum/app.rb @@ -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 diff --git a/lib/gollum/templates/layout.mustache b/lib/gollum/templates/layout.mustache index 7c58bdd4..805b6361 100644 --- a/lib/gollum/templates/layout.mustache +++ b/lib/gollum/templates/layout.mustache @@ -31,15 +31,21 @@ {{/use_identicon}} {{#mathjax}} - + {{/mathjax_config}} + {{#mathjax_config}} + + {{/mathjax_config}}