mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
LIT Input: Handle LIT files that have all their text in a single <pre> tag and use entities
This commit is contained in:
parent
7f498e7021
commit
7764b0b007
@ -38,13 +38,16 @@ class LITInput(InputFormatPlugin):
|
||||
if len(body) == 1 and body[0].tag == XHTML('pre'):
|
||||
pre = body[0]
|
||||
from calibre.ebooks.txt.processor import convert_basic, preserve_spaces, \
|
||||
separate_paragraphs_single_line
|
||||
separate_paragraphs_single_line
|
||||
from calibre.ebooks.chardet import xml_to_unicode
|
||||
from lxml import etree
|
||||
import copy
|
||||
html = separate_paragraphs_single_line(pre.text)
|
||||
html = preserve_spaces(html)
|
||||
html = convert_basic(html).replace('<html>',
|
||||
'<html xmlns="%s">'%XHTML_NS)
|
||||
html = xml_to_unicode(html, strip_encoding_pats=True,
|
||||
resolve_entities=True)[0]
|
||||
root = etree.fromstring(html)
|
||||
body = XPath('//h:body')(root)
|
||||
pre.tag = XHTML('div')
|
||||
|
@ -21,7 +21,7 @@ class DBRestore(QDialog):
|
||||
self.l = QVBoxLayout()
|
||||
self.setLayout(self.l)
|
||||
self.l1 = QLabel('<b>'+_('Restoring database from backups, do not'
|
||||
' interrupt, this will happen in two stages')+'...')
|
||||
' interrupt, this will happen in three stages')+'...')
|
||||
self.setWindowTitle(_('Restoring database'))
|
||||
self.l.addWidget(self.l1)
|
||||
self.pb = QProgressBar(self)
|
||||
|
Loading…
x
Reference in New Issue
Block a user