mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #4921 (CSS left alignment not working)
This commit is contained in:
commit
9e92659c05
@ -322,7 +322,7 @@ class ComicInput(InputFormatPlugin):
|
||||
('margin_bottom', 0, OptionRecommendation.HIGH),
|
||||
('insert_blank_line', False, OptionRecommendation.HIGH),
|
||||
('remove_paragraph_spacing', False, OptionRecommendation.HIGH),
|
||||
('dont_justify', True, OptionRecommendation.HIGH),
|
||||
('change_justification', 'left', OptionRecommendation.HIGH),
|
||||
('dont_split_on_pagebreaks', True, OptionRecommendation.HIGH),
|
||||
('chapter', None, OptionRecommendation.HIGH),
|
||||
('page_breaks_brefore', None, OptionRecommendation.HIGH),
|
||||
|
@ -124,7 +124,7 @@ def add_pipeline_options(parser, plumber):
|
||||
'linearize_tables',
|
||||
'extra_css',
|
||||
'margin_top', 'margin_left', 'margin_right',
|
||||
'margin_bottom', 'dont_justify',
|
||||
'margin_bottom', 'change_justification',
|
||||
'insert_blank_line', 'remove_paragraph_spacing','remove_paragraph_spacing_indent_size',
|
||||
'asciiize', 'remove_header', 'header_regex',
|
||||
'remove_footer', 'footer_regex',
|
||||
|
@ -299,12 +299,16 @@ OptionRecommendation(name='margin_right',
|
||||
help=_('Set the right margin in pts. Default is %default. '
|
||||
'Note: 72 pts equals 1 inch')),
|
||||
|
||||
OptionRecommendation(name='dont_justify',
|
||||
recommended_value=False, level=OptionRecommendation.LOW,
|
||||
help=_('Do not force text to be justified in output. Whether text '
|
||||
'is actually displayed justified or not depends on whether '
|
||||
'the ebook format and reading device support justification.')
|
||||
),
|
||||
OptionRecommendation(name='change_justification',
|
||||
recommended_value='original', level=OptionRecommendation.LOW,
|
||||
choices=['left','justify','original'],
|
||||
help=_('Change text justification. A value of "left" converts all'
|
||||
' justified text in the source to left aligned (i.e. '
|
||||
'unjustified) text. A value of "justify" converts all '
|
||||
'unjustified text to justified. A value of "original" '
|
||||
'(the default) does not change justification in the '
|
||||
'source file. Note that only some output formats support '
|
||||
'justification.')),
|
||||
|
||||
OptionRecommendation(name='remove_paragraph_spacing',
|
||||
recommended_value=False, level=OptionRecommendation.LOW,
|
||||
|
@ -130,7 +130,7 @@ class LRFOutput(OutputFormatPlugin):
|
||||
])
|
||||
|
||||
recommendations = set([
|
||||
('dont_justify', True, OptionRecommendation.HIGH),
|
||||
('change_justification', 'original', OptionRecommendation.HIGH),
|
||||
])
|
||||
|
||||
def convert_images(self, pages, opts, wide):
|
||||
|
@ -318,8 +318,8 @@ class Stylizer(object):
|
||||
if text == 'inherit':
|
||||
style['text-align'] = 'inherit'
|
||||
else:
|
||||
if text in ('left', 'justify'):
|
||||
val = 'left' if self.opts.dont_justify else 'justify'
|
||||
if text in ('left', 'justify') and self.opts.change_justification in ('left', 'justify'):
|
||||
val = self.opts.change_justification
|
||||
style['text-align'] = val
|
||||
else:
|
||||
style['text-align'] = text
|
||||
|
@ -138,8 +138,8 @@ class CSSFlattener(object):
|
||||
float(self.context.margin_left))
|
||||
bs.append('margin-right : %fpt'%\
|
||||
float(self.context.margin_right))
|
||||
bs.append('text-align: '+ \
|
||||
('left' if self.context.dont_justify else 'justify'))
|
||||
if self.context.change_justification != 'original':
|
||||
bs.append('text-align: '+ self.context.change_justification)
|
||||
body.set('style', '; '.join(bs))
|
||||
stylizer = Stylizer(html, item.href, self.oeb, self.context, profile,
|
||||
user_css=self.context.extra_css,
|
||||
|
@ -19,7 +19,7 @@ class LookAndFeelWidget(Widget, Ui_Form):
|
||||
|
||||
def __init__(self, parent, get_option, get_help, db=None, book_id=None):
|
||||
Widget.__init__(self, parent, 'look_and_feel',
|
||||
['dont_justify', 'extra_css', 'base_font_size',
|
||||
['change_justification', 'extra_css', 'base_font_size',
|
||||
'font_size_mapping', 'line_height',
|
||||
'linearize_tables',
|
||||
'disable_font_rescaling', 'insert_blank_line',
|
||||
|
@ -84,7 +84,7 @@
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../../resources/images.qrc">
|
||||
<iconset>
|
||||
<normaloff>:/images/wizard.svg</normaloff>:/images/wizard.svg</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@ -181,21 +181,7 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QCheckBox" name="opt_insert_blank_line">
|
||||
<property name="text">
|
||||
<string>Insert &blank line</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QCheckBox" name="opt_dont_justify">
|
||||
<property name="text">
|
||||
<string>No 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>
|
||||
@ -221,6 +207,42 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QCheckBox" name="opt_insert_blank_line">
|
||||
<property name="text">
|
||||
<string>Insert &blank line</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Text justification:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="2">
|
||||
<widget class="QComboBox" name="opt_change_justification">
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>justify</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>left</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>original</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
|
Loading…
x
Reference in New Issue
Block a user