348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
|
# File 'lib/review/epubmaker.rb', line 348
def build_chap(chap, base_path, basetmpdir, ispart)
chaptype = 'body'
if ispart
chaptype = 'part'
elsif chap.on_predef?
chaptype = 'pre'
elsif chap.on_appendix?
chaptype = 'appendix'
elsif chap.on_postdef?
chaptype = 'post'
end
filename =
if ispart.present?
chap.path
else
Pathname.new(chap.path).relative_path_from(base_path).to_s
end
id = File.basename(filename).sub(/\.re\Z/, '')
if @config['epubmaker']['rename_for_legacy'] && ispart.nil?
if chap.on_predef?
@precount += 1
id = sprintf('pre%02d', @precount)
elsif chap.on_appendix?
@postcount += 1
id = sprintf('post%02d', @postcount)
else
@bodycount += 1
id = sprintf('chap%02d', @bodycount)
end
end
if @buildonly && !@buildonly.include?(id)
warn "skip #{id}.re"
return
end
htmlfile = "#{id}.#{@config['htmlext']}"
write_buildlogtxt(basetmpdir, htmlfile, filename)
debug("Create #{htmlfile} from #{filename}.")
if @config['params'].present?
warn %Q('params:' in config.yml is obsoleted.)
if /stylesheet=/.match?(@config['params'])
warn %Q(stylesheets should be defined in 'stylesheet:', not in 'params:')
end
end
begin
@converter.convert(filename, File.join(basetmpdir, htmlfile))
write_info_body(basetmpdir, id, htmlfile, ispart, chaptype)
remove_hidden_title(basetmpdir, htmlfile)
rescue StandardError => e
@compile_errors = true
error "compile error in #{filename} (#{e.class})"
error e.message
end
end
|