Implement --minimum-indent option

This commit is contained in:
Kovid Goyal 2008-01-29 21:56:12 +00:00
parent 37858148b8
commit 6deb890595
4 changed files with 41 additions and 15 deletions

View File

@ -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.'''

View File

@ -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

View File

@ -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)

View File

@ -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>&amp;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 &amp;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 &amp;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 &amp;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>&amp;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&lt;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 &amp;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>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
p, li { white-space: pre-wrap; }
&lt;/style>&lt;/head>&lt;body style=" font-family:'DejaVu Sans'; font-size:9pt; font-weight:400; font-style:normal;">
&lt;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';">&lt;/p>&lt;/body>&lt;/html></string>
&lt;/style>&lt;/head>&lt;body style=" font-family:'DejaVu Sans'; font-size:10pt; font-weight:400; font-style:normal;">
&lt;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;">&lt;/p>&lt;/body>&lt;/html></string>
</property>
</widget>
</item>