12 puts 'Purging database...'
14 elsif arg.start_with?("--")
15 abort('ERROR: Unrecognized option "' + arg + '".')
29 if ! arg.start_with?("--")
30 puts 'Scanning directory "' + arg + '"...'
31 w = WalkDir.new(@store, arg)
36 puts 'Creating output...'
40 ('A'..'Z').each do |letter|
41 book_ids = @store.query_books_by_author(letter + '%')
42 puts 'Authors starting with "' + letter + '": ' + book_ids.length.to_s() + ' books.'
43 counts[letter] = book_ids.length
45 page = Page.new(@store)
47 page.back = ['../output_' + (letter.ord - 1).chr + '/index.html', 'Prev']
50 page.forward = ['../output_' + (letter.ord + 1).chr + '/index.html', 'Next']
52 page.output_dir = 'output_' + letter
53 page.title = "Authors starting with '" + letter + "'"
54 page.up = ['../output/index.html', 'Index']
56 page.write_html(book_ids)
59 content = '<table><tr><th>Author</th><th>Books</th></tr>'
60 ('A'..'Z').each do |letter|
61 content += ' <tr><td><a href="../output_' + letter + '/index.html">Starting with ' + letter + '</a></td><td>' + counts[letter].to_s + '</td></tr>'
63 page = Page.new(@store)
64 page.output_dir = 'output'
65 page.special = content