32971-fixed-v4.patch

Yuichi HARADA, 2020-02-20 08:58

Download (1.69 KB)

View differences:

lib/redmine/wiki_formatting/textile/redcloth3.rb
1020 1020
    end
1021 1021

  
1022 1022
    def flush_left( text )
1023
        indt = 0
1024
        if text =~ /^ /
1025
            unless text.empty?
1026
                indt += 1 while text !~ /^ {#{indt}}[^ ]/
1027
            end
1023
        if /(?![\r\n\t ])[[:cntrl:]]/.match?(text)
1024
            text.gsub!(/(?![\r\n\t ])[[:cntrl:]]/, '')
1025
        end
1026
        if /^ +\S/.match?(text)
1027
            indt = 0
1028
            indt += 1 while !/^ {#{indt}}\S/.match?(text)
1028 1029
            if indt.nonzero?
1029 1030
                text.gsub!( /^ {#{indt}}/, '' )
1030 1031
            end
test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb
171 171
      </ol>
172 172
    EXPECTED
173 173
    assert_equal expected.gsub(%r{\s+}, ''), to_html(raw).gsub(%r{\s+}, '')
174

  
175
    raw = <<~RAW
176
      * Item-1
177

  
178
        * Item-1a
179
        * Item-1b
180
    RAW
181
    expected = <<~EXPECTED
182
      <ul>
183
        <li>Item-1
184
          <ul>
185
            <li>Item-1a</li>
186
            <li>Item-1b</li>
187
          </ul>
188
        </li>
189
      </ul>
190
    EXPECTED
191
    assert_equal expected.gsub(%r{\s+}, ''), to_html(raw).gsub(%r{\s+}, '')
174 192
  end
175 193

  
176 194
  def test_escaping