Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

layout.tex.erbからの生成時、book.texの代わりに内部名っぽいファイルを使う #1081

Merged
merged 1 commit into from
Jul 19, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions lib/review/pdfmaker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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')

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down