59 lines
1.7 KiB
HTML
59 lines
1.7 KiB
HTML
<!--startcut ==========================================================-->
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
|
<HTML>
|
|
<HEAD><title>Generate book index </title> </HEAD>
|
|
<BODY BGCOLOR="#EEE1CC" TEXT="#000000" LINK="#0000FF" VLINK="#0020F0"
|
|
ALINK="#FF0000">
|
|
|
|
|
|
<pre>
|
|
#!/usr/bin/python
|
|
# This script generates HTML pages for my book index. The input is
|
|
# a file that describes each book: title, author, subject and URL
|
|
# of the book's reviews
|
|
#
|
|
# Args: <book-description-file>
|
|
#
|
|
import sys
|
|
from book_list import Book_List
|
|
from books_pages import Authors_Page, Titles_Page, Subjects_Page
|
|
|
|
#
|
|
# Get the list of books from a file
|
|
#
|
|
f = open (sys.argv[1], "r")
|
|
book_list = Book_List ()
|
|
book_list.make_from_file (f)
|
|
f.close ()
|
|
#
|
|
# Sort the list by author and generate an HTML page
|
|
#
|
|
book_list.sort_by_author ()
|
|
author_page = Authors_Page ()
|
|
author_page.set_book_list (book_list.contents)
|
|
author_page.generate ("lightblue")
|
|
# Sort the list by title and generate an HTML page
|
|
#
|
|
book_list.sort_by_title ()
|
|
titles_page = Titles_Page ()
|
|
titles_page.set_book_list (book_list.contents)
|
|
titles_page.generate ("lightblue")
|
|
|
|
# Sort the list by title and generate an HTML page
|
|
#
|
|
book_list.sort_by_subject ()
|
|
subject_page = Subjects_Page ()
|
|
subject_page.set_book_list (book_list.contents)
|
|
subject_page.generate ("lightblue")
|
|
</pre>
|
|
<!--===================================================================-->
|
|
<P> <hr> <P>
|
|
<center><H5>Copyright © 1997, Richie Bielak<BR>
|
|
Published in Issue 19 of the Linux Gazette, July 1997</H5></center>
|
|
|
|
<!--startcut ==========================================================-->
|
|
</BODY>
|
|
</HTML>
|
|
<!--endcut ============================================================-->
|
|
|