This commit is contained in:
parent
5cb0aee251
commit
ae01b1d5df
|
|
@ -47,7 +47,7 @@ module Jekyll
|
||||||
def generate_url
|
def generate_url
|
||||||
@placeholders.inject(@template) do |result, token|
|
@placeholders.inject(@template) do |result, token|
|
||||||
break result if result.index(':').nil?
|
break result if result.index(':').nil?
|
||||||
result.gsub(':#{token.first}', self.class.escape_path(token.last))
|
result.gsub(/:#{token.first}/, self.class.escape_path(token.last))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,13 @@ class TestURL < Test::Unit::TestCase
|
||||||
).to_s
|
).to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
|
should "handle multiple of the same key in the template" do
|
||||||
|
assert_equal '/foo/bar/foo/', URL.new(
|
||||||
|
:template => "/:x/:y/:x/",
|
||||||
|
:placeholders => {:x => "foo", :y => "bar"}
|
||||||
|
).to_s
|
||||||
|
end
|
||||||
|
|
||||||
should "return permalink if given" do
|
should "return permalink if given" do
|
||||||
assert_equal "/le/perma/link", URL.new(
|
assert_equal "/le/perma/link", URL.new(
|
||||||
:template => "/:x/:y",
|
:template => "/:x/:y",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue