]> source.dussan.org Git - redmine.git/commitdiff
Merged r19536 and r19542 from trunk to 4.1-stable (#32971).
authorGo MAEDA <maeda@farend.jp>
Sat, 29 Feb 2020 14:35:50 +0000 (14:35 +0000)
committerGo MAEDA <maeda@farend.jp>
Sat, 29 Feb 2020 14:35:50 +0000 (14:35 +0000)
git-svn-id: http://svn.redmine.org/redmine/branches/4.1-stable@19545 e93f8b46-1217-0410-a6f0-8f06a7374b81

lib/redmine/wiki_formatting/textile/redcloth3.rb
test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb

index d33aede8d247f39dee14b2b299318c3cd9b09ce6..54725d2bfc660d0b4530a4f7f27f9ac6462d3398 100644 (file)
@@ -1020,11 +1020,12 @@ class RedCloth3 < String
     end
 
     def flush_left( text )
-        indt = 0
-        if text =~ /^ /
-            unless text.empty?
-                indt += 1 while text !~ /^ {#{indt}}[^ ]/
-            end
+        if /(?![\r\n\t ])[[:cntrl:]]/.match?(text)
+            text.gsub!(/(?![\r\n\t ])[[:cntrl:]]/, '')
+        end
+        if /^ +\S/.match?(text)
+            indt = 0
+            indt += 1 until /^ {#{indt}}\S/.match?(text)
             if indt.nonzero?
                 text.gsub!( /^ {#{indt}}/, '' )
             end
index 1fb0dd32e60b4dd25b5c69d4d046699dc2046383..83ece595494241eec07643700b3e030a11c5df25 100644 (file)
@@ -161,6 +161,24 @@ RAW
 EXPECTED
 
     assert_equal expected.gsub(%r{\s+}, ''), to_html(raw).gsub(%r{\s+}, '')
+
+    raw = <<~RAW
+      * Item-1
+
+        * Item-1a
+        * Item-1b
+    RAW
+    expected = <<~EXPECTED
+      <ul>
+        <li>Item-1
+          <ul>
+            <li>Item-1a</li>
+            <li>Item-1b</li>
+          </ul>
+        </li>
+      </ul>
+    EXPECTED
+    assert_equal expected.gsub(%r{\s+}, ''), to_html(raw).gsub(%r{\s+}, '')
   end
 
   def test_escaping