diff --git a/lib/review/compiler.rb b/lib/review/compiler.rb index 9cfcc2246..03c663598 100644 --- a/lib/review/compiler.rb +++ b/lib/review/compiler.rb @@ -416,7 +416,7 @@ def compile_dlist(f) @strategy.dl_begin while /\A\s*:/ =~ f.peek @strategy.dt text(f.gets.sub(/\A\s*:/, '').strip) - @strategy.dd(f.break(/\A(\S|\s*:)/).map {|line| text(line.strip) }) + @strategy.dd(f.break(/\A(\S|\s*:|\s+\d+\.\s|\s+\*\s)/).map {|line| text(line.strip) }) f.skip_blank_lines f.skip_comment_lines end diff --git a/test/test_htmlbuilder.rb b/test/test_htmlbuilder.rb index 5a980c475..0c4183f32 100644 --- a/test/test_htmlbuilder.rb +++ b/test/test_htmlbuilder.rb @@ -565,6 +565,11 @@ def test_dlist_with_comment assert_equal %Q|
\n
title
\n
body
\n
title2
\n
body2
\n
\n|, actual end + def test_dlist_beforeulol + actual = compile_block(" : foo\n foo.\n\npara\n\n : foo\n foo.\n\n 1. bar\n\n : foo\n foo.\n\n * bar\n") + assert_equal %Q|
\n
foo
\n
foo.
\n
\n

para

\n
\n
foo
\n
foo.
\n
\n
    \n
  1. bar
  2. \n
\n
\n
foo
\n
foo.
\n
\n\n|, actual + end + def test_list def @chapter.list(id) Book::ListIndex::Item.new("samplelist",1) diff --git a/test/test_idgxmlbuilder.rb b/test/test_idgxmlbuilder.rb index 4e356a384..3d32f9ce5 100644 --- a/test/test_idgxmlbuilder.rb +++ b/test/test_idgxmlbuilder.rb @@ -188,6 +188,11 @@ def test_inline_m assert_equal %Q|
\\sin
\\frac{1}{2}
|, actual end + def test_dlist_beforeulol + actual = compile_block(" : foo\n foo.\n\npara\n\n : foo\n foo.\n\n 1. bar\n\n : foo\n foo.\n\n * bar\n") + assert_equal %Q|
foo
foo.

para

foo
foo.
  1. bar
foo
foo.
|, actual + end + def test_paragraph actual = compile_block("foo\nbar\n") assert_equal %Q|

foobar

|, actual diff --git a/test/test_latexbuilder.rb b/test/test_latexbuilder.rb index 410691677..4173334bf 100644 --- a/test/test_latexbuilder.rb +++ b/test/test_latexbuilder.rb @@ -252,6 +252,11 @@ def test_dlist_with_bracket assert_equal %Q|\n\\begin{description}\n\\item[foo\\lbrack{}bar\\rbrack{}] \\mbox{} \\\\\nfoo.bar.\n\\end{description}\n|, actual end + def test_dlist_beforeulol + actual = compile_block(" : foo\n foo.\n\npara\n\n : foo\n foo.\n\n 1. bar\n\n : foo\n foo.\n\n * bar\n") + assert_equal %Q|\n\\begin{description}\n\\item[foo] \\mbox{} \\\\\nfoo.\n\\end{description}\n\npara\n\n\\begin{description}\n\\item[foo] \\mbox{} \\\\\nfoo.\n\\end{description}\n\n\\begin{enumerate}\n\\item bar\n\\end{enumerate}\n\n\\begin{description}\n\\item[foo] \\mbox{} \\\\\nfoo.\n\\end{description}\n\n\\begin{itemize}\n\\item bar\n\\end{itemize}\n|, actual + end + def test_cmd actual = compile_block("//cmd{\nfoo\nbar\n\nbuz\n//}\n") assert_equal %Q|\n\\begin{reviewcmd}\nfoo\nbar\n\nbuz\n\\end{reviewcmd}\n|, actual diff --git a/test/test_topbuilder.rb b/test/test_topbuilder.rb index b9ff7f11f..4488801e3 100644 --- a/test/test_topbuilder.rb +++ b/test/test_topbuilder.rb @@ -150,6 +150,11 @@ def test_inline_in_table assert_equal %Q|◆→開始:表←◆\n★★1☆☆\t★▲2☆☆\n★3☆\t▲4☆<>&\n◆→終了:表←◆\n\n|, actual end + def test_dlist_beforeulol + actual = compile_block(" : foo\n foo.\n\npara\n\n : foo\n foo.\n\n 1. bar\n\n : foo\n foo.\n\n * bar\n") + assert_equal %Q|★foo☆\n\tfoo.\n\t\n\npara\n\n★foo☆\n\tfoo.\n\t\n\n1\tbar\n\n★foo☆\n\tfoo.\n\t\n\n●\tbar\n\n|, actual + end + def test_paragraph actual = compile_block("foo\nbar\n") assert_equal %Q|foobar\n|, actual