From 59faf929ea97d12cac8f5a7ac75f18bc3b50e164 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 6 Oct 2007 02:29:49 +0000 Subject: [PATCH] Initial support for preprocessing BD files --- src/libprs500/ebooks/lrf/html/convert_from.py | 13 +++++++++++++ src/libprs500/gui2/dialogs/lrf_single.py | 1 + 2 files changed, 14 insertions(+) diff --git a/src/libprs500/ebooks/lrf/html/convert_from.py b/src/libprs500/ebooks/lrf/html/convert_from.py index 6e41b78285..b2fe675cbd 100644 --- a/src/libprs500/ebooks/lrf/html/convert_from.py +++ b/src/libprs500/ebooks/lrf/html/convert_from.py @@ -93,6 +93,19 @@ class HTMLConverter(object): ] + # Fix Book Designer markup + BOOK_DESIGNER = [ + # Create header tags + (re.compile('(.*?)', re.IGNORECASE|re.DOTALL), + lambda match : '

%s

'%(match.group(1),)), + (re.compile('(.*?)', re.IGNORECASE|re.DOTALL), + lambda match : '

%s

'%(match.group(1),)), + (re.compile('(.*?)', re.IGNORECASE|re.DOTALL), + lambda match : '

%s

'%(match.group(1),)), + (re.compile('(.*?)', re.IGNORECASE|re.DOTALL), + lambda match : '

%s

'%(match.group(1),)), + ] + def __hasattr__(self, attr): if hasattr(self.options, attr): return True diff --git a/src/libprs500/gui2/dialogs/lrf_single.py b/src/libprs500/gui2/dialogs/lrf_single.py index 40d9f468fc..df71096618 100644 --- a/src/libprs500/gui2/dialogs/lrf_single.py +++ b/src/libprs500/gui2/dialogs/lrf_single.py @@ -207,6 +207,7 @@ class LRFSingleDialog(QDialog, Ui_LRFSingleDialog): ph = 'Preprocess the file before converting to LRF. This is useful if you know that the file is from a specific source. Known sources:' ph += '
  1. baen - Books from BAEN Publishers
  2. ' ph += '
  3. pdftohtml - HTML files that are the output of the program pdftohtml
  4. ' + ph += '
  5. book-designer - HTML0 files from Book Designer
  6. ' self.preprocess.setToolTip(ph) self.preprocess.setWhatsThis(ph) for profile in self.PARSER.get_option('--profile').choices: