LIT Input: Handle LIT files that have all their text in a single <pre> tag and use entities

This commit is contained in:
Kovid Goyal 2011-01-29 10:16:51 -07:00
parent 7f498e7021
commit 7764b0b007
2 changed files with 5 additions and 2 deletions

View File

@ -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')

View File

@ -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)