Fix #539
This commit is contained in:
@@ -8,7 +8,7 @@ module Precious
|
|||||||
DEFAULT_AUTHOR = 'you'
|
DEFAULT_AUTHOR = 'you'
|
||||||
|
|
||||||
def title
|
def title
|
||||||
@page.url_path.gsub("-", " ")
|
@page.url_path_title
|
||||||
end
|
end
|
||||||
|
|
||||||
def page_header
|
def page_header
|
||||||
|
|||||||
@@ -168,6 +168,27 @@ module Gollum
|
|||||||
path
|
path
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Public: Defines title for page.rb
|
||||||
|
#
|
||||||
|
# Returns the String title
|
||||||
|
def url_path_title
|
||||||
|
metadata_title || url_path.gsub("-", " ")
|
||||||
|
end
|
||||||
|
|
||||||
|
# Public: Metadata title
|
||||||
|
#
|
||||||
|
# Set with <!-- --- title: New Title --> in page content
|
||||||
|
#
|
||||||
|
# Returns the String title or nil if not defined
|
||||||
|
def metadata_title
|
||||||
|
if metadata
|
||||||
|
title = metadata['title']
|
||||||
|
return title unless title.nil?
|
||||||
|
end
|
||||||
|
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
|
||||||
# Public: The url_path, but CGI escaped.
|
# Public: The url_path, but CGI escaped.
|
||||||
#
|
#
|
||||||
# Returns the String url_path
|
# Returns the String url_path
|
||||||
|
|||||||
@@ -198,6 +198,14 @@ context "Wiki page writing" do
|
|||||||
assert_equal cd[:email], @wiki.repo.commits.first.author.email
|
assert_equal cd[:email], @wiki.repo.commits.first.author.email
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "page title override with metadata" do
|
||||||
|
@wiki.write_page("Gollum", :markdown, "<!-- --- title: Over -->", commit_details)
|
||||||
|
|
||||||
|
page = @wiki.page("Gollum")
|
||||||
|
|
||||||
|
assert_equal 'Over', page.url_path_title
|
||||||
|
end
|
||||||
|
|
||||||
test "update page with format change" do
|
test "update page with format change" do
|
||||||
@wiki.write_page("Gollum", :markdown, "# Gollum", commit_details)
|
@wiki.write_page("Gollum", :markdown, "# Gollum", commit_details)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user