Change presets.json (add attr_replacer)

This commit is contained in:
Kiryl
2022-07-20 15:47:37 +03:00
parent ea4dd77155
commit 618d57767d

View File

@@ -2,94 +2,112 @@
{ {
"preset_name": "table_wrapper", "preset_name": "table_wrapper",
"rules": [ "rules": [
{ {
"tags": ["div"], "tags": ["div"],
"attrs": [ "attrs": [
{ {
"name": "width", "name": "width",
"value": ".*" "value": ".*"
}, },
{ {
"name": "border", "name": "border",
"value": ".*" "value": ".*"
}, },
{ {
"name": "bgcolor", "name": "bgcolor",
"value": ".*" "value": ".*"
} }
] ]
}, },
{ {
"tags": ["section", "blockquote"], "tags": ["section", "blockquote"],
"attrs": [ "attrs": [
{ {
"name": "class", "name": "class",
"value": "feature[1234]" "value": "feature[1234]"
} }
] ]
} }
] ]
}, },
{ {
"preset_name": "replacer", "preset_name": "replacer",
"rules": [ "rules": [
{ {
"tags": ["^h[6-9]$", "^figure$", "^section$", "^div$"], "tags": ["^h[6-9]$", "^figure$", "^section$", "^div$"],
"condition": null, "condition": null,
"tag_to_replace": "p" "tag_to_replace": "p"
},
{
"tags": ["^aside$"],
"condition": null,
"tag_to_replace": "blockquote"
},
{
"tags": ["^header$", "^footer$"],
"condition": null,
"tag_to_replace": "span"
},
{
"tags": ["^code$", "^kbd$", "^var$"],
"condition": {
"parent_tags": ":not(pre)",
"child_tags": null,
"attrs": null
}, },
"tag_to_replace": "span" {
}, "tags": ["^aside$"],
{ "condition": null,
"tags": ["^b$"], "tag_to_replace": "blockquote"
"condition": null, },
"tag_to_replace": "strong" {
} "tags": ["^header$", "^footer$"],
] "condition": null,
"tag_to_replace": "span"
},
{
"tags": ["^code$", "^kbd$", "^var$"],
"condition": {
"parent_tags": ":not(pre)",
"child_tags": null,
"attrs": null
},
"tag_to_replace": "span"
},
{
"tags": ["^b$"],
"condition": null,
"tag_to_replace": "strong"
},
{
"tags": ["^image$"],
"condition": null,
"tag_to_replace": "img"
}
]
},
{
"preset_name": "attr_replacer",
"rules": [
{
"attr": "xlink:href",
"condition": {
"tags": ["img"]
},
"attr_to_replace": "src"
}
]
}, },
{ {
"preset_name": "unwrapper", "preset_name": "unwrapper",
"rules": { "rules": {
"tags": [ "tags": [
"section", "section",
"article", "article",
"figcaption", "figcaption",
"main", "main",
"body", "body",
"html", "html",
"li > p" "svg",
"li > p"
] ]
} }
}, },
{ {
"preset_name": "inserter", "preset_name": "inserter",
"rules": [ "rules": [
{ {
"tags": ["pre"], "tags": ["pre"],
"condition": { "condition": {
"parent_tags": null, "parent_tags": null,
"child_tags": ":not(code, kbd, var)", "child_tags": ":not(code, kbd, var)",
"attrs": null "attrs": null
}, },
"tag_to_insert": "code" "tag_to_insert": "code"
} }
] ]
} }
] ]