diff --git a/src/calibre/ebooks/conversion/cli.py b/src/calibre/ebooks/conversion/cli.py index 75c545f8b5..178561fcb5 100644 --- a/src/calibre/ebooks/conversion/cli.py +++ b/src/calibre/ebooks/conversion/cli.py @@ -125,7 +125,7 @@ def add_pipeline_options(parser, plumber): 'extra_css', 'margin_top', 'margin_left', 'margin_right', 'margin_bottom', 'dont_justify', - 'insert_blank_line', 'remove_paragraph_spacing', + 'insert_blank_line', 'remove_paragraph_spacing','remove_paragraph_spacing_indent_size', 'asciiize', 'remove_header', 'header_regex', 'remove_footer', 'footer_regex', ] diff --git a/src/calibre/ebooks/conversion/plumber.py b/src/calibre/ebooks/conversion/plumber.py index 2a3dfedd65..262f64a9cc 100644 --- a/src/calibre/ebooks/conversion/plumber.py +++ b/src/calibre/ebooks/conversion/plumber.py @@ -309,6 +309,11 @@ OptionRecommendation(name='remove_paragraph_spacing', 'paragraphs of 1.5em. Spacing removal will not work ' 'if the source file does not use paragraphs (

or

tags).') ), + +OptionRecommendation(name='remove_paragraph_spacing_indent_size', + recommended_value=1.5, level=OptionRecommendation.LOW, + help=_('Width of the indent used with Remove spacing between paragraphs option') + ), OptionRecommendation(name='prefer_metadata_cover', recommended_value=False, level=OptionRecommendation.LOW, diff --git a/src/calibre/ebooks/oeb/transforms/flatcss.py b/src/calibre/ebooks/oeb/transforms/flatcss.py index 464acbe0e0..fb32a1ccf9 100644 --- a/src/calibre/ebooks/oeb/transforms/flatcss.py +++ b/src/calibre/ebooks/oeb/transforms/flatcss.py @@ -278,7 +278,7 @@ class CSSFlattener(object): if self.context.insert_blank_line: cssdict['margin-top'] = cssdict['margin-bottom'] = '0.5em' if self.context.remove_paragraph_spacing: - cssdict['text-indent'] = '1.5em' + cssdict['text-indent'] = "%1.1fem" % self.context.remove_paragraph_spacing_indent_size if cssdict: items = cssdict.items() items.sort() diff --git a/src/calibre/gui2/convert/look_and_feel.py b/src/calibre/gui2/convert/look_and_feel.py index a10a410b67..4d43f64910 100644 --- a/src/calibre/gui2/convert/look_and_feel.py +++ b/src/calibre/gui2/convert/look_and_feel.py @@ -23,7 +23,7 @@ class LookAndFeelWidget(Widget, Ui_Form): 'font_size_mapping', 'line_height', 'linearize_tables', 'disable_font_rescaling', 'insert_blank_line', - 'remove_paragraph_spacing', 'input_encoding', + 'remove_paragraph_spacing', 'remove_paragraph_spacing_indent_size','input_encoding', 'asciiize'] ) self.db, self.book_id = db, book_id @@ -32,6 +32,8 @@ class LookAndFeelWidget(Widget, Ui_Form): self.opt_disable_font_rescaling.toggle() self.connect(self.button_font_key, SIGNAL('clicked()'), self.font_key_wizard) + self.opt_remove_paragraph_spacing.toggle() + self.opt_remove_paragraph_spacing.toggle() def font_key_wizard(self): from calibre.gui2.convert.font_key import FontKeyChooser diff --git a/src/calibre/gui2/convert/look_and_feel.ui b/src/calibre/gui2/convert/look_and_feel.ui index d451cd9af0..84d587d7b2 100644 --- a/src/calibre/gui2/convert/look_and_feel.ui +++ b/src/calibre/gui2/convert/look_and_feel.ui @@ -14,7 +14,7 @@ Form - + &Disable font size rescaling @@ -31,7 +31,7 @@ - + pt @@ -63,7 +63,7 @@ - + @@ -107,7 +107,7 @@ - + pt @@ -127,12 +127,59 @@ + + + - - - Remove &spacing between paragraphs - - + + + + + Remove &spacing between paragraphs + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Indent size: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + <p>When calibre removes inter paragraph spacing, it automatically sets a paragraph indent, to ensure that paragraphs can be easily distinguished. This option controls the width of that indent. + + + em + + + 1 + + + + + + @@ -155,14 +202,14 @@ - + &Transliterate unicode characters to ASCII. - + Extra &CSS @@ -174,9 +221,6 @@ - - - @@ -216,5 +260,37 @@ + + opt_remove_paragraph_spacing + toggled(bool) + label_4 + setEnabled(bool) + + + 20 + 20 + + + 20 + 20 + + + + + opt_remove_paragraph_spacing + toggled(bool) + opt_remove_paragraph_spacing_indent_size + setEnabled(bool) + + + 20 + 20 + + + 20 + 20 + + + diff --git a/src/calibre/manual/conversion.rst b/src/calibre/manual/conversion.rst index 8775b864a7..64d8b7b62b 100644 --- a/src/calibre/manual/conversion.rst +++ b/src/calibre/manual/conversion.rst @@ -163,7 +163,8 @@ Paragraph spacing Normally, paragraphs in XHTML are rendered with a blank line between them and no leading text indent. |app| has a couple of options to control this. :guilabel:`Remove spacing between paragraphs` forcefully ensure that all paragraphs have no inter paragraph spacing. It also sets the text -indent to 1.5em to mark that start of every paragraph. :guilabel:`Insert blank line` does the +indent to 1.5em (can be changed) to mark that start of every paragraph. +:guilabel:`Insert blank line` does the opposite, guaranteeing that there is exactly one blank line between each pair of paragraphs. Both these options are very comprehensive, removing spacing, or inserting it for *all* paragraphs (technically

and

tags). This is so that you can just set the option and be sure that