12 ('A'..'Z').each do |letter|
13 atoz_counts[letter] = write_authors_starting_with(letter)
16 content = '<p><table><tr><th>Author</th><th>Books</th></tr>'
17 ('A'..'Z').each do |letter|
18 content += ' <tr><td><a href="../atoz/output_' + letter + '.html">Starting with ' + letter + '</a></td><td>' + atoz_counts[letter].to_s + '</td></tr>'
20 content += '</table></p>'
21 page = Page.new(@store)
22 page.output_dir = 'atoz'
23 page.special = content
24 page.up = ['../output/index.html', 'Up']
29 def write_authors_starting_with(letter)
30 book_ids = @store.query_books_by_author(letter + '%')
31 puts 'Authors starting with "' + letter + '": ' + book_ids.length.to_s() + ' books.'
33 page = Page.new(@store)
35 page.back = ['../atoz/output_' + (letter.ord - 1).chr + '.html', 'Prev']
38 page.forward = ['../atoz/output_' + (letter.ord + 1).chr + '.html', 'Next']
40 page.output_dir = 'atoz'
41 page.index_file = 'output_' + letter + '.html'
42 page.title = "Authors starting with '" + letter + "'"
43 page.up = ['../atoz/index.html', 'Up']
45 page.write_html(book_ids)
46 return book_ids.length
50 book_ids = @store.query_books_by_ddc()
51 puts 'Non-fiction books arranged by Dewey Decimal Classification: ' + book_ids.length.to_s() + ' books.'
53 page = Page.new(@store)
54 page.output_dir = 'ddc'
55 page.index_file = 'index.html'
56 page.title = "Non-fiction books arranged by Dewey Decimal call number"
57 page.up = ['../output/index.html', 'Up']
59 page.write_html(book_ids)
60 return book_ids.length
63 def write_series_for_age(age)
66 series_ids = @store.query_series_by_age(age)
68 series_ids.each do |id|
69 series = @store.load_series(id)
70 book_ids = @store.query_books_by_series_id(id)
71 if nil != book_ids and book_ids.length > 0
72 series_infos.push( [series, book_ids] )
76 for idx in 0 .. (series_infos.length - 1) do
77 #puts series.descr + ': ' + book_ids.length.to_s + ' books.'
83 back = series_infos[idx-1]
85 if (idx + 1) < series_infos.length
86 fwd = series_infos[idx+1]
89 cur = series_infos[idx]
93 page = Page.new(@store)
95 page.back = [back[0].key + '.html', 'Back']
98 page.forward = [fwd[0].key + '.html', 'Forward']
100 page.output_dir = 'series/series_' + age
101 page.index_file = series.key + '.html'
102 page.title = 'Series “' + series.descr + '” (' + book_ids.length.to_s + ' books)'
103 page.up = ['index.html', 'Up']
105 page.write_html(book_ids)
108 content = '<h1>“' + age + '” Series</h1>'
109 content += '<p><table><tr><th>Author</th><th>Series</th><th>Genre</th><th>Books</th></tr>'
110 series_infos.each do |cur|
114 author = series.grouping
118 content += '<td><a href="../../atoz/output_' + letter + '.html">' + author + '</a></td>'
119 content += '<td><a href="' + series.key + '.html">' + series.descr + '</a></td>'
120 content += '<td>' + series.genre + '</td>'
121 content += '<td>' + book_ids.length.to_s + '</td>'
124 content += '</table></p>'
125 page = Page.new(@store)
126 page.output_dir = 'series/series_' + age
127 page.special = content
128 page.up = ['../index.html', 'Up']
129 page.write_html( [] )
131 return series_infos.length
134 def write_series_listing
135 ages = ['beginner', 'junior', 'ya', 'adult']
139 puts 'Series for "' + age + '" readers...'
141 series_counts[age] = write_series_for_age(age)
144 content = '<h1>Browse Books By Series</h1>'
146 content += '<table><tr><th>Age</th><th>Number of Series</th></tr>'
148 content += '<tr><td><a href="series_' + age + '/index.html">' + age + '</a></td><td>' + series_counts[age].to_s + '</td></tr>'
150 content += '</table></p>'
151 page = Page.new(@store)
152 page.output_dir = 'series'
153 page.special = content
154 page.up = ['../output/index.html', 'Up']
155 page.write_html( [] )