Preserve orgmode-style double links.
This commit is contained in:
@@ -47,6 +47,8 @@ module Gollum
|
|||||||
data.gsub(/(.?)\[\[(.+?)\]\](.?)/m) do
|
data.gsub(/(.?)\[\[(.+?)\]\](.?)/m) do
|
||||||
if $1 == "'" && $3 != "'"
|
if $1 == "'" && $3 != "'"
|
||||||
"[[#{$2}]]#{$3}"
|
"[[#{$2}]]#{$3}"
|
||||||
|
elsif $2.include?('][')
|
||||||
|
$&
|
||||||
else
|
else
|
||||||
id = Digest::SHA1.hexdigest($2)
|
id = Digest::SHA1.hexdigest($2)
|
||||||
@tagmap[id] = $2
|
@tagmap[id] = $2
|
||||||
|
|||||||
+9
-3
@@ -194,10 +194,16 @@ context "Markup" do
|
|||||||
compare(content, output)
|
compare(content, output)
|
||||||
end
|
end
|
||||||
|
|
||||||
def compare(content, output)
|
test "org mode style double links" do
|
||||||
|
content = "a [[http://google.com][Google]] b"
|
||||||
|
output = "<p class=\"title\">a <a href=\"http://google.com\">Google</a> b</p>"
|
||||||
|
compare(content, output, 'org')
|
||||||
|
end
|
||||||
|
|
||||||
|
def compare(content, output, ext = "md")
|
||||||
index = @wiki.repo.index
|
index = @wiki.repo.index
|
||||||
index.add("Bilbo-Baggins.md", content)
|
index.add("Bilbo-Baggins.#{ext}", content)
|
||||||
index.commit("Add alpha.jpg")
|
index.commit("Add baggins")
|
||||||
|
|
||||||
page = @wiki.page("Bilbo Baggins")
|
page = @wiki.page("Bilbo Baggins")
|
||||||
rendered = Gollum::Markup.new(page).render
|
rendered = Gollum::Markup.new(page).render
|
||||||
|
|||||||
Reference in New Issue
Block a user