Skip to content

Commit

Permalink
Merge pull request #1527 from kmuto/indepimage_noimage
Browse files Browse the repository at this point in the history
escape indepimage warning string
  • Loading branch information
kmuto authored Aug 5, 2020
2 parents ccdf3f3 + be303a1 commit a80fb4c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/review/latexbuilder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ def indepimage(lines, id, caption = nil, metric = nil)
else
warn "image not bound: #{id}"
puts '\begin{reviewdummyimage}'
puts "--[[path = #{id} (#{existence(id)})]]--"
puts "--[[path = #{escape(id)} (#{existence(id)})]]--"
lines.each do |line|
puts detab(line.rstrip)
end
Expand Down
21 changes: 21 additions & 0 deletions test/test_latexbuilder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1270,6 +1270,27 @@ def @chapter.image(_id)
assert_equal expected, actual
end

def test_indepimage_nofile
def @chapter.image(_id)
item = Book::Index::Item.new('sample_img#&', 1)
item.instance_eval do
def path
nil
end
end
item
end

actual = compile_block("//indepimage[sample_img#&][sample photo]\n")
expected = <<-EOS
\\begin{reviewdummyimage}
--[[path = sample\\textunderscore{}img\\#\\& (not exist)]]--
\\reviewindepimagecaption{図: sample photo}
\\end{reviewdummyimage}
EOS
assert_equal expected, actual
end

def test_table
actual = compile_block("//table{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n")
expected = <<-EOS
Expand Down

0 comments on commit a80fb4c

Please sign in to comment.