12 ('A'..'Z').each do |letter|
13 atoz_counts[letter] = write_authors_starting_with(letter)
16 content = '<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 page = Page.new(@store)
21 page.output_dir = 'atoz'
22 page.special = content
23 page.up = ['../output/index.html', 'Up']
28 def write_authors_starting_with(letter)
29 book_ids = @store.query_books_by_author(letter + '%')
30 puts 'Authors starting with "' + letter + '": ' + book_ids.length.to_s() + ' books.'
32 page = Page.new(@store)
34 page.back = ['../atoz/output_' + (letter.ord - 1).chr + '.html', 'Prev']
37 page.forward = ['../atoz/output_' + (letter.ord + 1).chr + '.html', 'Next']
39 page.output_dir = 'atoz'
40 page.index_file = 'output_' + letter + '.html'
41 page.title = "Authors starting with '" + letter + "'"
42 page.up = ['../atoz/index.html', 'Up']
44 page.write_html(book_ids)
45 return book_ids.length
48 def write_series_for_age(age)
51 series_ids = @store.query_series_by_age(age)
53 series_ids.each do |id|
54 series = @store.load_series(id)
55 book_ids = @store.query_books_by_series_id(id)
56 if nil != book_ids and book_ids.length > 0
57 series_infos.push( [series, book_ids] )
61 for idx in 0 .. (series_infos.length - 1) do
62 #puts series.descr + ': ' + book_ids.length.to_s + ' books.'
68 back = series_infos[idx-1]
70 if (idx + 1) < series_infos.length
71 fwd = series_infos[idx+1]
74 cur = series_infos[idx]
78 page = Page.new(@store)
80 page.back = [back[0].key + '.html', 'Back']
83 page.forward = [fwd[0].key + '.html', 'Forward']
85 page.output_dir = 'series/series_' + age
86 page.index_file = series.key + '.html'
87 page.title = 'Series “' + series.descr + '” (' + book_ids.length.to_s + ' books)'
88 page.up = ['index.html', 'Up']
90 page.write_html(book_ids)
93 content = '<h1>“' + age + '” Series</h1>'
94 content += '<p><table><tr><th>Author</th><th>Series</th><th>Genre</th><th>Books</th></tr>'
95 series_infos.each do |cur|
99 author = series.grouping
103 content += '<td><a href="../../atoz/output_' + letter + '.html">' + author + '</a></td>'
104 content += '<td><a href="' + series.key + '.html">' + series.descr + '</a></td>'
105 content += '<td>' + series.genre + '</td>'
106 content += '<td>' + book_ids.length.to_s + '</td>'
109 content += '</table></p>'
110 page = Page.new(@store)
111 page.output_dir = 'series/series_' + age
112 page.special = content
113 page.up = ['../index.html', 'Up']
114 page.write_html( [] )
116 return series_infos.length
119 def write_series_listing
120 ages = ['beginner', 'junior', 'ya', 'adult']
124 puts 'Series for "' + age + '" readers...'
126 series_counts[age] = write_series_for_age(age)
129 content = '<h1>Browse Books By Series</h1>'
131 content += '<table><tr><th>Age</th><th>Number of Series</th></tr>'
133 content += '<tr><td><a href="series_' + age + '/index.html">' + age + '</a></td><td>' + series_counts[age].to_s + '</td></tr>'
135 content += '</table></p>'
136 page = Page.new(@store)
137 page.output_dir = 'series'
138 page.special = content
139 page.up = ['../output/index.html', 'Up']
140 page.write_html( [] )