From 35abb9cb02d9da1ee7f7bcbb1e2cb2aad51db19b Mon Sep 17 00:00:00 2001 From: Kenshi Muto Date: Wed, 18 Jul 2018 21:40:50 +0900 Subject: [PATCH] use likely internal file name __REVIEW_BOOK__ for master tex file instead of book.tex. Closes #1080 --- lib/review/pdfmaker.rb | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/review/pdfmaker.rb b/lib/review/pdfmaker.rb index f32689897..894670a0a 100644 --- a/lib/review/pdfmaker.rb +++ b/lib/review/pdfmaker.rb @@ -34,6 +34,7 @@ def initialize @basehookdir = nil @logger = ReVIEW.logger @input_files = Hash.new { |h, key| h[key] = '' } + @mastertex = '__REVIEW_BOOK__' end def system_with_info(*args) @@ -178,7 +179,7 @@ def make_input_files(book, yamlfile) def build_pdf template = template_content Dir.chdir(@path) do - File.open('./book.tex', 'wb') { |f| f.write(template) } + File.open("./#{@mastertex}.tex", 'wb') { |f| f.write(template) } call_hook('hook_beforetexcompile') @@ -214,20 +215,20 @@ def build_pdf end 2.times do - system_or_raise("#{texcommand} #{texoptions} book.tex") + system_or_raise("#{texcommand} #{texoptions} #{@mastertex}.tex") end call_hook('hook_beforemakeindex') - if @config['pdfmaker']['makeindex'] && File.exist?('book.idx') - system_or_raise("#{makeindex_command} #{makeindex_options} book") + if @config['pdfmaker']['makeindex'] && File.exist?("#{@mastertex}.idx") + system_or_raise("#{makeindex_command} #{makeindex_options} #{@mastertex}") end call_hook('hook_aftermakeindex') - system_or_raise("#{texcommand} #{texoptions} book.tex") + system_or_raise("#{texcommand} #{texoptions} #{@mastertex}") call_hook('hook_aftertexcompile') - if File.exist?('book.dvi') - system_or_raise("#{dvicommand} #{dvioptions} book.dvi") + if File.exist?("#{@mastertex}.dvi") + system_or_raise("#{dvicommand} #{dvioptions} #{@mastertex}.dvi") call_hook('hook_afterdvipdf') end end @@ -262,7 +263,7 @@ def generate_pdf(yamlfile) build_pdf - FileUtils.cp(File.join(@path, 'book.pdf'), pdf_filepath) + FileUtils.cp(File.join(@path, "#{@mastertex}.pdf"), pdf_filepath) ensure remove_entry_secure @path unless @config['debug'] end