Fix #579
This commit is contained in:
@@ -80,6 +80,9 @@ opts = OptionParser.new do |opts|
|
|||||||
opts.on("--collapse-tree", "Collapse file view tree. By default, expanded tree is shown.") do
|
opts.on("--collapse-tree", "Collapse file view tree. By default, expanded tree is shown.") do
|
||||||
wiki_options[:collapse_tree] = true
|
wiki_options[:collapse_tree] = true
|
||||||
end
|
end
|
||||||
|
opts.on("--h1-title", "Sets page title to value of first h1") do
|
||||||
|
wiki_options[:h1_title] = true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Read command line options into `options` hash
|
# Read command line options into `options` hash
|
||||||
|
|||||||
@@ -239,6 +239,7 @@ module Precious
|
|||||||
@toc_content = wiki.universal_toc ? @page.toc_data : nil
|
@toc_content = wiki.universal_toc ? @page.toc_data : nil
|
||||||
@mathjax = wiki.mathjax
|
@mathjax = wiki.mathjax
|
||||||
@css = wiki.css
|
@css = wiki.css
|
||||||
|
@h1_title = wiki.h1_title
|
||||||
@editable = false
|
@editable = false
|
||||||
mustache :page
|
mustache :page
|
||||||
end
|
end
|
||||||
@@ -362,6 +363,7 @@ module Precious
|
|||||||
@toc_content = wiki.universal_toc ? @page.toc_data : nil
|
@toc_content = wiki.universal_toc ? @page.toc_data : nil
|
||||||
@mathjax = wiki.mathjax
|
@mathjax = wiki.mathjax
|
||||||
@css = wiki.css
|
@css = wiki.css
|
||||||
|
@h1_title = wiki.h1_title
|
||||||
mustache :page
|
mustache :page
|
||||||
elsif file = wiki.file(fullpath)
|
elsif file = wiki.file(fullpath)
|
||||||
content_type file.mime_type
|
content_type file.mime_type
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ module Precious
|
|||||||
DEFAULT_AUTHOR = 'you'
|
DEFAULT_AUTHOR = 'you'
|
||||||
|
|
||||||
def title
|
def title
|
||||||
@page.url_path_title
|
h1 = @h1_title ? page_header_from_content(@content) : false
|
||||||
|
h1 || @page.url_path_title
|
||||||
end
|
end
|
||||||
|
|
||||||
def page_header
|
def page_header
|
||||||
|
|||||||
@@ -141,6 +141,10 @@ module Gollum
|
|||||||
# Defaults to false
|
# Defaults to false
|
||||||
attr_reader :css
|
attr_reader :css
|
||||||
|
|
||||||
|
# Sets page title to value of first h1
|
||||||
|
# Defaults to false
|
||||||
|
attr_reader :h1_title
|
||||||
|
|
||||||
# Public: Initialize a new Gollum Repo.
|
# Public: Initialize a new Gollum Repo.
|
||||||
#
|
#
|
||||||
# path - The String path to the Git repository that holds the Gollum
|
# path - The String path to the Git repository that holds the Gollum
|
||||||
@@ -196,6 +200,7 @@ module Gollum
|
|||||||
@show_all = options.fetch :show_all, false
|
@show_all = options.fetch :show_all, false
|
||||||
@collapse_tree = options.fetch :collapse_tree, false
|
@collapse_tree = options.fetch :collapse_tree, false
|
||||||
@css = options.fetch :css, false
|
@css = options.fetch :css, false
|
||||||
|
@h1_title = options.fetch :h1_title, 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.
|
||||||
|
|||||||
Reference in New Issue
Block a user