X-Git-Url: http://jaekl.net/gitweb/?p=quanlib.git;a=blobdiff_plain;f=page.rb;h=a94c90f08109d99f95feed709c8a14d0494a6b40;hp=2e5d73524c3fd9d0689b29576b93ab6560bd19b9;hb=HEAD;hpb=b31122c5ed23e2e77b527c0979b6355e9e3dda1f diff --git a/page.rb b/page.rb index 2e5d735..638f9ad 100644 --- a/page.rb +++ b/page.rb @@ -1,10 +1,12 @@ -require 'store' +require 'fileutils' +require_relative 'store' class Page def initialize(store) @back = nil @forward = nil + @index_file = 'index.html' @output_dir = 'output' @special = nil @store = store @@ -20,6 +22,10 @@ class Page @forward = value end + def index_file=(value) + @index_file = value + end + def navig_link(data) if (nil == data) return '' @@ -48,8 +54,10 @@ class Page book = @store.load_book(id) image = nil if nil != book.cover - @imageCount += 1 - (path, mimeType) = book.cover.write_image(@output_dir, 'image' + @imageCount.to_s) + #@imageCount += 1 + #(path, mimeType) = book.cover.write_image(@output_dir, 'image' + @imageCount.to_s) + #image = '' + path = book.cover.path image = '' else image = '(No cover image)' @@ -84,10 +92,10 @@ class Page @imageCount = 0 if ! Dir.exist?(@output_dir) - Dir.mkdir(@output_dir) + FileUtils.mkdir_p(@output_dir) end - open(@output_dir + '/index.html', 'w') do |fd| + open(@output_dir + '/' + @index_file, 'w') do |fd| fd.puts '' fd.puts ' ' fd.puts ' '