Project

General

Profile

Defect #31695 » fix_for_links_without_href.patch

Marius BĂLTEANU, 2019-11-04 21:11

View differences:

lib/redmine/wiki_formatting/markdown/html_parser.rb
37 37
          'h6' => {:pre => "\n\n###### ", :post => "\n\n"},
38 38
          'th' => {:pre => '*', :post => "*\n"},
39 39
          'td' => {:pre => '', :post => "\n"},
40
          'a' => lambda {|node| node.content.present? ? %| [#{node.content}](#{node.attributes['href'].value}) | : %| #{node.attributes['href'].value} |}
40
          'a' => lambda do |node|
41
            if node.content.present? && node.attributes.key?('href')
42
              %| [#{node.content}](#{node.attributes['href'].value}) |
43
            elsif node.attributes.key?('href')
44
              %| #{node.attributes['href'].value} |
45
            else
46
              %| #{node.content} |
47
            end
48
          end
41 49
        )
42 50
      end
43 51
    end
lib/redmine/wiki_formatting/textile/html_parser.rb
37 37
          'h6' => {:pre => "\n\nh6. ", :post => "\n\n"},
38 38
          'th' => {:pre => '*', :post => "*\n"},
39 39
          'td' => {:pre => '', :post => "\n"},
40
          'a' => lambda {|node| node.content.present? ? %| "#{node.content}":#{node.attributes['href'].value} | : %| #{node.attributes['href'].value} |}
40
          'a' => lambda do |node|
41
            if node.content.present? && node.attributes.key?('href')
42
              %| "#{node.content}":#{node.attributes['href'].value} |
43
            elsif node.attributes.key?('href')
44
              %| #{node.attributes['href'].value} |
45
            else
46
              %| #{node.content} |
47
            end
48
          end
41 49
        )
42 50
      end
43 51
    end
(3-3/3)