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),
|
('margin_bottom', 0, OptionRecommendation.HIGH),
|
||||||
('insert_blank_line', False, OptionRecommendation.HIGH),
|
('insert_blank_line', False, OptionRecommendation.HIGH),
|
||||||
('remove_paragraph_spacing', 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),
|
('dont_split_on_pagebreaks', True, OptionRecommendation.HIGH),
|
||||||
('chapter', None, OptionRecommendation.HIGH),
|
('chapter', None, OptionRecommendation.HIGH),
|
||||||
('page_breaks_brefore', None, OptionRecommendation.HIGH),
|
('page_breaks_brefore', None, OptionRecommendation.HIGH),
|
||||||
|
@ -124,7 +124,7 @@ def add_pipeline_options(parser, plumber):
|
|||||||
'linearize_tables',
|
'linearize_tables',
|
||||||
'extra_css',
|
'extra_css',
|
||||||
'margin_top', 'margin_left', 'margin_right',
|
'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',
|
'insert_blank_line', 'remove_paragraph_spacing','remove_paragraph_spacing_indent_size',
|
||||||
'asciiize', 'remove_header', 'header_regex',
|
'asciiize', 'remove_header', 'header_regex',
|
||||||
'remove_footer', 'footer_regex',
|
'remove_footer', 'footer_regex',
|
||||||
|
@ -299,12 +299,16 @@ OptionRecommendation(name='margin_right',
|
|||||||
help=_('Set the right margin in pts. Default is %default. '
|
help=_('Set the right margin in pts. Default is %default. '
|
||||||
'Note: 72 pts equals 1 inch')),
|
'Note: 72 pts equals 1 inch')),
|
||||||
|
|
||||||
OptionRecommendation(name='dont_justify',
|
OptionRecommendation(name='change_justification',
|
||||||
recommended_value=False, level=OptionRecommendation.LOW,
|
recommended_value='original', level=OptionRecommendation.LOW,
|
||||||
help=_('Do not force text to be justified in output. Whether text '
|
choices=['left','justify','original'],
|
||||||
'is actually displayed justified or not depends on whether '
|
help=_('Change text justification. A value of "left" converts all'
|
||||||
'the ebook format and reading device support justification.')
|
' 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',
|
OptionRecommendation(name='remove_paragraph_spacing',
|
||||||
recommended_value=False, level=OptionRecommendation.LOW,
|
recommended_value=False, level=OptionRecommendation.LOW,
|
||||||
|
@ -130,7 +130,7 @@ class LRFOutput(OutputFormatPlugin):
|
|||||||
])
|
])
|
||||||
|
|
||||||
recommendations = set([
|
recommendations = set([
|
||||||
('dont_justify', True, OptionRecommendation.HIGH),
|
('change_justification', 'original', OptionRecommendation.HIGH),
|
||||||
])
|
])
|
||||||
|
|
||||||
def convert_images(self, pages, opts, wide):
|
def convert_images(self, pages, opts, wide):
|
||||||
|
@ -318,8 +318,8 @@ class Stylizer(object):
|
|||||||
if text == 'inherit':
|
if text == 'inherit':
|
||||||
style['text-align'] = 'inherit'
|
style['text-align'] = 'inherit'
|
||||||
else:
|
else:
|
||||||
if text in ('left', 'justify'):
|
if text in ('left', 'justify') and self.opts.change_justification in ('left', 'justify'):
|
||||||
val = 'left' if self.opts.dont_justify else 'justify'
|
val = self.opts.change_justification
|
||||||
style['text-align'] = val
|
style['text-align'] = val
|
||||||
else:
|
else:
|
||||||
style['text-align'] = text
|
style['text-align'] = text
|
||||||
|
@ -138,8 +138,8 @@ class CSSFlattener(object):
|
|||||||
float(self.context.margin_left))
|
float(self.context.margin_left))
|
||||||
bs.append('margin-right : %fpt'%\
|
bs.append('margin-right : %fpt'%\
|
||||||
float(self.context.margin_right))
|
float(self.context.margin_right))
|
||||||
bs.append('text-align: '+ \
|
if self.context.change_justification != 'original':
|
||||||
('left' if self.context.dont_justify else 'justify'))
|
bs.append('text-align: '+ self.context.change_justification)
|
||||||
body.set('style', '; '.join(bs))
|
body.set('style', '; '.join(bs))
|
||||||
stylizer = Stylizer(html, item.href, self.oeb, self.context, profile,
|
stylizer = Stylizer(html, item.href, self.oeb, self.context, profile,
|
||||||
user_css=self.context.extra_css,
|
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):
|
def __init__(self, parent, get_option, get_help, db=None, book_id=None):
|
||||||
Widget.__init__(self, parent, 'look_and_feel',
|
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',
|
'font_size_mapping', 'line_height',
|
||||||
'linearize_tables',
|
'linearize_tables',
|
||||||
'disable_font_rescaling', 'insert_blank_line',
|
'disable_font_rescaling', 'insert_blank_line',
|
||||||
|
@ -84,7 +84,7 @@
|
|||||||
<string>...</string>
|
<string>...</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="../../../../resources/images.qrc">
|
<iconset>
|
||||||
<normaloff>:/images/wizard.svg</normaloff>:/images/wizard.svg</iconset>
|
<normaloff>:/images/wizard.svg</normaloff>:/images/wizard.svg</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
@ -181,21 +181,7 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</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">
|
<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">
|
<widget class="QCheckBox" name="opt_linearize_tables">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Linearize tables</string>
|
<string>&Linearize tables</string>
|
||||||
@ -221,6 +207,42 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources>
|
<resources>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user