3 require_relative 'store'
9 @index_file = 'index.html'
10 @output_dir = 'output'
25 def index_file=(value)
33 return '<a href="' + data[0] + '">' + data[1] + '</a>'
36 def output_dir=(value)
52 def write_books(fd, book_ids)
54 book = @store.load_book(id)
58 #(path, mimeType) = book.cover.write_image(@output_dir, 'image' + @imageCount.to_s)
59 #image = '<img class="cover-thumb" src="' + path + '"/>'
60 path = book.cover.path
61 image = '<img class="cover-thumb" src="' + path + '"/>'
63 image = '(No cover image)'
66 fd.puts ' <div><table>'
67 fd.puts ' <tr><td><a href="' + book.path + '">' + image + '</a></td>'
69 heading = book.heading()
70 description = book.description()
72 fd.puts ' <td><span class="popup">' + heading + '<span class="pop-inner"><p>' + heading + '</p><p>' + description + '</p></span></span></td></tr>'
74 fd.puts ' <td>' + heading + '</td></tr>'
77 fd.puts ' </table></div>'
82 fd.puts ' <p class="navigator">' + navig_link(@back) + ' ' + navig_link(@up) + ' ' + navig_link(@forward) + '</p>'
86 fd.puts ' <h1 class="header">' + @title + '</h1>'
88 fd.puts ' <p class="navigator">' + navig_link(@back) + ' ' + navig_link(@up) + ' ' + navig_link(@forward) + '</p>'
91 def write_html(book_ids)
94 if ! Dir.exist?(@output_dir)
95 FileUtils.mkdir_p(@output_dir)
98 open(@output_dir + '/' + @index_file, 'w') do |fd|
101 fd.puts ' <meta charset="utf-8"/>'
102 fd.puts ' <title>' + @title + '</title>'
104 write_style_sheet(fd)
112 write_books(fd, book_ids)
121 def write_special(fd)
127 def write_style_sheet(fd)
132 display: inline-block;
135 border 3px solid #73ad21;
142 img.cover-thumb { max-height: 200px; max-width: 200px; }
145 span.popup:hover { text-decoration: none; background: #cfffff; z-index: 6; }
146 span.popup span.pop-inner {
152 padding: 3px 3px 3px 3px;
155 span.popup:hover span.pop-inner {
158 margin: 20px 0 0 0px;