mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Clean up merge artifacts.
This commit is contained in:
parent
02a940d33b
commit
0a1c9f9919
@ -129,8 +129,6 @@ class UnBinary(object):
|
||||
self.tag_map, self.attr_map, self.tag_to_attr_map = map
|
||||
self.is_html = map is HTML_MAP
|
||||
self.tag_atoms, self.attr_atoms = atoms
|
||||
self.opf = map is OPF_MAP
|
||||
self.bin = bin
|
||||
self.dir = os.path.dirname(path)
|
||||
buf = StringIO()
|
||||
self.binary_to_text(bin, buf)
|
||||
@ -210,7 +208,8 @@ class UnBinary(object):
|
||||
continue
|
||||
if flags & FLAG_ATOM:
|
||||
if not self.tag_atoms or tag not in self.tag_atoms:
|
||||
raise LitError("atom tag %d not in atom tag list" % tag)
|
||||
raise LitError(
|
||||
"atom tag %d not in atom tag list" % tag)
|
||||
tag_name = self.tag_atoms[tag]
|
||||
current_map = self.attr_atoms
|
||||
elif tag < len(self.tag_map):
|
||||
@ -295,7 +294,7 @@ class UnBinary(object):
|
||||
c = '"'
|
||||
elif c == '<':
|
||||
c = '<'
|
||||
self.buf.write(c.encode('ascii', 'xmlcharrefreplace'))
|
||||
buf.write(c.encode('ascii', 'xmlcharrefreplace'))
|
||||
count -= 1
|
||||
if count == 0:
|
||||
if not in_censorship:
|
||||
@ -842,23 +841,6 @@ class LitFile(object):
|
||||
self._warn("damaged or invalid atoms attributes table")
|
||||
return (tags, attrs)
|
||||
|
||||
def get_entry_content(self, entry, pretty_print=False):
|
||||
if 'spine' in entry.state:
|
||||
name = '/'.join(('/data', entry.internal, 'content'))
|
||||
path = entry.path
|
||||
raw = self.get_file(name)
|
||||
decl, map = (OPF_DECL, OPF_MAP) \
|
||||
if name == '/meta' else (HTML_DECL, HTML_MAP)
|
||||
atoms = self.get_atoms(entry)
|
||||
content = decl + unicode(UnBinary(raw, path, self.manifest, map, atoms))
|
||||
if pretty_print:
|
||||
content = self._pretty_print(content)
|
||||
content = content.encode('utf-8')
|
||||
else:
|
||||
internal = '/'.join(('/data', entry.internal))
|
||||
content = self._litfile.get_file(internal)
|
||||
return content
|
||||
|
||||
|
||||
class LitContainer(object):
|
||||
"""Simple Container-interface, read-only accessor for LIT files."""
|
||||
@ -879,8 +861,14 @@ class LitContainer(object):
|
||||
elif 'spine' in entry.state:
|
||||
internal = '/'.join(('/data', entry.internal, 'content'))
|
||||
raw = self._litfile.get_file(internal)
|
||||
unbin = UnBinary(raw, name, self._litfile.manifest, HTML_MAP)
|
||||
manifest = self._litfile.manifest
|
||||
atoms = self._litfile.get_atoms(entry)
|
||||
unbin = UnBinary(raw, name, manifest, HTML_MAP, atoms)
|
||||
content = HTML_DECL + str(unbin)
|
||||
else:
|
||||
internal = '/'.join(('/data', entry.internal))
|
||||
content = self._litfile.get_file(internal)
|
||||
return content
|
||||
|
||||
def _read_meta(self):
|
||||
path = 'content.opf'
|
||||
|
Loading…
x
Reference in New Issue
Block a user