Skip to content

Commit

Permalink
Merge pull request #1321 from kmuto/fix-adhoc-1312
Browse files Browse the repository at this point in the history
ul/ol/dl/bibpaperで改行を保持する
  • Loading branch information
kmuto authored Jun 9, 2019
2 parents 122ccdd + 8a511b1 commit 3328886
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
8 changes: 4 additions & 4 deletions lib/review/latexbuilder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ def ul_begin
end

def ul_item(lines)
str = lines.join
str = lines.join("\n")
str.sub!(/\A(\[)/) { '\lbrack{}' }
puts '\item ' + str
end
Expand All @@ -276,7 +276,7 @@ def ol_begin
end

def ol_item(lines, _num)
str = lines.join
str = lines.join("\n")
str.sub!(/\A(\[)/) { '\lbrack{}' }
puts '\item ' + str
end
Expand All @@ -298,7 +298,7 @@ def dt(str)
end

def dd(lines)
puts lines.join
puts lines.join("\n")
end

def dl_end
Expand Down Expand Up @@ -1215,7 +1215,7 @@ def bibpaper_header(id, caption)
end

def bibpaper_bibpaper(_id, _caption, lines)
print split_paragraph(lines).join
print split_paragraph(lines).join("\n")
puts ''
end

Expand Down
10 changes: 6 additions & 4 deletions test/test_latexbuilder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -280,12 +280,12 @@ def test_jis_x_0201_kana

def test_dlist
actual = compile_block(": foo\n foo.\n bar.\n")
assert_equal %Q(\n\\begin{description}\n\\item[foo] \\mbox{} \\\\\nfoo.bar.\n\\end{description}\n), actual
assert_equal %Q(\n\\begin{description}\n\\item[foo] \\mbox{} \\\\\nfoo.\nbar.\n\\end{description}\n), actual
end

def test_dlist_with_bracket
actual = compile_block(": foo[bar]\n foo.\n bar.\n")
assert_equal %Q(\n\\begin{description}\n\\item[foo\\lbrack{}bar\\rbrack{}] \\mbox{} \\\\\nfoo.bar.\n\\end{description}\n), actual
assert_equal %Q(\n\\begin{description}\n\\item[foo\\lbrack{}bar\\rbrack{}] \\mbox{} \\\\\nfoo.\nbar.\n\\end{description}\n), actual
end

def test_dlist_beforeulol
Expand Down Expand Up @@ -783,8 +783,10 @@ def test_cont
expected = <<-EOS
\\begin{itemize}
\\item AAA{-}AA
\\item BBB{-}BB
\\item AAA
{-}AA
\\item BBB
{-}BB
\\end{itemize}
EOS
actual = compile_block(src)
Expand Down
10 changes: 6 additions & 4 deletions test/test_latexbuilder_v2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,12 @@ def test_jis_x_0201_kana

def test_dlist
actual = compile_block(": foo\n foo.\n bar.\n")
assert_equal %Q(\n\\begin{description}\n\\item[foo] \\mbox{} \\\\\nfoo.bar.\n\\end{description}\n), actual
assert_equal %Q(\n\\begin{description}\n\\item[foo] \\mbox{} \\\\\nfoo.\nbar.\n\\end{description}\n), actual
end

def test_dlist_with_bracket
actual = compile_block(": foo[bar]\n foo.\n bar.\n")
assert_equal %Q(\n\\begin{description}\n\\item[foo\\lbrack{}bar\\rbrack{}] \\mbox{} \\\\\nfoo.bar.\n\\end{description}\n), actual
assert_equal %Q(\n\\begin{description}\n\\item[foo\\lbrack{}bar\\rbrack{}] \\mbox{} \\\\\nfoo.\nbar.\n\\end{description}\n), actual
end

def test_dlist_beforeulol
Expand Down Expand Up @@ -739,8 +739,10 @@ def test_cont
expected = <<-EOS
\\begin{itemize}
\\item AAA{-}AA
\\item BBB{-}BB
\\item AAA
{-}AA
\\item BBB
{-}BB
\\end{itemize}
EOS
actual = compile_block(src)
Expand Down

0 comments on commit 3328886

Please sign in to comment.