diff --git a/lib/redmine/wiki_formatting/markdown/html_parser.rb b/lib/redmine/wiki_formatting/markdown/html_parser.rb index ff25a0bd2..b9873ba50 100644 --- a/lib/redmine/wiki_formatting/markdown/html_parser.rb +++ b/lib/redmine/wiki_formatting/markdown/html_parser.rb @@ -37,7 +37,15 @@ module Redmine 'h6' => {:pre => "\n\n###### ", :post => "\n\n"}, 'th' => {:pre => '*', :post => "*\n"}, 'td' => {:pre => '', :post => "\n"}, - 'a' => lambda {|node| node.content.present? ? %| [#{node.content}](#{node.attributes['href'].value}) | : %| #{node.attributes['href'].value} |} + 'a' => lambda do |node| + if node.content.present? && node.attributes.key?('href') + %| [#{node.content}](#{node.attributes['href'].value}) | + elsif node.attributes.key?('href') + %| #{node.attributes['href'].value} | + else + %| #{node.content} | + end + end ) end end diff --git a/lib/redmine/wiki_formatting/textile/html_parser.rb b/lib/redmine/wiki_formatting/textile/html_parser.rb index 8623c2068..3f0977bef 100644 --- a/lib/redmine/wiki_formatting/textile/html_parser.rb +++ b/lib/redmine/wiki_formatting/textile/html_parser.rb @@ -37,7 +37,15 @@ module Redmine 'h6' => {:pre => "\n\nh6. ", :post => "\n\n"}, 'th' => {:pre => '*', :post => "*\n"}, 'td' => {:pre => '', :post => "\n"}, - 'a' => lambda {|node| node.content.present? ? %| "#{node.content}":#{node.attributes['href'].value} | : %| #{node.attributes['href'].value} |} + 'a' => lambda do |node| + if node.content.present? && node.attributes.key?('href') + %| "#{node.content}":#{node.attributes['href'].value} | + elsif node.attributes.key?('href') + %| #{node.attributes['href'].value} | + else + %| #{node.content} | + end + end ) end end