diff --git a/app/logical/d_text.rb b/app/logical/d_text.rb index 67bfe6298..8f024028f 100644 --- a/app/logical/d_text.rb +++ b/app/logical/d_text.rb @@ -86,15 +86,22 @@ class DText def self.parse_list(str, options = {}) html = "" + current_item = "" layout = [] nest = 0 str.split(/\n/).each do |line| if line =~ /^\s*(\*+) (.+)/ + if nest > 0 + html += "
#{current_item}
" + end + nest = $1.size - content = parse_inline($2) + current_item = parse_inline($2) else - content = parse_inline(line) + current_item += parse_inline(line) end if nest > layout.size @@ -108,10 +115,10 @@ class DText html += "#{elist}>" end end - - html += "'
@@ -208,7 +215,7 @@ class DText
if stack.last == "expandable"
stack.pop
''
- end
+ end
else
if flags[:code]
diff --git a/test/unit/dtext_test.rb b/test/unit/dtext_test.rb
index aa6860e6b..a407f2335 100644
--- a/test/unit/dtext_test.rb
+++ b/test/unit/dtext_test.rb
@@ -100,7 +100,7 @@ class DTextTest < ActiveSupport::TestCase
def test_auto_urls_in_parentheses
assert_equal('a (http://test.com) b
', p('a (http://test.com) b'))
end
-
+
def test_old_syle_links
assert_equal('', p('"test":http://test.com'))
end
@@ -125,6 +125,14 @@ class DTextTest < ActiveSupport::TestCase
assert_equal('', p("* post #1").gsub(/\n/, ""))
end
+ def test_lists_not_preceded_by_newline
+ assert_equal('ab
a