diff --git a/lib/gollum/markup.rb b/lib/gollum/markup.rb index 5de24de6..0067d367 100644 --- a/lib/gollum/markup.rb +++ b/lib/gollum/markup.rb @@ -121,7 +121,18 @@ module Gollum if $1 == "'" && $3 != "'" "[[#{$2}]]#{$3}" elsif $2.include?('][') - $& + if $2[0..4] == 'file:' + pre = $1 + post = $3 + parts = $2.split('][') + parts[0][0..4] = "" + link = "#{parts[1]}|#{parts[0].sub(/\.org/,'')}" + id = Digest::SHA1.hexdigest(link) + @tagmap[id] = link + "#{pre}#{id}#{post}" + else + $& + end else id = Digest::SHA1.hexdigest($2) @tagmap[id] = $2 diff --git a/test/test_markup.rb b/test/test_markup.rb index e63d7e57..9c52f4ac 100644 --- a/test/test_markup.rb +++ b/test/test_markup.rb @@ -440,6 +440,12 @@ context "Markup" do compare(content, output, 'org') end + test "org mode style double file links" do + content = "a [[file:f.org][Google]] b" + output = "

a Google b

" + compare(content, output, 'org') + end + ######################################################################### # # TeX