diff --git a/bin/gollum b/bin/gollum index e45deff7..b11de239 100755 --- a/bin/gollum +++ b/bin/gollum @@ -52,6 +52,10 @@ opts = OptionParser.new do |opts| opts.on("--ref [REF]", "Specify the repository ref to use (default: master).") do |ref| wiki_options[:ref] = ref end + + opts.on("--no-mathjax", "Disables mathjax.") do + options['mathjax'] = false + end end # Read command line options into `options` hash diff --git a/lib/gollum/frontend/app.rb b/lib/gollum/frontend/app.rb index ebd4d999..ff41b692 100644 --- a/lib/gollum/frontend/app.rb +++ b/lib/gollum/frontend/app.rb @@ -138,6 +138,7 @@ module Precious @page = wiki.preview_page(@name, params[:content], params[:format]) @content = @page.formatted_data @toc_content = wiki.universal_toc ? @page.toc_data : nil + @mathjax = wiki.mathjax @editable = false mustache :page end @@ -235,6 +236,7 @@ module Precious @editable = true @content = page.formatted_data @toc_content = wiki.universal_toc ? @page.toc_data : nil + @mathjax = wiki.mathjax mustache :page elsif file = wiki.file(name) diff --git a/lib/gollum/frontend/templates/layout.mustache b/lib/gollum/frontend/templates/layout.mustache index 1773a906..d79c4aad 100644 --- a/lib/gollum/frontend/templates/layout.mustache +++ b/lib/gollum/frontend/templates/layout.mustache @@ -16,8 +16,8 @@ - + + {{#mathjax}}{{/mathjax}} {{title}} diff --git a/lib/gollum/frontend/views/page.rb b/lib/gollum/frontend/views/page.rb index 16576f2b..9afba6aa 100644 --- a/lib/gollum/frontend/views/page.rb +++ b/lib/gollum/frontend/views/page.rb @@ -67,12 +67,18 @@ module Precious def sidebar_format has_sidebar && @sidebar.format.to_s end + def has_toc !@toc_content.nil? end + def toc_content @toc_content end + + def mathjax + @mathjax + end end end end diff --git a/lib/gollum/wiki.rb b/lib/gollum/wiki.rb index 6f0ae6ba..c584d0ea 100644 --- a/lib/gollum/wiki.rb +++ b/lib/gollum/wiki.rb @@ -149,6 +149,7 @@ module Gollum # :page_file_dir - String the directory in which all page files reside # :ref - String the repository ref to retrieve pages from # :ws_subs - Array of chars to sub for ws in filenames. + # :mathjax - Set to false to disable mathjax. # # Returns a fresh Gollum::Repo. def initialize(path, options = {}) @@ -173,6 +174,7 @@ module Gollum @history_sanitization = options[:history_sanitization] || self.class.history_sanitization @universal_toc = options.fetch(:universal_toc, false) + @mathjax = options[:mathjax] || true end # Public: check whether the wiki's git repo exists on the filesystem. @@ -539,6 +541,9 @@ module Gollum # Toggles display of universal table of contents attr_reader :universal_toc + # Toggles mathjax. + attr_reader :mathjax + # Normalize the data. # # data - The String data to be normalized.