forked from LiveCarta/BookConverter
Make preprocessing of inline css
This commit is contained in:
@@ -1,17 +1,26 @@
|
||||
class LiveCartaConfig:
|
||||
"""Class of values that LiveCarta platform using and supports"""
|
||||
# tag with inline style to be updated with style attribute
|
||||
SUPPORTED_LEVELS = 5
|
||||
SUPPORTED_HEADERS = {"h1", "h2", "h3", "h4", "h5"}
|
||||
HEADERS_LEVELS = {"h1", "h2", "h3", "h4", "h5", "h6", "h7", "h8", "h9"}
|
||||
HEADERS_LEVELS = {"h1", "h2", "h3",
|
||||
"h4", "h5", "h6", "h7", "h8", "h9"}
|
||||
|
||||
DEFAULT_ALIGN_STYLE = 'left'
|
||||
|
||||
ALIGN_STYLES = ['justify', 'right', 'center', 'left']
|
||||
|
||||
# Main constant values
|
||||
DEFAULT_FONT_NAME = 'Times New Roman'
|
||||
DEFAULT_ALIGN_STYLE = 'left'
|
||||
ALIGN_STYLES = ['justify', 'right', 'center', 'left']
|
||||
|
||||
WORD_DEFAULT_FONT_SIZE = 11
|
||||
|
||||
LIVECARTA_DEFAULT_FONT_SIZE = 18
|
||||
FONT_CONVERT_RATIO = LIVECARTA_DEFAULT_FONT_SIZE / WORD_DEFAULT_FONT_SIZE
|
||||
font_correspondence_table = {
|
||||
|
||||
FONT_CONVERT_RATIO = LIVECARTA_DEFAULT_FONT_SIZE /\
|
||||
WORD_DEFAULT_FONT_SIZE
|
||||
|
||||
FONT_CORRESPONDANCE_TABLE = {
|
||||
"Arial": "arial,helvetica,sans-serif",
|
||||
"Comic Sans MS": "comic sans ms,cursive",
|
||||
"Courier New": "courier new,courier,monospace",
|
||||
@@ -61,4 +70,39 @@ class LiveCartaConfig:
|
||||
'gray': 'darkGray',
|
||||
'grey': 'darkGray',
|
||||
}
|
||||
|
||||
INDENT = '30px'
|
||||
|
||||
sizes_pr = [-100, -1, 0.5, 0.56, 0.63, 0.69, 0.75, 0.81, 0.88, 0.94, 1.0,
|
||||
1.06, 1.13, 1.19, 1.25, 1.31, 1.38, 1.44, 1.5, 1.56, 1.63, 1.69,
|
||||
1.75, 1.81, 1.88, 1.94, 2.0, 2.06, 2.13, 2.19, 2.25, 2.31, 2.38,
|
||||
2.44, 2.5, 2.56, 2.63, 2.69, 2.75, 2.81, 2.88, 2.94, 3.0, 4.0, 5.0]
|
||||
|
||||
sizes_px = ['0px', '10px', '10px', '11px', '12px', '13px', '14px', '15px', '16px',
|
||||
'17px', '18px', '19px', '20px', '21px', '22px', '23px', '24px', '25px',
|
||||
'26px', '27px', '28px', '29px', '30px', '31px', '32px', '33px', '34px',
|
||||
'35px', '36px', '37px', '38px', '39px', '40px', '41px', '42px', '43px',
|
||||
'44px', '45px', '46px', '47px', '48px', '49px', '50px', '64px', '72px']
|
||||
|
||||
list_types = ['circle', 'disc', 'armenian', 'decimal',
|
||||
'decimal-leading-zero', 'georgian', 'lower-alpha', 'lower-latin',
|
||||
'lower-roman', 'upper-alpha', 'upper-latin', 'upper-roman', 'none']
|
||||
|
||||
"""
|
||||
LIVECARTA_STYLE_ATTRS_SHOULD_BE_TAG = { (property, value): tag }
|
||||
|
||||
<p style="font-weight:600> foo </p> -> <p><strong>foo</strong></p>
|
||||
"""
|
||||
LIVECARTA_STYLE_ATTRS_SHOULD_BE_TAG = {
|
||||
('font-weight', 'bold'): 'strong',
|
||||
('font-weight', '600'): 'strong',
|
||||
('font-weight', '700'): 'strong',
|
||||
('font-weight', '800'): 'strong',
|
||||
('font-weight', '900'): 'strong',
|
||||
('font-style', 'italic'): 'i',
|
||||
('text-decoration', 'underline'): 'u',
|
||||
('text-decoration', 'line-through'): 's',
|
||||
('text-decoration-line', 'underline'): 'u',
|
||||
('text-decoration-line', 'line-through'): 's',
|
||||
('vertical-align', 'super'): 'sup'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user