This commit is contained in:
Kovid Goyal 2007-05-10 01:55:01 +00:00
parent 0caca9fe4c
commit 8b1800f8dc
3 changed files with 11 additions and 8 deletions

View File

@ -43,6 +43,10 @@ def option_parser(usage):
dest="category", help="Set the category", default=' ')
parser.add_option('-o', '--output', action='store', default=None, \
help='Output file name. Default is derived from input filename')
parser.add_option('--title-sort', action='store', default='', dest='title_sort',
help='Sort key for the title')
parser.add_option('--author-sort', action='store', default='', dest='author_sort',
help='Sort key for the author')
return parser
def Book(font_delta=0, header=None, **settings):

View File

@ -991,11 +991,7 @@ def main():
help='''Preprocess Baen HTML files to improve generated LRF.''')
parser.add_option('--dpi', action='store', type='int', default=166, dest='dpi',
help='''The DPI of the target device. Default is 166 for the
Sony PRS 500''')
parser.add_option('--title-sort', action='store', default='', dest='title_sort',
help='Sort key for the title')
parser.add_option('--author-sort', action='store', default='', dest='author_sort',
help='Sort key for the author')
Sony PRS 500''')
options, args = parser.parse_args()
if len(args) != 1:
parser.print_help()

View File

@ -19,7 +19,7 @@ import os, sys
from libprs500.lrf import ConversionError, option_parser
from libprs500.lrf import Book
from libprs500.lrf.pylrs.pylrs import Paragraph, Italic, Bold
from libprs500.lrf.pylrs.pylrs import Paragraph, Italic, Bold, BookSetting
def main():
@ -64,9 +64,12 @@ def convert_txt(path, options):
header.append(Bold(options.title))
header.append(' by ')
header.append(Italic(options.author))
book = Book(header=header, title=options.title, author=options.author, \
title = (options.title, options.title_sort)
author = (options.author, options.author_sort)
book = Book(header=header, title=title, author=author, \
sourceencoding=options.encoding, freetext=options.freetext, \
category=options.category)
category=options.category, booksetting=BookSetting
(dpi=10*options.dpi,screenheight=800, screenwidth=600))
buffer = ''
pg = book.create_page()
block = book.create_text_block()