diff --git a/lib/gollum/page.rb b/lib/gollum/page.rb
index acd7c405..9787c3ee 100644
--- a/lib/gollum/page.rb
+++ b/lib/gollum/page.rb
@@ -124,35 +124,13 @@ module Gollum
self.class.canonicalize_filename(filename)
end
- # Public: If the first element of a formatted page is an
tag it can
- # be considered the title of the page and used in the display. If the
- # first element is NOT an tag, the title will be constructed from the
+ # Public: The title will be constructed from the
# filename by stripping the extension and replacing any dashes with
# spaces.
#
# Returns the fully sanitized String title.
def title
- doc = Nokogiri::HTML(%{
} + self.formatted_data + %{
})
-
- header =
- case self.format
- when :asciidoc
- doc.css("div#gollum-root > div#header > h1:first-child")
- when :org
- doc.css("div#gollum-root > p.title:first-child")
- when :pod
- doc.css("div#gollum-root > a.dummyTopAnchor:first-child + h1")
- when :rest
- doc.css("div#gollum-root > div > div > h1:first-child")
- else
- doc.css("div#gollum-root > h1:first-child")
- end
-
- if !header.empty?
- Sanitize.clean(header.to_html)
- else
- Sanitize.clean(name)
- end.strip
+ header = Sanitize.clean(name).strip
end
# Public: The path of the page within the repo.
diff --git a/test/test_page.rb b/test/test_page.rb
index 5ba48a55..9adf4660 100644
--- a/test/test_page.rb
+++ b/test/test_page.rb
@@ -104,12 +104,12 @@ context "Page" do
assert_equal 'My Precious', page.title
end
- test "title from h1 with normal contents" do
+ test "title from filename with normal contents" do
page = @wiki.page('Home')
- assert_equal "The LOTR Wiki", page.title
+ assert_equal "Home", page.title
end
- test "title from h1 with html contents" do
+ test "title from filename with html contents" do
page = @wiki.page('Eye Of Sauron')
assert_equal "Eye Of Sauron", page.title
end
@@ -163,4 +163,4 @@ context "Page" do
assert_equal "/foo", Gollum::BlobEntry.normalize_dir("foo")
assert_equal "/foo", Gollum::BlobEntry.normalize_dir("/foo")
end
-end
\ No newline at end of file
+end