From 8b1800f8dc1dd8bb041f9dbf73164fa40f0c3b14 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 10 May 2007 01:55:01 +0000 Subject: [PATCH] --- src/libprs500/lrf/__init__.py | 4 ++++ src/libprs500/lrf/html/convert_from.py | 6 +----- src/libprs500/lrf/txt/convert_from.py | 9 ++++++--- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/libprs500/lrf/__init__.py b/src/libprs500/lrf/__init__.py index d86cd2e55a..61c9067757 100644 --- a/src/libprs500/lrf/__init__.py +++ b/src/libprs500/lrf/__init__.py @@ -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): diff --git a/src/libprs500/lrf/html/convert_from.py b/src/libprs500/lrf/html/convert_from.py index d89453746d..69fb85fb6e 100644 --- a/src/libprs500/lrf/html/convert_from.py +++ b/src/libprs500/lrf/html/convert_from.py @@ -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() diff --git a/src/libprs500/lrf/txt/convert_from.py b/src/libprs500/lrf/txt/convert_from.py index 056ec92c0a..82899c8f10 100644 --- a/src/libprs500/lrf/txt/convert_from.py +++ b/src/libprs500/lrf/txt/convert_from.py @@ -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()