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 FONT_CORRESPONDANCE_TABLE = { "Arial": "arial,helvetica,sans-serif", "Comic Sans MS": "comic sans ms,cursive", "Courier New": "courier new,courier,monospace", "Georgia": "georgia,serif", "Lucida Sans Unicode": "lucida sans unicode,lucida grande,sans-serif", "Tahoma": "tahoma,geneva,sans-serif", "Times New Roman": "times new roman,times,serif", "Trebuchet MS": "trebuchet ms,helvetica,sans-serif", "Verdana": "verdana,geneva,sans-serif", "monospace": "courier new,courier,monospace", "sans-serif": "arial,helvetica,sans-serif" } 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" 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"] 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 }