mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Conversion pipeline: Add an option to control the height of the blank lines inserted by calibre
This commit is contained in:
parent
847ac0dee1
commit
2ef59d81b2
@ -137,7 +137,9 @@ def add_pipeline_options(parser, plumber):
|
|||||||
'extra_css', 'smarten_punctuation',
|
'extra_css', 'smarten_punctuation',
|
||||||
'margin_top', 'margin_left', 'margin_right',
|
'margin_top', 'margin_left', 'margin_right',
|
||||||
'margin_bottom', 'change_justification',
|
'margin_bottom', 'change_justification',
|
||||||
'insert_blank_line', 'remove_paragraph_spacing','remove_paragraph_spacing_indent_size',
|
'insert_blank_line', 'insert_blank_line_size',
|
||||||
|
'remove_paragraph_spacing',
|
||||||
|
'remove_paragraph_spacing_indent_size',
|
||||||
'asciiize',
|
'asciiize',
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
|
@ -366,9 +366,9 @@ OptionRecommendation(name='remove_paragraph_spacing',
|
|||||||
|
|
||||||
OptionRecommendation(name='remove_paragraph_spacing_indent_size',
|
OptionRecommendation(name='remove_paragraph_spacing_indent_size',
|
||||||
recommended_value=1.5, level=OptionRecommendation.LOW,
|
recommended_value=1.5, level=OptionRecommendation.LOW,
|
||||||
help=_('When calibre removes inter paragraph spacing, it automatically '
|
help=_('When calibre removes blank lines between paragraphs, it automatically '
|
||||||
'sets a paragraph indent, to ensure that paragraphs can be easily '
|
'sets a paragraph indent, to ensure that paragraphs can be easily '
|
||||||
'distinguished. This option controls the width of that indent.')
|
'distinguished. This option controls the width of that indent (in em).')
|
||||||
),
|
),
|
||||||
|
|
||||||
OptionRecommendation(name='prefer_metadata_cover',
|
OptionRecommendation(name='prefer_metadata_cover',
|
||||||
@ -384,6 +384,13 @@ OptionRecommendation(name='insert_blank_line',
|
|||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|
||||||
|
OptionRecommendation(name='insert_blank_line_size',
|
||||||
|
recommended_value=0.5, level=OptionRecommendation.LOW,
|
||||||
|
help=_('Set the height of the inserted blank lines (in em).'
|
||||||
|
' The height of the lines between paragraphs will be twice the value'
|
||||||
|
' set here.')
|
||||||
|
),
|
||||||
|
|
||||||
OptionRecommendation(name='remove_first_image',
|
OptionRecommendation(name='remove_first_image',
|
||||||
recommended_value=False, level=OptionRecommendation.LOW,
|
recommended_value=False, level=OptionRecommendation.LOW,
|
||||||
help=_('Remove the first image from the input ebook. Useful if the '
|
help=_('Remove the first image from the input ebook. Useful if the '
|
||||||
|
@ -318,7 +318,8 @@ class CSSFlattener(object):
|
|||||||
for edge in ('top', 'bottom'):
|
for edge in ('top', 'bottom'):
|
||||||
cssdict['%s-%s'%(prop, edge)] = '0pt'
|
cssdict['%s-%s'%(prop, edge)] = '0pt'
|
||||||
if self.context.insert_blank_line:
|
if self.context.insert_blank_line:
|
||||||
cssdict['margin-top'] = cssdict['margin-bottom'] = '0.5em'
|
cssdict['margin-top'] = cssdict['margin-bottom'] = \
|
||||||
|
'%fem'%self.context.insert_blank_line_size
|
||||||
if self.context.remove_paragraph_spacing:
|
if self.context.remove_paragraph_spacing:
|
||||||
cssdict['text-indent'] = "%1.1fem" % self.context.remove_paragraph_spacing_indent_size
|
cssdict['text-indent'] = "%1.1fem" % self.context.remove_paragraph_spacing_indent_size
|
||||||
|
|
||||||
|
@ -24,7 +24,10 @@ class LookAndFeelWidget(Widget, Ui_Form):
|
|||||||
'font_size_mapping', 'line_height', 'minimum_line_height',
|
'font_size_mapping', 'line_height', 'minimum_line_height',
|
||||||
'linearize_tables', 'smarten_punctuation',
|
'linearize_tables', 'smarten_punctuation',
|
||||||
'disable_font_rescaling', 'insert_blank_line',
|
'disable_font_rescaling', 'insert_blank_line',
|
||||||
'remove_paragraph_spacing', 'remove_paragraph_spacing_indent_size','input_encoding',
|
'remove_paragraph_spacing',
|
||||||
|
'remove_paragraph_spacing_indent_size',
|
||||||
|
'insert_blank_line_size',
|
||||||
|
'input_encoding',
|
||||||
'asciiize', 'keep_ligatures']
|
'asciiize', 'keep_ligatures']
|
||||||
)
|
)
|
||||||
for val, text in [
|
for val, text in [
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>600</width>
|
<width>642</width>
|
||||||
<height>500</height>
|
<height>500</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -31,7 +31,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1" colspan="2">
|
<item row="1" column="1">
|
||||||
<widget class="QDoubleSpinBox" name="opt_base_font_size">
|
<widget class="QDoubleSpinBox" name="opt_base_font_size">
|
||||||
<property name="suffix">
|
<property name="suffix">
|
||||||
<string> pt</string>
|
<string> pt</string>
|
||||||
@ -97,6 +97,29 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="label_6">
|
||||||
|
<property name="text">
|
||||||
|
<string>Minimum &line height:</string>
|
||||||
|
</property>
|
||||||
|
<property name="buddy">
|
||||||
|
<cstring>opt_minimum_line_height</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QDoubleSpinBox" name="opt_minimum_line_height">
|
||||||
|
<property name="suffix">
|
||||||
|
<string> %</string>
|
||||||
|
</property>
|
||||||
|
<property name="decimals">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<double>900.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="4" column="0">
|
<item row="4" column="0">
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@ -107,7 +130,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="1" colspan="2">
|
<item row="4" column="1">
|
||||||
<widget class="QDoubleSpinBox" name="opt_line_height">
|
<widget class="QDoubleSpinBox" name="opt_line_height">
|
||||||
<property name="suffix">
|
<property name="suffix">
|
||||||
<string> pt</string>
|
<string> pt</string>
|
||||||
@ -127,6 +150,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="5" column="1" colspan="2">
|
||||||
|
<widget class="EncodingComboBox" name="opt_input_encoding">
|
||||||
|
<property name="editable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="6" column="0" colspan="2">
|
<item row="6" column="0" colspan="2">
|
||||||
<widget class="QCheckBox" name="opt_remove_paragraph_spacing">
|
<widget class="QCheckBox" name="opt_remove_paragraph_spacing">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@ -134,19 +164,70 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="2" colspan="2">
|
<item row="7" column="0" colspan="2">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<widget class="QCheckBox" name="opt_insert_blank_line">
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_4">
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Indent size:</string>
|
<string>Insert &blank line between paragraphs</string>
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="7" column="4">
|
||||||
|
<widget class="QDoubleSpinBox" name="opt_insert_blank_line_size">
|
||||||
|
<property name="suffix">
|
||||||
|
<string> em</string>
|
||||||
|
</property>
|
||||||
|
<property name="decimals">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="8" column="0">
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="text">
|
||||||
|
<string>Text &justification:</string>
|
||||||
|
</property>
|
||||||
|
<property name="buddy">
|
||||||
|
<cstring>opt_change_justification</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="8" column="2" colspan="3">
|
||||||
|
<widget class="QComboBox" name="opt_change_justification"/>
|
||||||
|
</item>
|
||||||
|
<item row="9" column="0">
|
||||||
|
<widget class="QCheckBox" name="opt_linearize_tables">
|
||||||
|
<property name="text">
|
||||||
|
<string>&Linearize tables</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="9" column="1" colspan="4">
|
||||||
|
<widget class="QCheckBox" name="opt_asciiize">
|
||||||
|
<property name="text">
|
||||||
|
<string>&Transliterate unicode characters to ASCII</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="10" column="1" colspan="2">
|
||||||
|
<widget class="QCheckBox" name="opt_keep_ligatures">
|
||||||
|
<property name="text">
|
||||||
|
<string>Keep &ligatures</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="12" column="0" colspan="5">
|
||||||
|
<widget class="QGroupBox" name="groupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Extra &CSS</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QTextEdit" name="opt_extra_css"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="4">
|
||||||
<widget class="QDoubleSpinBox" name="opt_remove_paragraph_spacing_indent_size">
|
<widget class="QDoubleSpinBox" name="opt_remove_paragraph_spacing_indent_size">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><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.</string>
|
<string><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.</string>
|
||||||
@ -159,58 +240,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="7" column="0">
|
|
||||||
<widget class="QLabel" name="label_5">
|
|
||||||
<property name="text">
|
|
||||||
<string>Text justification:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="8" column="0">
|
|
||||||
<widget class="QCheckBox" name="opt_linearize_tables">
|
|
||||||
<property name="text">
|
|
||||||
<string>&Linearize tables</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="11" column="0" colspan="4">
|
|
||||||
<widget class="QGroupBox" name="groupBox">
|
|
||||||
<property name="title">
|
|
||||||
<string>Extra &CSS</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QTextEdit" name="opt_extra_css"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="7" column="2" colspan="2">
|
|
||||||
<widget class="QComboBox" name="opt_change_justification"/>
|
|
||||||
</item>
|
|
||||||
<item row="8" column="1" colspan="3">
|
|
||||||
<widget class="QCheckBox" name="opt_asciiize">
|
|
||||||
<property name="text">
|
|
||||||
<string>&Transliterate unicode characters to ASCII</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="9" column="0">
|
|
||||||
<widget class="QCheckBox" name="opt_insert_blank_line">
|
|
||||||
<property name="text">
|
|
||||||
<string>Insert &blank line</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="9" column="1" colspan="2">
|
|
||||||
<widget class="QCheckBox" name="opt_keep_ligatures">
|
|
||||||
<property name="text">
|
|
||||||
<string>Keep &ligatures</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="10" column="0">
|
<item row="10" column="0">
|
||||||
<widget class="QCheckBox" name="opt_smarten_punctuation">
|
<widget class="QCheckBox" name="opt_smarten_punctuation">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@ -218,33 +247,29 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="6" column="3">
|
||||||
<widget class="QLabel" name="label_6">
|
<widget class="QLabel" name="label_4">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Minimum &line height:</string>
|
<string>&Indent size:</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
</property>
|
</property>
|
||||||
<property name="buddy">
|
<property name="buddy">
|
||||||
<cstring>opt_minimum_line_height</cstring>
|
<cstring>opt_remove_paragraph_spacing_indent_size</cstring>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="1" colspan="2">
|
<item row="7" column="3">
|
||||||
<widget class="QDoubleSpinBox" name="opt_minimum_line_height">
|
<widget class="QLabel" name="label_7">
|
||||||
<property name="suffix">
|
<property name="text">
|
||||||
<string> %</string>
|
<string>&Line size:</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="decimals">
|
<property name="alignment">
|
||||||
<number>1</number>
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximum">
|
<property name="buddy">
|
||||||
<double>900.000000000000000</double>
|
<cstring>opt_insert_blank_line_size</cstring>
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="1" colspan="3">
|
|
||||||
<widget class="EncodingComboBox" name="opt_input_encoding">
|
|
||||||
<property name="editable">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user