mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Initial support for preprocessing BD files
This commit is contained in:
parent
c36e73b616
commit
59faf929ea
@ -93,6 +93,19 @@ class HTMLConverter(object):
|
||||
|
||||
]
|
||||
|
||||
# Fix Book Designer markup
|
||||
BOOK_DESIGNER = [
|
||||
# Create header tags
|
||||
(re.compile('<h2.*?id=BookTitle.*?>(.*?)</span>', re.IGNORECASE|re.DOTALL),
|
||||
lambda match : '<h1 align="center">%s</h1>'%(match.group(1),)),
|
||||
(re.compile('<h2.*?id=BookAuthor.*?>(.*?)</span>', re.IGNORECASE|re.DOTALL),
|
||||
lambda match : '<h2 align="right">%s</h2>'%(match.group(1),)),
|
||||
(re.compile('<span.*?id=title.*?>(.*?)</span>', re.IGNORECASE|re.DOTALL),
|
||||
lambda match : '<h2>%s</h2>'%(match.group(1),)),
|
||||
(re.compile('<span.*?id=subtitle.*?>(.*?)</span>', re.IGNORECASE|re.DOTALL),
|
||||
lambda match : '<h3>%s</h3>'%(match.group(1),)),
|
||||
]
|
||||
|
||||
def __hasattr__(self, attr):
|
||||
if hasattr(self.options, attr):
|
||||
return True
|
||||
|
@ -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 += '<ol><li><b>baen</b> - Books from BAEN Publishers</li>'
|
||||
ph += '<li><b>pdftohtml</b> - HTML files that are the output of the program pdftohtml</li>'
|
||||
ph += '<li><b>book-designer</b> - HTML0 files from Book Designer</li>'
|
||||
self.preprocess.setToolTip(ph)
|
||||
self.preprocess.setWhatsThis(ph)
|
||||
for profile in self.PARSER.get_option('--profile').choices:
|
||||
|
Loading…
x
Reference in New Issue
Block a user