mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Implement --minimum-indent option
This commit is contained in:
parent
37858148b8
commit
6deb890595
@ -123,6 +123,8 @@ def option_parser(usage, gui_mode=False):
|
||||
help=_('Override the CSS. Can be either a path to a CSS stylesheet or a string. If it is a string it is interpreted as CSS.'))
|
||||
laf.add_option('--use-spine', default=False, dest='use_spine', action='store_true',
|
||||
help=_('Use the <spine> element from the OPF file to determine the order in which the HTML files are appended to the LRF. The .opf file must be in the same directory as the base HTML file.'))
|
||||
laf.add_option('--minimum-indent', default=0, type='float',
|
||||
help='Minimum paragraph indent (the indent of the first line of a paragraph) in pts. Default: %default')
|
||||
laf.add_option('--font-delta', action='store', type='float', default=0., \
|
||||
help=_("""Increase the font size by 2 * FONT_DELTA pts and """
|
||||
'''the line spacing by FONT_DELTA pts. FONT_DELTA can be a fraction.'''
|
||||
|
@ -1200,8 +1200,8 @@ class HTMLConverter(object):
|
||||
indent = self.unit_convert(str(tag_css['text-indent']), pts=True)
|
||||
if not indent:
|
||||
indent = 0
|
||||
if hasattr(self, 'minimum_indent') and indent > 0 and indent < self.minimum_indent:
|
||||
indent = self.minimum_indent
|
||||
if indent > 0 and indent < 10 * self.minimum_indent:
|
||||
indent = int(10 * self.minimum_indent)
|
||||
|
||||
fp = self.font_properties(tag_css)[0]
|
||||
fp['parindent'] = indent
|
||||
|
@ -90,7 +90,8 @@ def process_file(path, options, logger=None):
|
||||
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.minimum_indent = 100
|
||||
if options.minimum_indent == 0:
|
||||
options.minimum_indent = 10
|
||||
options.use_spine = True
|
||||
|
||||
html_process_file(htmlfile, options, logger=logger)
|
||||
|
@ -562,7 +562,7 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<item row="2" column="0" >
|
||||
<widget class="QLabel" name="label_9" >
|
||||
<property name="text" >
|
||||
<string>&Word spacing:</string>
|
||||
@ -575,7 +575,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2" >
|
||||
<item row="2" column="1" colspan="2" >
|
||||
<widget class="QDoubleSpinBox" name="gui_wordspace" >
|
||||
<property name="buttonSymbols" >
|
||||
<enum>QAbstractSpinBox::PlusMinus</enum>
|
||||
@ -600,28 +600,28 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="4" >
|
||||
<item row="3" column="0" colspan="4" >
|
||||
<widget class="QCheckBox" name="gui_autorotation" >
|
||||
<property name="text" >
|
||||
<string>Enable auto &rotation of images</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="4" >
|
||||
<item row="4" column="0" colspan="4" >
|
||||
<widget class="QCheckBox" name="gui_blank_after_para" >
|
||||
<property name="text" >
|
||||
<string>Insert &blank lines between paragraphs</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="4" >
|
||||
<item row="5" column="0" colspan="4" >
|
||||
<widget class="QCheckBox" name="gui_ignore_tables" >
|
||||
<property name="text" >
|
||||
<string>Ignore &tables</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="2" >
|
||||
<item row="6" column="0" colspan="2" >
|
||||
<widget class="QLabel" name="label_16" >
|
||||
<property name="text" >
|
||||
<string>&Preprocess:</string>
|
||||
@ -631,10 +631,10 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="3" colspan="3" >
|
||||
<item row="6" column="3" colspan="3" >
|
||||
<widget class="QComboBox" name="preprocess" />
|
||||
</item>
|
||||
<item row="6" column="0" colspan="6" >
|
||||
<item row="7" column="0" colspan="6" >
|
||||
<widget class="QGroupBox" name="groupBox_5" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Minimum" hsizetype="Preferred" >
|
||||
@ -669,16 +669,39 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="2" >
|
||||
<item row="8" column="0" colspan="2" >
|
||||
<widget class="QLabel" name="label_21" >
|
||||
<property name="text" >
|
||||
<string>Override<br>CSS</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="2" colspan="4" >
|
||||
<item row="8" column="2" colspan="4" >
|
||||
<widget class="QTextEdit" name="gui_override_css" />
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="label_25" >
|
||||
<property name="text" >
|
||||
<string>Minimum &indent:</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>gui_minimum_indent</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QDoubleSpinBox" name="gui_minimum_indent" >
|
||||
<property name="buttonSymbols" >
|
||||
<enum>QAbstractSpinBox::PlusMinus</enum>
|
||||
</property>
|
||||
<property name="suffix" >
|
||||
<string> pts</string>
|
||||
</property>
|
||||
<property name="decimals" >
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="pagesetup_page" >
|
||||
@ -926,8 +949,8 @@
|
||||
<property name="html" >
|
||||
<string><html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'DejaVu Sans'; font-size:9pt; font-weight:400; font-style:normal;">
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif';"></p></body></html></string>
|
||||
</style></head><body style=" font-family:'DejaVu Sans'; font-size:10pt; font-weight:400; font-style:normal;">
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;"></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
Loading…
x
Reference in New Issue
Block a user