diff --git a/lib/gollum/frontend/app.rb b/lib/gollum/frontend/app.rb index 73d000c6..810391bc 100644 --- a/lib/gollum/frontend/app.rb +++ b/lib/gollum/frontend/app.rb @@ -113,7 +113,7 @@ module Precious @name = "Preview" @page = wiki.preview_page(@name, params[:content], params[:format]) @content = @page.formatted_data - @toc_content = @page.toc_data + @toc_content = wiki.universal_toc ? @page.toc_data : nil @editable = false mustache :page end @@ -199,7 +199,7 @@ module Precious @name = name @editable = true @content = page.formatted_data - @toc_content = page.toc_data + @toc_content = wiki.universal_toc ? @page.toc_data : nil mustache :page elsif file = wiki.file(name) diff --git a/lib/gollum/page.rb b/lib/gollum/page.rb index 218a460b..10716dd8 100644 --- a/lib/gollum/page.rb +++ b/lib/gollum/page.rb @@ -100,6 +100,7 @@ module Gollum def initialize(wiki) @wiki = wiki @blob = @header = @footer = @sidebar = nil + @doc = nil end # Public: The on-disk filename of the page including extension. diff --git a/lib/gollum/wiki.rb b/lib/gollum/wiki.rb index deb97c52..9c065c9a 100644 --- a/lib/gollum/wiki.rb +++ b/lib/gollum/wiki.rb @@ -133,6 +133,7 @@ module Gollum # path - The String path to the Git repository that holds the Gollum # site. # options - Optional Hash: + # :universal_toc - Display table of contents on all pages. Default: false # :base_path - String base path for all Wiki links. # Default: "/" # :page_class - The page Class. Default: Gollum::Page @@ -164,6 +165,7 @@ module Gollum self.class.default_ws_subs @history_sanitization = options[:history_sanitization] || self.class.history_sanitization + @universal_toc = options[:universal_toc] || false end # Public: check whether the wiki's git repo exists on the filesystem. @@ -527,6 +529,9 @@ module Gollum # Gets the markup class used by all instances of this Wiki. attr_reader :markup_classes + # Toggles display of universal table of contents + attr_reader :universal_toc + # Normalize the data. # # data - The String data to be normalized.