258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
|
# File 'lib/review/pdfmaker.rb', line 258
def generate_pdf
remove_old_file
@path = build_path
begin
@compile_errors = nil
book = ReVIEW::Book::Base.new(@basedir, config: @config)
@converter = ReVIEW::Converter.new(book, ReVIEW::LATEXBuilder.new)
erb_config
@input_files = make_input_files(book)
check_compile_status(@config['ignore-errors'])
@config['usepackage'] = ''
@config['usepackage'] = "\\usepackage{#{@config['texstyle']}}" if @config['texstyle']
if @config['pdfmaker']['use_symlink']
logger.info 'use symlink'
end
copy_images(@config['imagedir'], File.join(@path, @config['imagedir']))
copy_sty(File.join(Dir.pwd, 'sty'), @path)
copy_sty(File.join(Dir.pwd, 'sty'), @path, 'fd')
copy_sty(File.join(Dir.pwd, 'sty'), @path, 'cls')
copy_sty(File.join(Dir.pwd, 'sty'), @path, 'erb')
copy_sty(File.join(Dir.pwd, 'sty'), @path, 'tex')
copy_sty(Dir.pwd, @path, 'tex')
build_pdf
FileUtils.cp(File.join(@path, "#{@mastertex}.pdf"), pdf_filepath)
@logger.success("built #{File.basename(pdf_filepath)}")
ensure
FileUtils.remove_entry_secure(@path) unless @config['debug']
end
end
|