mirror of
https://github.com/gryf/ebook-converter.git
synced 2026-03-31 09:23:32 +02:00
Re added (probably) right formating codes.
This commit is contained in:
@@ -285,7 +285,7 @@ def create_option_parser(args, log):
|
|||||||
log.info('Available recipes:')
|
log.info('Available recipes:')
|
||||||
titles = sorted(get_builtin_recipe_titles())
|
titles = sorted(get_builtin_recipe_titles())
|
||||||
for title in titles:
|
for title in titles:
|
||||||
log.info('\t%s', title)
|
log.info('\t%r', title)
|
||||||
log.info('%d recipes available', len(titles))
|
log.info('%d recipes available', len(titles))
|
||||||
raise SystemExit(0)
|
raise SystemExit(0)
|
||||||
|
|
||||||
|
|||||||
@@ -1108,7 +1108,7 @@ OptionRecommendation(name='search_replace',
|
|||||||
try:
|
try:
|
||||||
fkey = list(map(float, fkey.split(',')))
|
fkey = list(map(float, fkey.split(',')))
|
||||||
except Exception:
|
except Exception:
|
||||||
self.log.error('Invalid font size key: %s ignoring', fkey)
|
self.log.error('Invalid font size key: %r ignoring', fkey)
|
||||||
fkey = self.opts.dest.fkey
|
fkey = self.opts.dest.fkey
|
||||||
|
|
||||||
if self.opts.debug_pipeline is not None:
|
if self.opts.debug_pipeline is not None:
|
||||||
|
|||||||
@@ -957,11 +957,11 @@ class Manifest(object):
|
|||||||
def _fetch_css(self, path):
|
def _fetch_css(self, path):
|
||||||
hrefs = self.oeb.manifest.hrefs
|
hrefs = self.oeb.manifest.hrefs
|
||||||
if path not in hrefs:
|
if path not in hrefs:
|
||||||
self.oeb.logger.warning('CSS import of missing file %s', path)
|
self.oeb.logger.warning('CSS import of missing file %r', path)
|
||||||
return (None, None)
|
return (None, None)
|
||||||
item = hrefs[path]
|
item = hrefs[path]
|
||||||
if item.media_type not in OEB_STYLES:
|
if item.media_type not in OEB_STYLES:
|
||||||
self.oeb.logger.warning('CSS import of non-CSS file %s', path)
|
self.oeb.logger.warning('CSS import of non-CSS file %r', path)
|
||||||
return (None, None)
|
return (None, None)
|
||||||
data = item.data.cssText
|
data = item.data.cssText
|
||||||
enc = None if isinstance(data, str) else 'utf-8'
|
enc = None if isinstance(data, str) else 'utf-8'
|
||||||
|
|||||||
@@ -239,7 +239,7 @@ def parse_html(data, log=None, decoder=None, preprocessor=None,
|
|||||||
if barename(data.tag) != 'html':
|
if barename(data.tag) != 'html':
|
||||||
if barename(data.tag) in non_html_file_tags:
|
if barename(data.tag) in non_html_file_tags:
|
||||||
raise NotHTML(data.tag)
|
raise NotHTML(data.tag)
|
||||||
log.warning('File %s does not appear to be (X)HTML', filename)
|
log.warning('File %r does not appear to be (X)HTML', filename)
|
||||||
nroot = etree.fromstring('<html></html>')
|
nroot = etree.fromstring('<html></html>')
|
||||||
has_body = False
|
has_body = False
|
||||||
for child in list(data):
|
for child in list(data):
|
||||||
@@ -248,7 +248,7 @@ def parse_html(data, log=None, decoder=None, preprocessor=None,
|
|||||||
break
|
break
|
||||||
parent = nroot
|
parent = nroot
|
||||||
if not has_body:
|
if not has_body:
|
||||||
log.warning('File %s appears to be a HTML fragment', filename)
|
log.warning('File %r appears to be a HTML fragment', filename)
|
||||||
nroot = etree.fromstring('<html><body/></html>')
|
nroot = etree.fromstring('<html><body/></html>')
|
||||||
parent = nroot[0]
|
parent = nroot[0]
|
||||||
for child in list(data.iter()):
|
for child in list(data.iter()):
|
||||||
|
|||||||
@@ -216,7 +216,7 @@ class OEBReader(object):
|
|||||||
scheme = urllib.parse.urlparse(href).scheme
|
scheme = urllib.parse.urlparse(href).scheme
|
||||||
except Exception:
|
except Exception:
|
||||||
self.oeb.log.exception('Skipping invalid href: '
|
self.oeb.log.exception('Skipping invalid href: '
|
||||||
'%s', href)
|
'%r', href)
|
||||||
continue
|
continue
|
||||||
if not scheme and href not in known:
|
if not scheme and href not in known:
|
||||||
new.add(href)
|
new.add(href)
|
||||||
@@ -244,12 +244,12 @@ class OEBReader(object):
|
|||||||
continue
|
continue
|
||||||
if not self.oeb.container.exists(href):
|
if not self.oeb.container.exists(href):
|
||||||
if href not in warned:
|
if href not in warned:
|
||||||
self.logger.warning('Referenced file %s not found',
|
self.logger.warning('Referenced file %r not found',
|
||||||
href)
|
href)
|
||||||
warned.add(href)
|
warned.add(href)
|
||||||
continue
|
continue
|
||||||
if href not in warned:
|
if href not in warned:
|
||||||
self.logger.warning('Referenced file %s not in manifest',
|
self.logger.warning('Referenced file %r not in manifest',
|
||||||
href)
|
href)
|
||||||
warned.add(href)
|
warned.add(href)
|
||||||
id, _ = manifest.generate(id='added')
|
id, _ = manifest.generate(id='added')
|
||||||
@@ -276,13 +276,13 @@ class OEBReader(object):
|
|||||||
media_type = media_type.lower()
|
media_type = media_type.lower()
|
||||||
fallback = elem.get('fallback')
|
fallback = elem.get('fallback')
|
||||||
if href in manifest.hrefs:
|
if href in manifest.hrefs:
|
||||||
self.logger.warning('Duplicate manifest entry for %s', href)
|
self.logger.warning('Duplicate manifest entry for %r', href)
|
||||||
continue
|
continue
|
||||||
if not self.oeb.container.exists(href):
|
if not self.oeb.container.exists(href):
|
||||||
self.logger.warning('Manifest item %s not found', href)
|
self.logger.warning('Manifest item %r not found', href)
|
||||||
continue
|
continue
|
||||||
if id in manifest.ids:
|
if id in manifest.ids:
|
||||||
self.logger.warning('Duplicate manifest id %s', id)
|
self.logger.warning('Duplicate manifest id %r', id)
|
||||||
id, href = manifest.generate(id, href)
|
id, href = manifest.generate(id, href)
|
||||||
manifest.add(id, href, media_type, fallback)
|
manifest.add(id, href, media_type, fallback)
|
||||||
invalid = self._manifest_prune_invalid()
|
invalid = self._manifest_prune_invalid()
|
||||||
@@ -324,7 +324,7 @@ class OEBReader(object):
|
|||||||
if item.href in removed_items_to_ignore:
|
if item.href in removed_items_to_ignore:
|
||||||
continue
|
continue
|
||||||
if version >= 2:
|
if version >= 2:
|
||||||
self.logger.warning('Spine-referenced file %s not in spine',
|
self.logger.warning('Spine-referenced file %r not in spine',
|
||||||
item.href)
|
item.href)
|
||||||
spine.add(item, linear=False)
|
spine.add(item, linear=False)
|
||||||
|
|
||||||
@@ -334,7 +334,7 @@ class OEBReader(object):
|
|||||||
for elem in base.xpath(opf, '/o2:package/o2:spine/o2:itemref'):
|
for elem in base.xpath(opf, '/o2:package/o2:spine/o2:itemref'):
|
||||||
idref = elem.get('idref')
|
idref = elem.get('idref')
|
||||||
if idref not in manifest.ids:
|
if idref not in manifest.ids:
|
||||||
self.logger.warning('Spine item %s not found', idref)
|
self.logger.warning('Spine item %r not found', idref)
|
||||||
continue
|
continue
|
||||||
item = manifest.ids[idref]
|
item = manifest.ids[idref]
|
||||||
if (item.media_type.lower() in base.OEB_DOCS and
|
if (item.media_type.lower() in base.OEB_DOCS and
|
||||||
@@ -370,7 +370,7 @@ class OEBReader(object):
|
|||||||
corrected_href = href
|
corrected_href = href
|
||||||
break
|
break
|
||||||
if corrected_href is None:
|
if corrected_href is None:
|
||||||
self.logger.warning('Guide reference %s not found',
|
self.logger.warning('Guide reference %r not found',
|
||||||
ref_href)
|
ref_href)
|
||||||
continue
|
continue
|
||||||
ref_href = corrected_href
|
ref_href = corrected_href
|
||||||
@@ -413,7 +413,7 @@ class OEBReader(object):
|
|||||||
if path and path not in self.oeb.manifest.hrefs:
|
if path and path not in self.oeb.manifest.hrefs:
|
||||||
path = base.urlnormalize(path)
|
path = base.urlnormalize(path)
|
||||||
if href and path not in self.oeb.manifest.hrefs:
|
if href and path not in self.oeb.manifest.hrefs:
|
||||||
self.logger.warning('TOC reference %s not found', href)
|
self.logger.warning('TOC reference %r not found', href)
|
||||||
gc = base.xpath(child, 'ncx:navPoint')
|
gc = base.xpath(child, 'ncx:navPoint')
|
||||||
if not gc:
|
if not gc:
|
||||||
# This node is useless
|
# This node is useless
|
||||||
@@ -490,7 +490,7 @@ class OEBReader(object):
|
|||||||
continue
|
continue
|
||||||
path, _ = urllib.parse.urldefrag(base.urlnormalize(href))
|
path, _ = urllib.parse.urldefrag(base.urlnormalize(href))
|
||||||
if path not in self.oeb.manifest.hrefs:
|
if path not in self.oeb.manifest.hrefs:
|
||||||
self.logger.warning('TOC reference %s not found', href)
|
self.logger.warning('TOC reference %r not found', href)
|
||||||
continue
|
continue
|
||||||
id = site.get('id')
|
id = site.get('id')
|
||||||
toc.add(title, href, id=id)
|
toc.add(title, href, id=id)
|
||||||
@@ -658,7 +658,7 @@ class OEBReader(object):
|
|||||||
if item is not None and item.media_type in base.OEB_IMAGES:
|
if item is not None and item.media_type in base.OEB_IMAGES:
|
||||||
return item
|
return item
|
||||||
else:
|
else:
|
||||||
self.logger.warning('Invalid cover image @id %s', id)
|
self.logger.warning('Invalid cover image @id %r', id)
|
||||||
hcover = self.oeb.spine[0]
|
hcover = self.oeb.spine[0]
|
||||||
if 'cover' in self.oeb.guide:
|
if 'cover' in self.oeb.guide:
|
||||||
href = self.oeb.guide['cover'].href
|
href = self.oeb.guide['cover'].href
|
||||||
|
|||||||
@@ -248,7 +248,7 @@ class Stylizer(object):
|
|||||||
sitem = hrefs[ihref]
|
sitem = hrefs[ihref]
|
||||||
if sitem.media_type not in base.OEB_STYLES:
|
if sitem.media_type not in base.OEB_STYLES:
|
||||||
self.logger.warning('CSS @import of non-CSS '
|
self.logger.warning('CSS @import of non-CSS '
|
||||||
'file %s', rule.href)
|
'file %r', rule.href)
|
||||||
continue
|
continue
|
||||||
stylesheets.append(sitem.data)
|
stylesheets.append(sitem.data)
|
||||||
# Make links to resources absolute, since these rules will
|
# Make links to resources absolute, since these rules will
|
||||||
@@ -264,11 +264,11 @@ class Stylizer(object):
|
|||||||
path = item.abshref(href)
|
path = item.abshref(href)
|
||||||
sitem = oeb.manifest.hrefs.get(path, None)
|
sitem = oeb.manifest.hrefs.get(path, None)
|
||||||
if sitem is None:
|
if sitem is None:
|
||||||
self.logger.warning('Stylesheet %s referenced by file %s '
|
self.logger.warning('Stylesheet %r referenced by file %r '
|
||||||
'not in manifest', path, item.href)
|
'not in manifest', path, item.href)
|
||||||
continue
|
continue
|
||||||
if not hasattr(sitem.data, 'cssRules'):
|
if not hasattr(sitem.data, 'cssRules'):
|
||||||
self.logger.warning('Stylesheet %s referenced by file %s '
|
self.logger.warning('Stylesheet %r referenced by file %r '
|
||||||
'is not CSS', path, item.href)
|
'is not CSS', path, item.href)
|
||||||
continue
|
continue
|
||||||
stylesheets.append(sitem.data)
|
stylesheets.append(sitem.data)
|
||||||
@@ -304,7 +304,7 @@ class Stylizer(object):
|
|||||||
matches = tuple(select(text))
|
matches = tuple(select(text))
|
||||||
except SelectorError as err:
|
except SelectorError as err:
|
||||||
self.logger.error('Ignoring CSS rule with invalid selector: '
|
self.logger.error('Ignoring CSS rule with invalid selector: '
|
||||||
'%s (%s)', text, err)
|
'%r (%s)', text, err)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if fl is not None:
|
if fl is not None:
|
||||||
@@ -368,7 +368,7 @@ class Stylizer(object):
|
|||||||
def _fetch_css_file(self, path):
|
def _fetch_css_file(self, path):
|
||||||
hrefs = self.oeb.manifest.hrefs
|
hrefs = self.oeb.manifest.hrefs
|
||||||
if path not in hrefs:
|
if path not in hrefs:
|
||||||
self.logger.warning('CSS import of missing file %s', path)
|
self.logger.warning('CSS import of missing file %r', path)
|
||||||
return (None, None)
|
return (None, None)
|
||||||
item = hrefs[path]
|
item = hrefs[path]
|
||||||
if item.media_type not in base.OEB_STYLES:
|
if item.media_type not in base.OEB_STYLES:
|
||||||
|
|||||||
@@ -6,11 +6,6 @@ from lxml import etree
|
|||||||
from ebook_converter.ebooks.oeb.base import rewrite_links, urlnormalize
|
from ebook_converter.ebooks.oeb.base import rewrite_links, urlnormalize
|
||||||
|
|
||||||
|
|
||||||
__license__ = 'GPL v3'
|
|
||||||
__copyright__ = '2010, Kovid Goyal <kovid@kovidgoyal.net>'
|
|
||||||
__docformat__ = 'restructuredtext en'
|
|
||||||
|
|
||||||
|
|
||||||
class RenameFiles(object): # {{{
|
class RenameFiles(object): # {{{
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ class RemoveFakeMargins(object):
|
|||||||
remove = set()
|
remove = set()
|
||||||
for k, v in self.levels.items():
|
for k, v in self.levels.items():
|
||||||
num = len(v)
|
num = len(v)
|
||||||
self.log.debug('Found %s items of level: %s', num, k)
|
self.log.debug('Found %d items of level: %s', num, k)
|
||||||
level = int(k.split('_')[-1])
|
level = int(k.split('_')[-1])
|
||||||
tag = k.split('_')[0]
|
tag = k.split('_')[0]
|
||||||
if tag == 'p' and num < 25:
|
if tag == 'p' and num < 25:
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ class RescaleImages(object):
|
|||||||
if scaled:
|
if scaled:
|
||||||
new_width = max(1, new_width)
|
new_width = max(1, new_width)
|
||||||
new_height = max(1, new_height)
|
new_height = max(1, new_height)
|
||||||
self.log('Rescaling image from %sx%s to %sx%s %s', width,
|
self.log('Rescaling image from %dx%d to %dx%d %s', width,
|
||||||
height, new_width, new_height, item.href)
|
height, new_width, new_height, item.href)
|
||||||
try:
|
try:
|
||||||
img = img.resize((new_width, new_height))
|
img = img.resize((new_width, new_height))
|
||||||
|
|||||||
@@ -22,9 +22,6 @@ from ebook_converter.css_selectors import Select, SelectorError
|
|||||||
from ebook_converter.utils import encoding as uenc
|
from ebook_converter.utils import encoding as uenc
|
||||||
|
|
||||||
|
|
||||||
__license__ = 'GPL v3'
|
|
||||||
__copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net'
|
|
||||||
__docformat__ = 'restructuredtext en'
|
|
||||||
XPath = functools.partial(_XPath, namespaces=const.XPNSMAP)
|
XPath = functools.partial(_XPath, namespaces=const.XPNSMAP)
|
||||||
|
|
||||||
SPLIT_POINT_ATTR = 'csp'
|
SPLIT_POINT_ATTR = 'csp'
|
||||||
@@ -128,7 +125,7 @@ class Split(object):
|
|||||||
page_breaks.add(elem)
|
page_breaks.add(elem)
|
||||||
except SelectorError as err:
|
except SelectorError as err:
|
||||||
self.log.warn('Ignoring page breaks specified with invalid '
|
self.log.warn('Ignoring page breaks specified with invalid '
|
||||||
'CSS selector: %s (%s)', selector, err)
|
'CSS selector: %r (%s)', selector, err)
|
||||||
|
|
||||||
for i, elem in enumerate(item.data.iter('*')):
|
for i, elem in enumerate(item.data.iter('*')):
|
||||||
try:
|
try:
|
||||||
@@ -227,7 +224,7 @@ class FlowSplitter(object):
|
|||||||
for i, tree in enumerate(trees):
|
for i, tree in enumerate(trees):
|
||||||
size = len(tostring(tree.getroot()))
|
size = len(tostring(tree.getroot()))
|
||||||
if size > self.max_flow_size:
|
if size > self.max_flow_size:
|
||||||
self.log.info('\tFound large tree #%s', i)
|
self.log.info('\tFound large tree #%d', i)
|
||||||
lt_found = True
|
lt_found = True
|
||||||
self.split_trees = []
|
self.split_trees = []
|
||||||
self.split_to_size(tree)
|
self.split_to_size(tree)
|
||||||
@@ -240,7 +237,7 @@ class FlowSplitter(object):
|
|||||||
|
|
||||||
self.was_split = len(self.trees) > 1
|
self.was_split = len(self.trees) > 1
|
||||||
if self.was_split:
|
if self.was_split:
|
||||||
self.log('\tSplit into %s parts', len(self.trees))
|
self.log('\tSplit into %d parts', len(self.trees))
|
||||||
self.commit()
|
self.commit()
|
||||||
|
|
||||||
def split_on_page_breaks(self, orig_tree):
|
def split_on_page_breaks(self, orig_tree):
|
||||||
@@ -380,7 +377,7 @@ class FlowSplitter(object):
|
|||||||
continue
|
continue
|
||||||
elif size <= self.max_flow_size:
|
elif size <= self.max_flow_size:
|
||||||
self.split_trees.append(t)
|
self.split_trees.append(t)
|
||||||
self.log.debug('\t\t\tCommitted sub-tree #%s (%s KB)',
|
self.log.debug('\t\t\tCommitted sub-tree #%d (%d KB)',
|
||||||
len(self.split_trees), size/1024.)
|
len(self.split_trees), size/1024.)
|
||||||
else:
|
else:
|
||||||
self.log.debug('\t\t\tSplit tree still too large: %d KB',
|
self.log.debug('\t\t\tSplit tree still too large: %d KB',
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ class DetectStructure(object):
|
|||||||
self.oeb.toc = orig_toc
|
self.oeb.toc = orig_toc
|
||||||
else:
|
else:
|
||||||
self.oeb.auto_generated_toc = True
|
self.oeb.auto_generated_toc = True
|
||||||
self.log.info('Auto generated TOC with %s entries.',
|
self.log.info('Auto generated TOC with %d entries.',
|
||||||
self.oeb.toc.count())
|
self.oeb.toc.count())
|
||||||
|
|
||||||
if opts.toc_filter is not None:
|
if opts.toc_filter is not None:
|
||||||
@@ -240,7 +240,7 @@ class DetectStructure(object):
|
|||||||
play_order=self.oeb.toc.next_play_order())
|
play_order=self.oeb.toc.next_play_order())
|
||||||
num += 1
|
num += 1
|
||||||
except ValueError:
|
except ValueError:
|
||||||
self.oeb.log.critical('Failed to process link: %s',
|
self.oeb.log.critical('Failed to process link: %r',
|
||||||
href)
|
href)
|
||||||
# Most likely an incorrectly URL encoded link
|
# Most likely an incorrectly URL encoded link
|
||||||
continue
|
continue
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ class Reader132(FormatReader):
|
|||||||
|
|
||||||
pml = ''
|
pml = ''
|
||||||
for i in range(1, self.header_record.num_text_pages + 1):
|
for i in range(1, self.header_record.num_text_pages + 1):
|
||||||
self.log.debug('Extracting text page %s', i)
|
self.log.debug('Extracting text page %i', i)
|
||||||
pml += self.get_text_page(i)
|
pml += self.get_text_page(i)
|
||||||
hizer = PML_HTMLizer()
|
hizer = PML_HTMLizer()
|
||||||
html += hizer.parse_pml(pml, 'index.html')
|
html += hizer.parse_pml(pml, 'index.html')
|
||||||
@@ -123,7 +123,7 @@ class Reader132(FormatReader):
|
|||||||
footnoteids = re.findall(
|
footnoteids = re.findall(
|
||||||
'\\w+(?=\x00)', self.section_data(self.header_record.footnote_offset).decode('cp1252' if self.encoding is None else self.encoding))
|
'\\w+(?=\x00)', self.section_data(self.header_record.footnote_offset).decode('cp1252' if self.encoding is None else self.encoding))
|
||||||
for fid, i in enumerate(range(self.header_record.footnote_offset + 1, self.header_record.footnote_offset + self.header_record.footnote_count)):
|
for fid, i in enumerate(range(self.header_record.footnote_offset + 1, self.header_record.footnote_offset + self.header_record.footnote_count)):
|
||||||
self.log.debug('Extracting footnote page %s', i)
|
self.log.debug('Extracting footnote page %i', i)
|
||||||
if fid < len(footnoteids):
|
if fid < len(footnoteids):
|
||||||
fid = footnoteids[fid]
|
fid = footnoteids[fid]
|
||||||
else:
|
else:
|
||||||
@@ -135,7 +135,7 @@ class Reader132(FormatReader):
|
|||||||
sidebarids = re.findall(
|
sidebarids = re.findall(
|
||||||
'\\w+(?=\x00)', self.section_data(self.header_record.sidebar_offset).decode('cp1252' if self.encoding is None else self.encoding))
|
'\\w+(?=\x00)', self.section_data(self.header_record.sidebar_offset).decode('cp1252' if self.encoding is None else self.encoding))
|
||||||
for sid, i in enumerate(range(self.header_record.sidebar_offset + 1, self.header_record.sidebar_offset + self.header_record.sidebar_count)):
|
for sid, i in enumerate(range(self.header_record.sidebar_offset + 1, self.header_record.sidebar_offset + self.header_record.sidebar_count)):
|
||||||
self.log.debug('Extracting sidebar page %s', i)
|
self.log.debug('Extracting sidebar page %i', i)
|
||||||
if sid < len(sidebarids):
|
if sid < len(sidebarids):
|
||||||
sid = sidebarids[sid]
|
sid = sidebarids[sid]
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ class Reader202(FormatReader):
|
|||||||
|
|
||||||
pml = ''
|
pml = ''
|
||||||
for i in range(1, self.header_record.num_text_pages + 1):
|
for i in range(1, self.header_record.num_text_pages + 1):
|
||||||
self.log.debug('Extracting text page %s', i)
|
self.log.debug('Extracting text page %i', i)
|
||||||
pml += self.get_text_page(i)
|
pml += self.get_text_page(i)
|
||||||
|
|
||||||
title = self.mi.title
|
title = self.mi.title
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ class Reader(FormatReader):
|
|||||||
|
|
||||||
self.log.info('Decompressing text...')
|
self.log.info('Decompressing text...')
|
||||||
for i in range(1, self.header_record.num_records + 1):
|
for i in range(1, self.header_record.num_records + 1):
|
||||||
self.log.debug('\tDecompressing text section %s', i)
|
self.log.debug('\tDecompressing text section %i', i)
|
||||||
title = self.header_record.chapter_titles[i-1]
|
title = self.header_record.chapter_titles[i-1]
|
||||||
lines = []
|
lines = []
|
||||||
title_added = False
|
title_added = False
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ class Reader(FormatReader):
|
|||||||
|
|
||||||
self.log.info('Decompressing text...')
|
self.log.info('Decompressing text...')
|
||||||
for i in range(1, self.header_record.num_records + 1):
|
for i in range(1, self.header_record.num_records + 1):
|
||||||
self.log.debug('\tDecompressing text section %s', i)
|
self.log.debug('\tDecompressing text section %i', i)
|
||||||
raw_txt += self.decompress_text(i)
|
raw_txt += self.decompress_text(i)
|
||||||
|
|
||||||
self.log.info('Converting text to OEB...')
|
self.log.info('Converting text to OEB...')
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ class Reader(FormatReader):
|
|||||||
if (self.header_record.flags & 0x01) == 0:
|
if (self.header_record.flags & 0x01) == 0:
|
||||||
raise zTXTError('Only compression method 1 (random access) is supported')
|
raise zTXTError('Only compression method 1 (random access) is supported')
|
||||||
|
|
||||||
self.log.debug('Foud ztxt version: %s.%s', vmajor, vminor)
|
self.log.debug('Foud ztxt version: %i.%i', vmajor, vminor)
|
||||||
|
|
||||||
# Initalize the decompressor
|
# Initalize the decompressor
|
||||||
self.uncompressor = zlib.decompressobj()
|
self.uncompressor = zlib.decompressobj()
|
||||||
@@ -73,7 +73,7 @@ class Reader(FormatReader):
|
|||||||
|
|
||||||
self.log.info('Decompressing text...')
|
self.log.info('Decompressing text...')
|
||||||
for i in range(1, self.header_record.num_records + 1):
|
for i in range(1, self.header_record.num_records + 1):
|
||||||
self.log.debug('\tDecompressing text section %s', i)
|
self.log.debug('\tDecompressing text section %i', i)
|
||||||
raw_txt += self.decompress_text(i)
|
raw_txt += self.decompress_text(i)
|
||||||
|
|
||||||
self.log.info('Converting text to OEB...')
|
self.log.info('Converting text to OEB...')
|
||||||
|
|||||||
@@ -11,12 +11,6 @@ from ebook_converter.ebooks.oeb.base import XHTML, barename, namespace, rewrite_
|
|||||||
from ebook_converter.ebooks.oeb.stylizer import Stylizer
|
from ebook_converter.ebooks.oeb.stylizer import Stylizer
|
||||||
|
|
||||||
|
|
||||||
__license__ = 'GPL 3'
|
|
||||||
__copyright__ = ('2011, John Schember <john@nachtimwald.com> 2011, '
|
|
||||||
'Leigh Parry <leighparry@blueyonder.co.uk>')
|
|
||||||
__docformat__ = 'restructuredtext en'
|
|
||||||
|
|
||||||
|
|
||||||
class MarkdownMLizer(OEB2HTML):
|
class MarkdownMLizer(OEB2HTML):
|
||||||
|
|
||||||
def extract_content(self, oeb_book, opts):
|
def extract_content(self, oeb_book, opts):
|
||||||
|
|||||||
@@ -14,11 +14,6 @@ from ebook_converter.ebooks import unit_convert
|
|||||||
from ebook_converter.ebooks.textile.unsmarten import unsmarten
|
from ebook_converter.ebooks.textile.unsmarten import unsmarten
|
||||||
|
|
||||||
|
|
||||||
__license__ = 'GPL 3'
|
|
||||||
__copyright__ = '2011, Leigh Parry <leighparry@blueyonder.co.uk>'
|
|
||||||
__docformat__ = 'restructuredtext en'
|
|
||||||
|
|
||||||
|
|
||||||
class TextileMLizer(OEB2HTML):
|
class TextileMLizer(OEB2HTML):
|
||||||
|
|
||||||
MAX_EM = 10
|
MAX_EM = 10
|
||||||
|
|||||||
Reference in New Issue
Block a user