import re 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"} DEFAULT_ALIGN_STYLE = "left" ALIGN_STYLES = ["justify", "right", "center", "left"] # Main constant values DEFAULT_FONT_NAME = "Times New Roman" WORD_DEFAULT_FONT_SIZE = 11 LIVECARTA_DEFAULT_FONT_SIZE = 18 FONT_CONVERT_RATIO = LIVECARTA_DEFAULT_FONT_SIZE /\ WORD_DEFAULT_FONT_SIZE COLORS_MAP = { "#ffff00": "yellow", "#00ff00": "darkYellow", "#00ffff": "cyan", "#ff00ff": "magenta", "#0000ff": "blue", "#ff0000": "red", "#000080": "darkBlue", "#008080": "darkCyan", "#008000": "green", "#800080": "darkMagenta", "#808000": "darkGreen", "#c0c0c0": "lightGray", "#ffffff": "white", "#800000": "#800000", "#808080": "#808080" } HTML42LIVECARTA_COLORS = { "yellow": "yellow", "lime": "green", "aqua": "cyan", "fuchsia": "magenta", "blue": "blue", "red": "red", "navy": "darkBlue", "teal": "darkCyan", "green": "darkGreen", "purple": "darkMagenta", "olive": "darkYellow", "silver": "lightGray", "white": "white", "maroon": "darkRed", # "#800000", "gray": "darkGray", "grey": "darkGray", } INDENT = "30px" list_types = ["circle", "disc", "armenian", "decimal", "decimal-leading-zero", "georgian", "lower-alpha", "lower-latin", "lower-roman", "upper-alpha", "upper-latin", "upper-roman", "none"] structural_tags_names = [ "div", "section", "article", "main", "body", "html", "aside", "canvas", "data", "figure", "footer", "iframe", "span", "p" ] could_have_style_in_livecarta_regexp = re.compile( "(^div$)|(^p$)|(^span$)|(^code$)|(^kbd$)|(^var$)|(^li$)|(^ul$)|(^ol$)|(^td$)|(^th$)|(^h[1-9]$)") """ LIVECARTA_STYLE_ATTRS_SHOULD_BE_TAG = { (property, value): tag }

"font-style": ["italic"], # "text-decoration": ["underline", "line-through"], # , "text-decoration-line": ["underline", "line-through"], # , "vertical-align": ["super"], # "color": [], "background-color": [], "background": [], "width": [], "border": [], "border-top-width": [], "border-right-width": [], "border-left-width": [], "border-bottom-width": [], "border-top": [], "border-bottom": [], "list-style-type": [], "list-style-image": [], "margin-left": [], "margin-top": [], "margin": [], }