Conversion: Remove paragraph spacing: If you set the indent size to 0, calibre will now leave the indents specified in the input document

This commit is contained in:
Kovid Goyal 2011-09-13 10:28:47 -06:00
parent 2b31560377
commit 371db4901f
2 changed files with 6 additions and 3 deletions

View File

@ -368,7 +368,9 @@ OptionRecommendation(name='remove_paragraph_spacing_indent_size',
recommended_value=1.5, level=OptionRecommendation.LOW,
help=_('When calibre removes blank lines between paragraphs, it automatically '
'sets a paragraph indent, to ensure that paragraphs can be easily '
'distinguished. This option controls the width of that indent (in em).')
'distinguished. This option controls the width of that indent (in em). '
'If you set this value to 0, then the indent specified in the input '
'document is used.')
),
OptionRecommendation(name='prefer_metadata_cover',

View File

@ -320,9 +320,10 @@ class CSSFlattener(object):
if self.context.insert_blank_line:
cssdict['margin-top'] = cssdict['margin-bottom'] = \
'%fem'%self.context.insert_blank_line_size
if (self.context.remove_paragraph_spacing and
indent_size = self.context.remove_paragraph_spacing_indent_size
if (self.context.remove_paragraph_spacing and indent_size != 0.0 and
cssdict.get('text-align', None) not in ('center', 'right')):
cssdict['text-indent'] = "%1.1fem" % self.context.remove_paragraph_spacing_indent_size
cssdict['text-indent'] = "%1.1fem" % indent_size
if cssdict:
items = cssdict.items()