diff --git a/src/calibre/ebooks/conversion/cli.py b/src/calibre/ebooks/conversion/cli.py index 45b7841347..5fbd0c6acf 100644 --- a/src/calibre/ebooks/conversion/cli.py +++ b/src/calibre/ebooks/conversion/cli.py @@ -141,7 +141,7 @@ def add_pipeline_options(parser, plumber): 'subset_embedded_fonts', 'embed_all_fonts', 'line_height', 'minimum_line_height', 'linearize_tables', - 'extra_css', 'filter_css', + 'extra_css', 'filter_css', 'expand_css', 'smarten_punctuation', 'unsmarten_punctuation', 'margin_top', 'margin_left', 'margin_right', 'margin_bottom', 'change_justification', diff --git a/src/calibre/ebooks/conversion/plugins/oeb_output.py b/src/calibre/ebooks/conversion/plugins/oeb_output.py index d63be32fd9..114bcadfc1 100644 --- a/src/calibre/ebooks/conversion/plugins/oeb_output.py +++ b/src/calibre/ebooks/conversion/plugins/oeb_output.py @@ -54,7 +54,7 @@ class OEBOutput(OutputFormatPlugin): f.write(raw) for item in oeb_book.manifest: - if item.media_type in OEB_STYLES and hasattr(item.data, 'cssText'): + if not self.opts.expand_css and item.media_type in OEB_STYLES and hasattr(item.data, 'cssText'): condense_sheet(item.data) path = os.path.abspath(unquote(item.href)) dir = os.path.dirname(path) diff --git a/src/calibre/ebooks/conversion/plumber.py b/src/calibre/ebooks/conversion/plumber.py index 73e76b72d0..6edef139e7 100644 --- a/src/calibre/ebooks/conversion/plumber.py +++ b/src/calibre/ebooks/conversion/plumber.py @@ -363,6 +363,14 @@ OptionRecommendation(name='filter_css', 'font-family,color,margin-left,margin-right') ), +OptionRecommendation(name='expand_css', + recommended_value=False, level=OptionRecommendation.LOW, + help=_( + 'By default, calibre will use the shorthand form for various' + ' css properties such as margin, padding, border, etc. This' + ' option will cause it to use the full expanded form instead.') + ), + OptionRecommendation(name='page_breaks_before', recommended_value="//*[name()='h1' or name()='h2']", level=OptionRecommendation.LOW, diff --git a/src/calibre/ebooks/mobi/writer8/main.py b/src/calibre/ebooks/mobi/writer8/main.py index 00550d78d4..f0cbcf5c86 100644 --- a/src/calibre/ebooks/mobi/writer8/main.py +++ b/src/calibre/ebooks/mobi/writer8/main.py @@ -151,7 +151,7 @@ class KF8Writer(object): for item in self.oeb.manifest: if item.media_type in OEB_STYLES: - if hasattr(item.data, 'cssText'): + if not self.opts.expand_css and hasattr(item.data, 'cssText'): condense_sheet(self.data(item)) data = self.data(item).cssText sheets[item.href] = len(self.flows) diff --git a/src/calibre/gui2/convert/look_and_feel.py b/src/calibre/gui2/convert/look_and_feel.py index ba101a8c0a..1682323fc1 100644 --- a/src/calibre/gui2/convert/look_and_feel.py +++ b/src/calibre/gui2/convert/look_and_feel.py @@ -38,7 +38,7 @@ class LookAndFeelWidget(Widget, Ui_Form): 'remove_paragraph_spacing', 'remove_paragraph_spacing_indent_size', 'insert_blank_line_size', - 'input_encoding', 'filter_css', + 'input_encoding', 'filter_css', 'expand_css', 'asciiize', 'keep_ligatures', 'linearize_tables'] ) diff --git a/src/calibre/gui2/convert/look_and_feel.ui b/src/calibre/gui2/convert/look_and_feel.ui index e9d9caeed7..d22fc658b4 100644 --- a/src/calibre/gui2/convert/look_and_feel.ui +++ b/src/calibre/gui2/convert/look_and_feel.ui @@ -21,13 +21,6 @@ - - - - &Linearize tables - - - @@ -125,13 +118,6 @@ - - - - &Transliterate unicode characters to ASCII - - - @@ -422,6 +408,27 @@ + + + + &Transliterate unicode characters to ASCII + + + + + + + E&xpand CSS + + + + + + + &Linearize tables + + +