add-single-quoted-2.patch

Mizuki ISHIKAWA, 2018-04-24 06:50

Download (1.54 KB)

View differences:

lib/redmine/wiki_formatting/textile/formatter.rb
120 120
            ## replace <pre> content
121 121
            text.gsub!(/<redpre#(\d+)>/) do
122 122
              content = @pre_list[$1.to_i]
123
              if content.match(/<code\s+class="(\w+)">\s?(.+)/m)
123
              if content.match(/<code\s+class=["'](\w+)["']>\s?(.+)/m)
124 124
                language = $1
125 125
                text = $2
126 126
                if Redmine::SyntaxHighlighting.language_supported?(language)
test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb
546 546
  end
547 547

  
548 548
  def test_should_allow_valid_language_class_attribute_on_code_tags
549
    # language name is double-quoted
549 550
    assert_html_output({"<code class=\"ruby\">test</code>" => "<code class=\"ruby syntaxhl\"><span class=\"CodeRay\">test</span></code>"}, false)
551
    # language name is single-quoted
552
    assert_html_output({"<code class='ruby'>test</code>" => "<code class=\"ruby syntaxhl\"><span class=\"CodeRay\">test</span></code>"}, false)
550 553
  end
551 554

  
552 555
  def test_should_not_allow_valid_language_class_attribute_on_non_code_offtags