add backwards compatible Gollum::Wiki.markup_class
This commit is contained in:
@@ -66,6 +66,16 @@ module Gollum
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def markup_class
|
||||||
|
markup_classes[:default]
|
||||||
|
end
|
||||||
|
|
||||||
|
def markup_class=(default)
|
||||||
|
new_classes = Hash.new default
|
||||||
|
@markup_classes = Hash.new(default).update(markup_classes)
|
||||||
|
default
|
||||||
|
end
|
||||||
|
|
||||||
# Gets the default sanitization options for current pages used by
|
# Gets the default sanitization options for current pages used by
|
||||||
# instances of this Wiki.
|
# instances of this Wiki.
|
||||||
def sanitization
|
def sanitization
|
||||||
|
|||||||
@@ -4,6 +4,20 @@ require File.expand_path(File.join(File.dirname(__FILE__), "helper"))
|
|||||||
context "Wiki" do
|
context "Wiki" do
|
||||||
setup do
|
setup do
|
||||||
@wiki = Gollum::Wiki.new(testpath("examples/lotr.git"))
|
@wiki = Gollum::Wiki.new(testpath("examples/lotr.git"))
|
||||||
|
Gollum::Wiki.markup_classes = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
test "#markup_class gets default markup" do
|
||||||
|
assert_equal Gollum::Markup, Gollum::Wiki.markup_class
|
||||||
|
end
|
||||||
|
|
||||||
|
test "#markup_class= doesn't clobber alternate markups" do
|
||||||
|
custom = Class.new(Gollum::Markup)
|
||||||
|
Gollum::Wiki.markup_class = custom
|
||||||
|
|
||||||
|
assert_equal custom, Gollum::Wiki.markup_class
|
||||||
|
assert_equal custom, Gollum::Wiki.markup_classes[:orgmode]
|
||||||
|
assert_equal Gollum::MarkupGFM, Gollum::Wiki.markup_classes[:markdown]
|
||||||
end
|
end
|
||||||
|
|
||||||
test "repo path" do
|
test "repo path" do
|
||||||
|
|||||||
Reference in New Issue
Block a user