forked from LiveCarta/BookConverter
epub converter: update config.py
This commit is contained in:
@@ -57,6 +57,7 @@ class LawCartaConfig:
|
|||||||
# Main constant values
|
# Main constant values
|
||||||
DEFAULT_FONT_NAME = 'Times New Roman'
|
DEFAULT_FONT_NAME = 'Times New Roman'
|
||||||
DEFAULT_ALIGN_STYLE = 'left'
|
DEFAULT_ALIGN_STYLE = 'left'
|
||||||
|
ALIGN_STYLES = ['justify', 'right', 'center', 'left']
|
||||||
WORD_DEFAULT_FONT_SIZE = 11
|
WORD_DEFAULT_FONT_SIZE = 11
|
||||||
LAWCARTA_DEFAULT_FONT_SIZE = 18
|
LAWCARTA_DEFAULT_FONT_SIZE = 18
|
||||||
FONT_CONVERT_RATIO = LAWCARTA_DEFAULT_FONT_SIZE / WORD_DEFAULT_FONT_SIZE
|
FONT_CONVERT_RATIO = LAWCARTA_DEFAULT_FONT_SIZE / WORD_DEFAULT_FONT_SIZE
|
||||||
@@ -72,7 +73,7 @@ class LawCartaConfig:
|
|||||||
"Verdana": "verdana,geneva,sans-serif"
|
"Verdana": "verdana,geneva,sans-serif"
|
||||||
}
|
}
|
||||||
|
|
||||||
COLORS = {
|
COLORS_MAP = {
|
||||||
'#ffff00': 'yellow',
|
'#ffff00': 'yellow',
|
||||||
'#00ff00': 'darkYellow',
|
'#00ff00': 'darkYellow',
|
||||||
'#00ffff': 'cyan',
|
'#00ffff': 'cyan',
|
||||||
@@ -89,6 +90,24 @@ class LawCartaConfig:
|
|||||||
'#800000': '#800000',
|
'#800000': '#800000',
|
||||||
'#808080': '#808080'
|
'#808080': '#808080'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HTML42LIVECARTA_COLORS = {
|
||||||
|
'yellow': 'yellow',
|
||||||
|
'lime': 'darkYellow',
|
||||||
|
'aqua': 'cyan',
|
||||||
|
'fuchsia': 'magenta',
|
||||||
|
'blue': 'blue',
|
||||||
|
'red': 'red',
|
||||||
|
'navy': 'darkBlue',
|
||||||
|
'teal': 'darkCyan',
|
||||||
|
'green': 'green',
|
||||||
|
'purple': 'darkMagenta',
|
||||||
|
'olive': 'darkGreen',
|
||||||
|
'silver': 'lightGray',
|
||||||
|
'white': 'white',
|
||||||
|
'maroon': '#800000',
|
||||||
|
'gray': '#808080'
|
||||||
|
}
|
||||||
INDENT = '30px'
|
INDENT = '30px'
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -91,10 +91,10 @@ class HTMLPreprocessor:
|
|||||||
if style:
|
if style:
|
||||||
style = self.convert_font_pt_to_px(style)
|
style = self.convert_font_pt_to_px(style)
|
||||||
if style != "":
|
if style != "":
|
||||||
if color and color in LawCartaConfig.COLORS:
|
if color and color in LawCartaConfig.COLORS_MAP:
|
||||||
style += f'; color: {color};'
|
style += f'; color: {color};'
|
||||||
font.attrs["style"] = style
|
font.attrs["style"] = style
|
||||||
elif color and color in LawCartaConfig.COLORS:
|
elif color and color in LawCartaConfig.COLORS_MAP:
|
||||||
font.attrs["style"] = f'color: {color};'
|
font.attrs["style"] = f'color: {color};'
|
||||||
|
|
||||||
if face is not None:
|
if face is not None:
|
||||||
|
|||||||
Reference in New Issue
Block a user