diff --git a/gollum.gemspec b/gollum.gemspec index 192cde1e..e8caba6d 100644 --- a/gollum.gemspec +++ b/gollum.gemspec @@ -23,7 +23,7 @@ Gem::Specification.new do |s| s.extra_rdoc_files = %w[README.md LICENSE] s.add_dependency('grit', "~> 2.4.1") - s.add_dependency('github-markup', [">= 0.4.0", "< 1.0.0"]) + s.add_dependency('github-markup', [">= 0.7.0", "< 1.0.0"]) s.add_dependency('pygments.rb', "~> 0.2.0") s.add_dependency('posix-spawn', "~> 0.3.0") s.add_dependency('sinatra', "~> 1.0") @@ -35,7 +35,6 @@ Gem::Specification.new do |s| s.add_development_dependency('RedCloth') s.add_development_dependency('mocha') s.add_development_dependency('org-ruby') - s.add_development_dependency('rdiscount') s.add_development_dependency('shoulda') s.add_development_dependency('rack-test') s.add_development_dependency('wikicloth', '~> 0.6.3') diff --git a/lib/gollum/frontend/templates/history.mustache b/lib/gollum/frontend/templates/history.mustache index 0f8c165d..eb4b6f5b 100755 --- a/lib/gollum/frontend/templates/history.mustache +++ b/lib/gollum/frontend/templates/history.mustache @@ -29,7 +29,7 @@
<\/p>/, '') data end - def doc_to_html(doc) - doc.to_xhtml(:save_with => Nokogiri::XML::Node::SaveOptions::AS_XHTML) - end - ######################################################################### # # TeX diff --git a/lib/gollum/sanitization.rb b/lib/gollum/sanitization.rb index ce813e6b..615feb26 100644 --- a/lib/gollum/sanitization.rb +++ b/lib/gollum/sanitization.rb @@ -43,7 +43,7 @@ module Gollum # Default whitelisted protocols for URLs. PROTOCOLS = { - 'a' => {'href' => ['http', 'https', 'mailto', :relative]}, + 'a' => {'href' => ['http', 'https', 'mailto', 'ftp', 'irc', :relative]}, 'img' => {'src' => ['http', 'https', :relative]} }.freeze diff --git a/lib/gollum/wiki.rb b/lib/gollum/wiki.rb index 19cfb1e5..31a9fdbe 100644 --- a/lib/gollum/wiki.rb +++ b/lib/gollum/wiki.rb @@ -54,32 +54,30 @@ module Gollum # Gets the markup class used by all instances of this Wiki. # Default: Gollum::Markup def markup_classes - @markup_classes || + @markup_classes ||= if superclass.respond_to?(:markup_classes) superclass.markup_classes else - classes = Hash.new(::Gollum::Markup) - - # Add custom markup classes for different languages - classes[:markdown] = ::Gollum::MarkupGFM - classes + Hash.new(::Gollum::Markup) end end # Gets the default markup class used by all instances of this Wiki. # Kept for backwards compatibility until Gollum v2.x - def markup_class - markup_classes[:default] + def markup_class(language=:default) + markup_classes[language] end # Sets the default markup class used by all instances of this Wiki. # Kept for backwards compatibility until Gollum v2.x def markup_class=(default) - new_classes = Hash.new default @markup_classes = Hash.new(default).update(markup_classes) default end + alias_method :default_markup_class, :markup_class + alias_method :default_markup_class=, :markup_class= + # Gets the default sanitization options for current pages used by # instances of this Wiki. def sanitization diff --git a/test/test_markup.rb b/test/test_markup.rb index 27433086..601ab9fd 100644 --- a/test/test_markup.rb +++ b/test/test_markup.rb @@ -189,7 +189,7 @@ context "Markup" do page = @wiki.page(name) output = page.formatted_data - assert_equal %{
a
b
a
b
a b
a b
a
a b
a
a b
a
a b
a
a b
a
a b
a
a b
a
b
a
b
a 
b
a 
b
a
b
a
b
a
b
a
b
a
b
a
b
a
b
a
b
a
b
a
b
a
\n\n
b
" + output = "a
\n\n
b
" relative_image(content, output) end test "image with float and align" do %w{left right}.each do |align| content = "a\n\n[[alpha.jpg|float|align=#{align}]]\n\nb" - output = "a
\n\n
b
" + output = "a
\n\n
b
" relative_image(content, output) end end test "image with frame" do content = "a\n\n[[alpha.jpg|frame]]\n\nb" - output = "a
\n\n
b
" + output = "a
\n\n
b
" relative_image(content, output) end test "absolute image with frame" do content = "a\n\n[[http://example.com/bilbo.jpg|frame]]\n\nb" - output = "a
\n\n
b
" + output = "a
\n\n
b
" relative_image(content, output) end test "image with frame and alt" do content = "a\n\n[[alpha.jpg|frame|alt=Alpha]]\n\nb" - output = "a
\n\n
Alpha
b
" + output = "a
\n\n
Alpha
b
" relative_image(content, output) end @@ -376,7 +376,7 @@ context "Markup" do test "code blocks" do content = "a\n\n```ruby\nx = 1\n```\n\nb" - output = "a
\n\n" +
+ output = "a
\n\n\n" +
"x = " +
"1\n\n\n\n\nb
"
@@ -391,7 +391,7 @@ context "Markup" do
test "code blocks with carriage returns" do
content = "a\r\n\r\n```ruby\r\nx = 1\r\n```\r\n\r\nb"
- output = "a
\n\n" +
+ output = "a
\n\n\n" +
"x = " +
"1\n\n\n\n\nb
"
diff --git a/test/test_wiki.rb b/test/test_wiki.rb
index fd37c56c..b7a61cba 100644
--- a/test/test_wiki.rb
+++ b/test/test_wiki.rb
@@ -11,13 +11,17 @@ context "Wiki" do
assert_equal Gollum::Markup, Gollum::Wiki.markup_class
end
- test "#markup_class= doesn't clobber alternate markups" do
+ test "#default_markup_class= doesn't clobber alternate markups" do
custom = Class.new(Gollum::Markup)
- Gollum::Wiki.markup_class = custom
+ custom_md = Class.new(Gollum::Markup)
- assert_equal custom, Gollum::Wiki.markup_class
+ Gollum::Wiki.markup_classes = Hash.new Gollum::Markup
+ Gollum::Wiki.markup_classes[:markdown] = custom_md
+ Gollum::Wiki.default_markup_class = custom
+
+ assert_equal custom, Gollum::Wiki.default_markup_class
assert_equal custom, Gollum::Wiki.markup_classes[:orgmode]
- assert_equal Gollum::MarkupGFM, Gollum::Wiki.markup_classes[:markdown]
+ assert_equal custom_md, Gollum::Wiki.markup_classes[:markdown]
end
test "repo path" do