Add universal_toc wiki option

This commit is contained in:
kristi
2012-05-09 16:13:53 -07:00
parent 065d06a98f
commit 61987c85d2
3 changed files with 8 additions and 2 deletions
+2 -2
View File
@@ -113,7 +113,7 @@ module Precious
@name = "Preview" @name = "Preview"
@page = wiki.preview_page(@name, params[:content], params[:format]) @page = wiki.preview_page(@name, params[:content], params[:format])
@content = @page.formatted_data @content = @page.formatted_data
@toc_content = @page.toc_data @toc_content = wiki.universal_toc ? @page.toc_data : nil
@editable = false @editable = false
mustache :page mustache :page
end end
@@ -199,7 +199,7 @@ module Precious
@name = name @name = name
@editable = true @editable = true
@content = page.formatted_data @content = page.formatted_data
@toc_content = page.toc_data @toc_content = wiki.universal_toc ? @page.toc_data : nil
mustache :page mustache :page
elsif file = wiki.file(name) elsif file = wiki.file(name)
+1
View File
@@ -100,6 +100,7 @@ module Gollum
def initialize(wiki) def initialize(wiki)
@wiki = wiki @wiki = wiki
@blob = @header = @footer = @sidebar = nil @blob = @header = @footer = @sidebar = nil
@doc = nil
end end
# Public: The on-disk filename of the page including extension. # Public: The on-disk filename of the page including extension.
+5
View File
@@ -133,6 +133,7 @@ module Gollum
# path - The String path to the Git repository that holds the Gollum # path - The String path to the Git repository that holds the Gollum
# site. # site.
# options - Optional Hash: # options - Optional Hash:
# :universal_toc - Display table of contents on all pages. Default: false
# :base_path - String base path for all Wiki links. # :base_path - String base path for all Wiki links.
# Default: "/" # Default: "/"
# :page_class - The page Class. Default: Gollum::Page # :page_class - The page Class. Default: Gollum::Page
@@ -164,6 +165,7 @@ module Gollum
self.class.default_ws_subs self.class.default_ws_subs
@history_sanitization = options[:history_sanitization] || @history_sanitization = options[:history_sanitization] ||
self.class.history_sanitization self.class.history_sanitization
@universal_toc = options[:universal_toc] || false
end end
# Public: check whether the wiki's git repo exists on the filesystem. # 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. # Gets the markup class used by all instances of this Wiki.
attr_reader :markup_classes attr_reader :markup_classes
# Toggles display of universal table of contents
attr_reader :universal_toc
# Normalize the data. # Normalize the data.
# #
# data - The String data to be normalized. # data - The String data to be normalized.