Enforce minimum indent for lit files

This commit is contained in:
Kovid Goyal 2007-08-18 05:17:05 +00:00
parent 1a3c375a65
commit ef0ec5bd71
2 changed files with 6 additions and 2 deletions

View File

@ -997,6 +997,8 @@ class HTMLConverter(object):
indent = Span.unit_convert(str(tag_css['text-indent']), self.profile.dpi, pts=True)
if not indent:
indent = 0
if hasattr(self, 'minimum_indent') and indent > 0 and indent < self.minimum_indent:
indent = self.minimum_indent
else:
indent = self.book.defaultTextStyle.attrs['parindent']

View File

@ -42,7 +42,8 @@ def generate_html(pathtolit, logger):
logger.info(p.stdout.read())
ret = p.wait()
if ret != 0:
shutil.rmtree(tdir)
if os.path.exists(tdir) and os.path.isdir(tdir):
shutil.rmtree(tdir)
err = p.stderr.read()
raise ConversionError, err
return tdir
@ -76,7 +77,8 @@ def process_file(path, options, logger=None):
if not options.output:
ext = '.lrs' if options.lrs else '.lrf'
options.output = os.path.abspath(os.path.basename(os.path.splitext(path)[0]) + ext)
options.output = os.path.abspath(os.path.expanduser(options.output))
options.output = os.path.abspath(os.path.expanduser(options.output))
options.minimum_indent = 100
html_process_file(htmlfile, options, logger=logger)
finally:
shutil.rmtree(tdir)