forked from LiveCarta/BookConverter
css processing formatting
This commit is contained in:
@@ -101,25 +101,39 @@ class LiveCartaConfig:
|
||||
r"(^h[1-9]$)": ["list-style-type"]
|
||||
}
|
||||
|
||||
WRAP_TAGS_WITH_TABLE = {
|
||||
("div",): ["width", "border", "bgcolor"],
|
||||
("section", "blockquote",): ("class", r"feature[1234]"),
|
||||
}
|
||||
|
||||
"""('what to replace', 'parent tag', 'child tag')"""
|
||||
REPLACE_TAG_WITH_LIVECARTA_CORRESPOND_TAGS = {
|
||||
(r"^h[6-9]$", "^figure$", "^section$", "^div$"): "p",
|
||||
("^aside$",): "blockquote",
|
||||
("^header$", "^footer$", ("child", ":not(pre)", "code, kbd, var")): "span",
|
||||
("^b$",): "strong",
|
||||
# (("parent", ":not(pre)", "code")): "p",
|
||||
}
|
||||
|
||||
""" > == in (p in li)"""
|
||||
TAGS_TO_UNWRAP = [
|
||||
"section", "article", "figcaption", "main", "body", "html", "li > p",
|
||||
]
|
||||
|
||||
INSERT_TAG_IN_PARENT_TAG = {
|
||||
("pre", "code, kbd, var"): "code",
|
||||
"""
|
||||
Dictionary LIVECARTA_STYLE_ATTRS = { css property: value }
|
||||
Style properties that can be used to fit LiveCarta css style convention.
|
||||
If property has empty list, it means that any value can be converted.
|
||||
If property has not empty list, it means that only certain property-value combinations can be transformed.
|
||||
"""
|
||||
LIVECARTA_STYLE_ATTRS = {
|
||||
"text-indent": [],
|
||||
"font-variant": ["small-caps"],
|
||||
"text-align": [x for x in ["justify", "right", "center", "left"] if x != "left"],
|
||||
"align": [],
|
||||
"font": [],
|
||||
"font-family": [],
|
||||
"font-size": [],
|
||||
"font-weight": ["bold", "600", "700", "800", "900"], # <strong>
|
||||
"font-style": ["italic"], # <i>
|
||||
"text-decoration": ["underline", "line-through"], # <u> , <s>
|
||||
"text-decoration-line": ["underline", "line-through"], # <u> , <s>
|
||||
"vertical-align": ["super"], # <sup>
|
||||
"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": [],
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user