lib/review/latexbuilder.rb in review-3.0.0 vs lib/review/latexbuilder.rb in review-3.1.0
- old
+ new
@@ -1,8 +1,8 @@
# Copyright (c) 2002-2007 Minero Aoki
# 2008-2009 Minero Aoki, Kenshi Muto
-# 2010-2018 Minero Aoki, Kenshi Muto, TAKAHASHI Masayoshi
+# 2010-2019 Minero Aoki, Kenshi Muto, TAKAHASHI Masayoshi
#
# This program is free software.
# You can distribute or modify this program under the terms of
# the GNU LGPL, Lesser General Public License version 2.1.
# For details of the GNU LGPL, see the file "COPYING".
@@ -475,11 +475,16 @@
puts "\\includegraphics[#{metrics}]{#{@chapter.image(id).path}}"
else
puts "\\includegraphics[width=\\maxwidth]{#{@chapter.image(id).path}}"
end
@doc_status[:caption] = true
- puts macro('caption', compile_inline(caption)) if caption.present?
+
+ if @book.config.check_version('2', exception: false)
+ puts macro('caption', compile_inline(caption)) if caption.present?
+ else
+ puts macro('reviewimagecaption', compile_inline(caption)) if caption.present?
+ end
@doc_status[:caption] = nil
puts macro('label', image_label(id))
puts '\end{reviewimage}'
end
@@ -491,11 +496,15 @@
lines.each do |line|
puts detab(line.rstrip)
end
puts macro('label', image_label(id))
@doc_status[:caption] = true
- puts macro('caption', compile_inline(caption)) if caption.present?
+ if @book.config.check_version('2', exception: false)
+ puts macro('caption', compile_inline(caption)) if caption.present?
+ else
+ puts macro('reviewimagecaption', compile_inline(caption)) if caption.present?
+ end
@doc_status[:caption] = nil
puts '\end{reviewdummyimage}'
end
def existence(id)
@@ -851,16 +860,16 @@
puts line
end
end
def comment(lines, comment = nil)
+ return true unless @book.config['draft']
lines ||= []
unless comment.blank?
- lines.unshift comment
+ lines.unshift escape(comment)
end
- return true unless @book.config['draft']
str = lines.join('\par ')
- puts macro('pdfcomment', escape(str))
+ puts macro('pdfcomment', str)
end
def hr
puts '\hrule'
end