diff --git a/lib/gollum/frontend/public/css/global.css b/lib/gollum/frontend/public/css/global.css index f9e98c50..9a4b256a 100644 --- a/lib/gollum/frontend/public/css/global.css +++ b/lib/gollum/frontend/public/css/global.css @@ -40,7 +40,11 @@ p { color: #666; } -/***********************/ +a.absent { + color: #a00; +} + +/* Images */ .frame { margin: 1em 0; diff --git a/lib/gollum/markup.rb b/lib/gollum/markup.rb index d1a7010b..316c3112 100644 --- a/lib/gollum/markup.rb +++ b/lib/gollum/markup.rb @@ -41,7 +41,7 @@ module Gollum # # Returns the placeholder'd String data. def extract_tags(data) - data.gsub(/\[\[(.+?)\]\]/) do + data.gsub(/\[\[(.+?)\]\]/m) do id = Digest::SHA1.hexdigest($1) @tagmap[id] = $1 id @@ -192,7 +192,11 @@ module Gollum parts = tag.split('|') name = parts[0].strip cname = Page.cname((parts[1] || parts[0]).strip) - %{#{name}} + if @wiki.page(cname) + %{#{name}} + else + %{#{name}} + end end # Find the given file in the repo. diff --git a/test/test_markup.rb b/test/test_markup.rb index 1f0d595c..c0ea7323 100644 --- a/test/test_markup.rb +++ b/test/test_markup.rb @@ -21,7 +21,15 @@ context "Markup" do page = @wiki.page("Bilbo Baggins") output = Gollum::Markup.new(page).render - assert_equal %{

a Bilbo Baggins b

\n}, output + assert_equal %{

a Bilbo Baggins b

\n}, output + end + + test "absent page link" do + @wiki.write_page("Tolkien", :markdown, "a [[J. R. R. Tolkien]]'s b", @commit) + + page = @wiki.page("Tolkien") + output = Gollum::Markup.new(page).render + assert_equal %{

a J. R. R. Tolkien's b

\n}, output end test "image with absolute path" do