Method: ReVIEW::EPUBMaker#build_body

Defined in:
lib/review/epubmaker.rb

#build_body(basetmpdir, yamlfile) ⇒ Object



222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
# File 'lib/review/epubmaker.rb', line 222

def build_body(basetmpdir, yamlfile)
  @precount = 0
  @bodycount = 0
  @postcount = 0

  @manifeststr = ""
  @ncxstr = ""
  @tocdesc = Array.new

  basedir = File.dirname(yamlfile)
  base_path = Pathname.new(basedir)
  book = ReVIEW::Book.load(basedir)
  book.config = @params
  @converter = ReVIEW::Converter.new(book, ReVIEW::HTMLBuilder.new)
  @compile_errors = nil
  book.parts.each do |part|
    htmlfile = nil
    if part.name.present?
      if part.file?
        build_chap(part, base_path, basetmpdir, true)
      else
        htmlfile = "part_#{part.number}.#{@params["htmlext"]}"
        build_part(part, basetmpdir, htmlfile)
        title = ReVIEW::I18n.t("part", part.number)
        title += ReVIEW::I18n.t("chapter_postfix") + part.name.strip if part.name.strip.present?
        @htmltoc.add_item(0, htmlfile, title, {:chaptype => "part"})
        write_buildlogtxt(basetmpdir, htmlfile, "")
      end
    end

    part.chapters.each do |chap|
      build_chap(chap, base_path, basetmpdir, false)
    end

  end
  check_compile_status()
end