diff --git a/src/config.py b/src/config.py index 8937b6e..6e14f6e 100644 --- a/src/config.py +++ b/src/config.py @@ -57,6 +57,7 @@ class LawCartaConfig: # Main constant values DEFAULT_FONT_NAME = 'Times New Roman' DEFAULT_ALIGN_STYLE = 'left' + ALIGN_STYLES = ['justify', 'right', 'center', 'left'] WORD_DEFAULT_FONT_SIZE = 11 LAWCARTA_DEFAULT_FONT_SIZE = 18 FONT_CONVERT_RATIO = LAWCARTA_DEFAULT_FONT_SIZE / WORD_DEFAULT_FONT_SIZE @@ -72,7 +73,7 @@ class LawCartaConfig: "Verdana": "verdana,geneva,sans-serif" } - COLORS = { + COLORS_MAP = { '#ffff00': 'yellow', '#00ff00': 'darkYellow', '#00ffff': 'cyan', @@ -89,6 +90,24 @@ class LawCartaConfig: '#800000': '#800000', '#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' diff --git a/src/html_preprocessor.py b/src/html_preprocessor.py index b76e739..62cec38 100644 --- a/src/html_preprocessor.py +++ b/src/html_preprocessor.py @@ -91,10 +91,10 @@ class HTMLPreprocessor: if style: style = self.convert_font_pt_to_px(style) if style != "": - if color and color in LawCartaConfig.COLORS: + if color and color in LawCartaConfig.COLORS_MAP: style += f'; color: {color};' 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};' if face is not None: