From 39deb038557f1cfaf139892d184e17257f0bdbbe Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Wed, 18 Apr 2012 17:41:28 +0000 Subject: [PATCH] Merged r9430 from trunk. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@9434 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- lib/redcloth3.rb | 2 +- .../wiki_formatting/textile_formatter_test.rb | 30 +++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/lib/redcloth3.rb b/lib/redcloth3.rb index f6333b3fe..c91c61718 100644 --- a/lib/redcloth3.rb +++ b/lib/redcloth3.rb @@ -585,7 +585,7 @@ class RedCloth3 < String last_line = line_id end if line_id - last_line > 1 or line_id == lines.length - 1 - depth.delete_if do |v| + while v = depth.pop lines[last_line] << "\n\t" end end diff --git a/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb b/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb index 4253b7152..548a378b5 100644 --- a/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb +++ b/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb @@ -110,6 +110,36 @@ class Redmine::WikiFormatting::TextileFormatterTest < ActionView::TestCase ) end + def test_nested_lists + raw = <<-RAW +# Item 1 +# Item 2 +** Item 2a +** Item 2b +# Item 3 +** Item 3a +RAW + + expected = <<-EXPECTED +
    +
  1. Item 1
  2. +
  3. Item 2 +
      +
    • Item 2a
    • +
    • Item 2b
    • +
    +
  4. +
  5. Item 3 +
      +
    • Item 3a
    • +
    +
  6. +
+EXPECTED + + assert_equal expected.gsub(%r{\s+}, ''), to_html(raw).gsub(%r{\s+}, '') + end + def test_escaping assert_html_output( 'this is a