diff --git a/lib/gollum/wiki.rb b/lib/gollum/wiki.rb index fe6183a5..a77d8c7c 100644 --- a/lib/gollum/wiki.rb +++ b/lib/gollum/wiki.rb @@ -32,6 +32,10 @@ module Gollum # sanitization altogether. attr_writer :history_sanitization + # Hash for setting different default wiki options + # These defaults can be overridden by options passed directly to initialize() + attr_accessor :default_options + # Gets the page class used by all instances of this Wiki. # Default: Gollum::Page. def page_class @@ -107,6 +111,7 @@ module Gollum self.default_committer_email = 'anon@anon.com' self.default_ws_subs = ['_','-'] + self.default_options = {} # The String base path to prefix to internal links. For example, when set # to "/wiki", the page "Hobbit" will be linked as "/wiki/Hobbit". Defaults @@ -150,6 +155,7 @@ module Gollum # # Returns a fresh Gollum::Repo. def initialize(path, options = {}) + options = self.class.default_options.merge(options) if path.is_a?(GitAccess) options[:access] = path path = path.path diff --git a/test/test_markup.rb b/test/test_markup.rb index 5a47a8f7..bf4e64c9 100644 --- a/test/test_markup.rb +++ b/test/test_markup.rb @@ -6,6 +6,7 @@ context "Markup" do @path = testpath("examples/test.git") FileUtils.rm_rf(@path) Grit::Repo.init_bare(@path) + Gollum::Wiki.default_options = {:header_hashtags => false, :universal_toc => false} @wiki = Gollum::Wiki.new(@path) end diff --git a/test/test_wiki.rb b/test/test_wiki.rb index 9fec5275..f866f853 100644 --- a/test/test_wiki.rb +++ b/test/test_wiki.rb @@ -92,6 +92,7 @@ end context "Wiki page previewing" do setup do @path = testpath("examples/lotr.git") + Gollum::Wiki.default_options = {:header_hashtags => false, :universal_toc => false} @wiki = Gollum::Wiki.new(@path) end