use phf::{phf_map, phf_set};
use crate::collections::{
ANIMATION, ANIMATION_ADDITION, ANIMATION_ATTRIBUTE_TARGET, ANIMATION_EVENT, ANIMATION_TIMING,
ANIMATION_VALUE, CONDITIONAL_PROCESSING, CORE, DESCRIPTIVE, DOCUMENT_EVENT, FILTER_PRIMITIVE,
GRAPHICAL_EVENT, LIGHT_SOURCE, PAINT_SERVER, PRESENTATION, SHAPE, STRUCTURAL,
TEXT_CONTENT_CHILD, TRANSFER_FUNCTION, X_LINK,
};
pub struct AllowedContent {
pub attrs_groups: &'static [&'static phf::Set<&'static str>],
pub attrs: Option<phf::Set<&'static str>>,
pub defaults: Option<phf::Map<&'static str, &'static str>>,
pub deprecated_safe: Option<phf::Set<&'static str>>,
pub deprecated_unsafe: Option<phf::Set<&'static str>>,
pub content_groups: Option<&'static [&'static phf::Set<&'static str>]>,
pub content: Option<phf::Set<&'static str>>,
}
pub static ELEMS: phf::Map<&'static str, AllowedContent> = phf_map! {
"a" => AllowedContent {
attrs_groups: &[
&CONDITIONAL_PROCESSING,
&CORE,
&GRAPHICAL_EVENT,
&PRESENTATION,
&X_LINK,
],
attrs: Some(phf_set!(
"class",
"externalResourcesRequired",
"style",
"target",
"transform",
)),
defaults: Some(phf_map!{"target" => "_self"}),
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: Some(&[
&ANIMATION,
&DESCRIPTIVE,
&PAINT_SERVER,
&SHAPE,
&STRUCTURAL,
]),
content: Some(phf_set!(
"a",
"altGlyphDef",
"clipPath",
"color-profile",
"cursor",
"filter",
"font-face",
"font",
"foreignObject",
"image",
"marker",
"mask",
"pattern",
"script",
"style",
"switch",
"text",
"view",
"tspan",
)),
},
"altGlyph" => AllowedContent {
attrs_groups: &[
&CONDITIONAL_PROCESSING,
&CORE,
&GRAPHICAL_EVENT,
&PRESENTATION,
&X_LINK,
],
attrs: Some(phf_set!(
"class",
"dx",
"dy",
"externalResourcesRequired",
"format",
"glyphRef",
"rotate",
"style",
"x",
"y",
)),
defaults: None,
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: None,
content: None,
},
"altGlyphDef" => AllowedContent {
attrs_groups: &[&CORE],
attrs: None,
defaults: None,
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: None,
content: Some(phf_set!("glyphRef")),
},
"altGlyphItem" => AllowedContent {
attrs_groups: &[&CORE],
attrs: None,
defaults: None,
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: None,
content: Some(phf_set!("glyphRef", "altGlyphItem")),
},
"animate" => AllowedContent {
attrs_groups: &[
&ANIMATION_ADDITION,
&ANIMATION_ATTRIBUTE_TARGET,
&ANIMATION_EVENT,
&ANIMATION_TIMING,
&ANIMATION_VALUE,
&CONDITIONAL_PROCESSING,
&CORE,
&PRESENTATION,
&X_LINK,
],
attrs: Some(phf_set!("externalResourcesRequired")),
defaults: None,
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: Some(&[&DESCRIPTIVE]),
content: None,
},
"animateColor" => AllowedContent {
attrs_groups: &[
&ANIMATION_ADDITION,
&ANIMATION_ATTRIBUTE_TARGET,
&ANIMATION_EVENT,
&ANIMATION_TIMING,
&ANIMATION_VALUE,
&CONDITIONAL_PROCESSING,
&CORE,
&PRESENTATION,
&X_LINK,
],
attrs: Some(phf_set!("externalResourcesRequired")),
defaults: None,
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: Some(&[&DESCRIPTIVE]),
content: None,
},
"animateMotion" => AllowedContent {
attrs_groups: &[
&ANIMATION_ADDITION,
&ANIMATION_EVENT,
&ANIMATION_TIMING,
&ANIMATION_VALUE,
&CONDITIONAL_PROCESSING,
&CORE,
&X_LINK,
],
attrs: Some(phf_set!(
"externalResourcesRequired",
"keyPoints",
"origin",
"path",
"rotate",
)),
defaults: Some(phf_map!{"rotate" => "0"}),
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: Some(&[&DESCRIPTIVE]),
content: Some(phf_set!("mpath")),
},
"animateTransform" => AllowedContent {
attrs_groups: &[
&ANIMATION_ADDITION,
&ANIMATION_ATTRIBUTE_TARGET,
&ANIMATION_EVENT,
&ANIMATION_TIMING,
&ANIMATION_VALUE,
&CONDITIONAL_PROCESSING,
&CORE,
&X_LINK,
],
attrs: Some(phf_set!("externalResourcesRequired", "type")),
defaults: None,
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: Some(&[&DESCRIPTIVE]),
content: None,
},
"circle" => AllowedContent {
attrs_groups: &[
&CONDITIONAL_PROCESSING,
&CORE,
&GRAPHICAL_EVENT,
&PRESENTATION,
],
attrs: Some(phf_set!(
"class",
"cx",
"cy",
"externalResourcesRequired",
"r",
"style",
"transform",
)),
defaults: Some(phf_map!{"cx" => "0", "cy" => "0"}),
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: Some(&[
&ANIMATION,
&DESCRIPTIVE
]),
content: None,
},
"clipPath" => AllowedContent {
attrs_groups: &[
&CONDITIONAL_PROCESSING,
&CORE,
&PRESENTATION
],
attrs: Some(phf_set!(
"class",
"clipPathUnits",
"externalResourcesRequired",
"style",
"transform",
)),
defaults: Some(phf_map!{"clipPathUnits" => "userSpaceOnUse"}),
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: Some(&[
&ANIMATION,
&DESCRIPTIVE,
&SHAPE
]),
content: Some(phf_set!("text", "use")),
},
"color-profile" => AllowedContent {
attrs_groups: &[&CORE, &X_LINK],
attrs: Some(phf_set!("local", "name", "rendering-intent")),
defaults: Some(phf_map!{
"name" => "sRGB",
"rendering-intent" => "auto",
}),
deprecated_safe: None,
deprecated_unsafe: Some(phf_set!("name")),
content_groups: Some(&[&DESCRIPTIVE]),
content: None,
},
"cursor" => AllowedContent {
attrs_groups: &[
&CORE,
&CONDITIONAL_PROCESSING,
&X_LINK
],
attrs: Some(phf_set!("externalResourcesRequired", "x", "y")),
defaults: Some(phf_map!{"x" => "0", "y" => "0"}),
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: Some(&[&DESCRIPTIVE]),
content: None,
},
"defs" => AllowedContent {
attrs_groups: &[
&CONDITIONAL_PROCESSING,
&CORE,
&GRAPHICAL_EVENT,
&PRESENTATION,
],
attrs: Some(phf_set!(
"class",
"externalResourcesRequired",
"style",
"transform",
)),
defaults: None,
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: Some(&[
&ANIMATION,
&DESCRIPTIVE,
&PAINT_SERVER,
&SHAPE,
&STRUCTURAL,
]),
content: Some(phf_set!(
"a",
"altGlyphDef",
"clipPath",
"color-profile",
"cursor",
"filter",
"font-face",
"font",
"foreignObject",
"image",
"marker",
"mask",
"pattern",
"script",
"style",
"switch",
"text",
"view",
)),
},
"desc" => AllowedContent {
attrs_groups: &[&CORE],
attrs: Some(phf_set!("class", "style")),
defaults: None,
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: None,
content: None,
},
"ellipse" => AllowedContent {
attrs_groups: &[
&CONDITIONAL_PROCESSING,
&CORE,
&GRAPHICAL_EVENT,
&PRESENTATION,
],
attrs: Some(phf_set!(
"class",
"cx",
"cy",
"externalResourcesRequired",
"rx",
"ry",
"style",
"transform",
)),
defaults: Some(phf_map!{"cx" => "0", "cy" => "0"}),
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: Some(&[
&ANIMATION,
&DESCRIPTIVE
]),
content: None,
},
"feBlend" => AllowedContent {
attrs_groups: &[
&CORE,
&PRESENTATION,
&FILTER_PRIMITIVE
],
attrs: Some(phf_set!("class", "style", "in", "in2", "mode")),
defaults: Some(phf_map!{"mode" => "normal"}),
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: None,
content: Some(phf_set!("animate", "set")),
},
"feColorMatrix" => AllowedContent {
attrs_groups: &[
&CORE,
&PRESENTATION,
&FILTER_PRIMITIVE
],
attrs: Some(phf_set!("class", "style", "in", "type", "values")),
defaults: Some(phf_map!{"type" => "matrix"}),
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: None,
content: Some(phf_set!("animate", "set")),
},
"feComponentTransfer" => AllowedContent {
attrs_groups: &[
&CORE,
&PRESENTATION,
&FILTER_PRIMITIVE
],
attrs: Some(phf_set!("class", "style", "in")),
defaults: None,
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: None,
content: Some(phf_set!("feFuncA", "feFuncB", "feFuncG", "feFuncR")),
},
"feComposite" => AllowedContent {
attrs_groups: &[
&CORE,
&PRESENTATION,
&FILTER_PRIMITIVE
],
attrs: Some(phf_set!(
"class", "in", "in2", "k1", "k2", "k3", "k4", "operator", "style",
)),
defaults: Some(phf_map!{
"operator" => "over",
"k1" => "0",
"k2" => "0",
"k3" => "0",
"k4" => "0",
}),
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: None,
content: Some(phf_set!("animate", "set")),
},
"feConvolveMatrix" => AllowedContent {
attrs_groups: &[
&CORE,
&PRESENTATION,
&FILTER_PRIMITIVE
],
attrs: Some(phf_set!(
"class",
"in",
"kernelMatrix",
"order",
"style",
"bias",
"divisor",
"edgeMode",
"targetX",
"targetY",
"kernelUnitLength",
"preserveAlpha",
)),
defaults: Some(phf_map!{
"order" => "3",
"bias" => "0",
"edgeMode" => "duplicate",
"preserveAlpha" => "false",
}),
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: None,
content: Some(phf_set!("animate", "set")),
},
"feDiffuseLighting" => AllowedContent {
attrs_groups: &[
&CORE,
&PRESENTATION,
&FILTER_PRIMITIVE
],
attrs: Some(phf_set!(
"class",
"diffuseConstant",
"in",
"kernelUnitLength",
"style",
"surfaceScale",
)),
defaults: Some(phf_map!{
"surfaceScale" => "1",
"diffuseConstant" => "1",
}),
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: Some(&[&DESCRIPTIVE]),
content: Some(phf_set!(
"feDistantLight",
"fePointLight",
"feSpotLight",
)),
},
"feDisplacementMap" => AllowedContent {
attrs_groups: &[
&CORE,
&PRESENTATION,
&FILTER_PRIMITIVE
],
attrs: Some(phf_set!(
"class",
"in",
"in2",
"scale",
"style",
"xChannelSelector",
"yChannelSelector",
)),
defaults: Some(phf_map!{
"scale" => "0",
"xChannelSelector" => "A",
"yChannelSelector" => "A",
}),
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: None,
content: Some(phf_set!("animate", "set")),
},
"feDistantLight" => AllowedContent {
attrs_groups: &[&CORE],
attrs: Some(phf_set!("azimuth", "elevation")),
defaults: Some(phf_map!{"azimuth" => "0", "elevation" => "0"}),
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: None,
content: Some(phf_set!("animate", "set")),
},
"feFlood" => AllowedContent {
attrs_groups: &[
&CORE,
&PRESENTATION,
&FILTER_PRIMITIVE
],
attrs: Some(phf_set!("class", "style")),
defaults: None,
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: None,
content: Some(phf_set!("animate", "animateColor", "set")),
},
"feFuncA" => AllowedContent {
attrs_groups: &[&CORE, &TRANSFER_FUNCTION],
attrs: None,
defaults: None,
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: None,
content: Some(phf_set!("set", "animate")),
},
"feFuncB" => AllowedContent {
attrs_groups: &[&CORE, &TRANSFER_FUNCTION],
attrs: None,
defaults: None,
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: None,
content: Some(phf_set!("set", "animate")),
},
"feFuncG" => AllowedContent {
attrs_groups: &[&CORE, &TRANSFER_FUNCTION],
attrs: None,
defaults: None,
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: None,
content: Some(phf_set!("set", "animate")),
},
"feFuncR" => AllowedContent {
attrs_groups: &[&CORE, &TRANSFER_FUNCTION],
attrs: None,
defaults: None,
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: None,
content: Some(phf_set!("set", "animate")),
},
"feGaussianBlur" => AllowedContent {
attrs_groups: &[
&CORE,
&PRESENTATION,
&FILTER_PRIMITIVE
],
attrs: Some(phf_set!("class", "style", "in", "stdDeviation")),
defaults: Some(phf_map!{"stdDeviation" => "0"}),
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: None,
content: Some(phf_set!("set", "animate")),
},
"feImage" => AllowedContent {
attrs_groups: &[
&CORE,
&PRESENTATION,
&FILTER_PRIMITIVE,
&X_LINK
],
attrs: Some(phf_set!(
"class",
"externalResourcesRequired",
"href",
"preserveAspectRatio",
"style",
"xlink:href",
)),
defaults: Some(phf_map!{"preserveAspectRatio" => "xMidYMid meet"}),
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: None,
content: Some(phf_set!("animate", "animateTransform", "set")),
},
"feMerge" => AllowedContent {
attrs_groups: &[
&CORE,
&PRESENTATION,
&FILTER_PRIMITIVE
],
attrs: Some(phf_set!("class", "style")),
defaults: None,
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: None,
content: Some(phf_set!("feMergeNode")),
},
"feMergeNode" => AllowedContent {
attrs_groups: &[&CORE],
attrs: Some(phf_set!("in")),
defaults: None,
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: None,
content: Some(phf_set!("animate", "set")),
},
"feMorphology" => AllowedContent {
attrs_groups: &[
&CORE,
&PRESENTATION,
&FILTER_PRIMITIVE
],
attrs: Some(phf_set!(
"class", "style", "in", "operator", "radius",
)),
defaults: Some(phf_map!{"operator" => "erode", "radius" => "0"}),
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: None,
content: Some(phf_set!("animate", "set")),
},
"feOffset" => AllowedContent {
attrs_groups: &[
&CORE,
&PRESENTATION,
&FILTER_PRIMITIVE
],
attrs: Some(phf_set!("class", "style", "in", "dx", "dy")),
defaults: Some(phf_map!{"dx" => "0", "dy" => "0"}),
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: None,
content: Some(phf_set!("animate", "set")),
},
"fePointLight" => AllowedContent {
attrs_groups: &[&CORE],
attrs: Some(phf_set!("x", "y", "z")),
defaults: Some(phf_map!{"x" => "0", "y" => "0", "z" => "0"}),
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: None,
content: Some(phf_set!("animate", "set")),
},
"feSpecularLighting" => AllowedContent {
attrs_groups: &[
&CORE,
&PRESENTATION,
&FILTER_PRIMITIVE
],
attrs: Some(phf_set!(
"class",
"in",
"kernelUnitLength",
"specularConstant",
"specularExponent",
"style",
"surfaceScale",
)),
defaults: Some(phf_map!{
"surfaceScale" => "1",
"specularConstant" => "1",
"specularExponent" => "1",
}),
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: Some(&[
&DESCRIPTIVE,
&LIGHT_SOURCE
]),
content: None,
},
"feSpotLight" => AllowedContent {
attrs_groups: &[&CORE],
attrs: Some(phf_set!(
"limitingConeAngle",
"pointsAtX",
"pointsAtY",
"pointsAtZ",
"specularExponent",
"x",
"y",
"z",
)),
defaults: Some(phf_map!{
"x" => "0",
"y" => "0",
"z" => "0",
"pointsAtX" => "0",
"pointsAtY" => "0",
"pointsAtZ" => "0",
"specularExponent" => "1",
}),
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: None,
content: Some(phf_set!("animate", "set")),
},
"feTile" => AllowedContent {
attrs_groups: &[
&CORE,
&PRESENTATION,
&FILTER_PRIMITIVE
],
attrs: Some(phf_set!("class", "style", "in")),
defaults: None,
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: None,
content: Some(phf_set!("animate", "set")),
},
"feTurbulence" => AllowedContent {
attrs_groups: &[
&CORE,
&PRESENTATION,
&FILTER_PRIMITIVE
],
attrs: Some(phf_set!(
"baseFrequency",
"class",
"numOctaves",
"seed",
"stitchTiles",
"style",
"type",
)),
defaults: Some(phf_map!{
"baseFrequency" => "0",
"numOctaves" => "1",
"seed" => "0",
"stitchTiles" => "noStitch",
"type" => "turbulence",
}),
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: None,
content: Some(phf_set!("animate", "set")),
},
"filter" => AllowedContent {
attrs_groups: &[
&CORE,
&PRESENTATION,
&X_LINK
],
attrs: Some(phf_set!(
"class",
"externalResourcesRequired",
"filterRes",
"filterUnits",
"height",
"href",
"primitiveUnits",
"style",
"width",
"x",
"xlink:href",
"y",
)),
defaults: Some(phf_map!{
"primitiveUnits" => "userSpaceOnUse",
"x" => "-10%",
"y" => "-10%",
"width" => "120%",
"height" => "120%",
}),
deprecated_safe: None,
deprecated_unsafe: Some(phf_set!("filterRes")),
content_groups: Some(&[
&DESCRIPTIVE,
&FILTER_PRIMITIVE
]),
content: Some(phf_set!("animate", "set")),
},
"font" => AllowedContent {
attrs_groups: &[&CORE, &PRESENTATION],
attrs: Some(phf_set!(
"class",
"externalResourcesRequired",
"horiz-adv-x",
"horiz-origin-x",
"horiz-origin-y",
"style",
"vert-adv-y",
"vert-origin-x",
"vert-origin-y",
)),
defaults: Some(phf_map!{
"horiz-origin-x" => "0",
"horiz-origin-y" => "0",
}),
deprecated_safe: None,
deprecated_unsafe: Some(phf_set!(
"horiz-origin-x",
"horiz-origin-y",
"vert-adv-y",
"vert-origin-x",
"vert-origin-y",
)),
content_groups: Some(&[&DESCRIPTIVE]),
content: Some(phf_set!(
"font-face",
"glyph",
"hkern",
"missing-glyph",
"vkern",
)),
},
"font-face" => AllowedContent {
attrs_groups: &[&CORE],
attrs: Some(phf_set!(
"font-family",
"font-style",
"font-variant",
"font-weight",
"font-stretch",
"font-size",
"unicode-range",
"units-per-em",
"panose-1",
"stemv",
"stemh",
"slope",
"cap-height",
"x-height",
"accent-height",
"ascent",
"descent",
"widths",
"bbox",
"ideographic",
"alphabetic",
"mathematical",
"hanging",
"v-ideographic",
"v-alphabetic",
"v-mathematical",
"v-hanging",
"underline-position",
"underline-thickness",
"strikethrough-position",
"strikethrough-thickness",
"overline-position",
"overline-thickness",
)),
defaults: Some(phf_map!{
"font-style" => "all",
"font-variant" => "normal",
"font-weight" => "all",
"font-stretch" => "normal",
"unicode-range" => "U+0-10FFFF",
"units-per-em" => "1000",
"panose-1" => "0 0 0 0 0 0 0 0 0 0",
"slope" => "0",
}),
deprecated_safe: None,
deprecated_unsafe: Some(phf_set!(
"accent-height",
"alphabetic",
"ascent",
"bbox",
"cap-height",
"descent",
"hanging",
"ideographic",
"mathematical",
"panose-1",
"slope",
"stemh",
"stemv",
"unicode-range",
"units-per-em",
"v-alphabetic",
"v-hanging",
"v-ideographic",
"v-mathematical",
"widths",
"x-height",
)),
content_groups: Some(&[&DESCRIPTIVE]),
content: Some(phf_set!("font-face-src")),
},
"font-face-format" => AllowedContent {
attrs_groups: &[&CORE],
attrs: Some(phf_set!("string")),
defaults: None,
deprecated_safe: None,
deprecated_unsafe: Some(phf_set!("string")),
content_groups: None,
content: None,
},
"font-face-name" => AllowedContent {
attrs_groups: &[&CORE],
attrs: Some(phf_set!("name")),
defaults: None,
deprecated_safe: None,
deprecated_unsafe: Some(phf_set!("name")),
content_groups: None,
content: None,
},
"font-face-src" => AllowedContent {
attrs_groups: &[&CORE],
attrs: None,
defaults: None,
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: None,
content: Some(phf_set!("font-face-name", "font-face-uri")),
},
"font-face-uri" => AllowedContent {
attrs_groups: &[&CORE, &X_LINK],
attrs: Some(phf_set!("href", "xlink:href")),
defaults: None,
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: None,
content: Some(phf_set!("font-face-format")),
},
"foreignObject" => AllowedContent {
attrs_groups: &[
&CONDITIONAL_PROCESSING,
&CORE,
&GRAPHICAL_EVENT,
&PRESENTATION,
],
attrs: Some(phf_set!(
"class",
"externalResourcesRequired",
"height",
"style",
"transform",
"width",
"x",
"y",
)),
defaults: Some(phf_map!{"x" => "0", "y" => "0"}),
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: None,
content: None,
},
"g" => AllowedContent {
attrs_groups: &[
&CONDITIONAL_PROCESSING,
&CORE,
&GRAPHICAL_EVENT,
&PRESENTATION,
],
attrs: Some(phf_set!(
"class",
"externalResourcesRequired",
"style",
"transform",
)),
defaults: None,
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: Some(&[
&ANIMATION,
&DESCRIPTIVE,
&PAINT_SERVER,
&SHAPE,
&STRUCTURAL,
]),
content: Some(phf_set!(
"a",
"altGlyphDef",
"clipPath",
"color-profile",
"cursor",
"filter",
"font-face",
"font",
"foreignObject",
"image",
"marker",
"mask",
"pattern",
"script",
"style",
"switch",
"text",
"view",
)),
},
"glyph" => AllowedContent {
attrs_groups: &[&CORE, &PRESENTATION],
attrs: Some(phf_set!(
"arabic-form",
"class",
"d",
"glyph-name",
"horiz-adv-x",
"lang",
"orientation",
"style",
"unicode",
"vert-adv-y",
"vert-origin-x",
"vert-origin-y",
)),
defaults: Some(phf_map!{"arabic-form" => "initial"}),
deprecated_safe: None,
deprecated_unsafe: Some(phf_set!(
"arabic-form",
"glyph-name",
"horiz-adv-x",
"orientation",
"unicode",
"vert-adv-y",
"vert-origin-x",
"vert-origin-y",
)),
content_groups: Some(&[
&ANIMATION,
&DESCRIPTIVE,
&PAINT_SERVER,
&SHAPE,
&STRUCTURAL,
]),
content: Some(phf_set!(
"a",
"altGlyphDef",
"clipPath",
"color-profile",
"cursor",
"filter",
"font-face",
"font",
"foreignObject",
"image",
"marker",
"mask",
"pattern",
"script",
"style",
"switch",
"text",
"view",
)),
},
"glyphRef" => AllowedContent {
attrs_groups: &[&CORE, &PRESENTATION],
attrs: Some(phf_set!(
"class",
"d",
"horiz-adv-x",
"style",
"vert-adv-y",
"vert-origin-x",
"vert-origin-y",
)),
defaults: None,
deprecated_safe: None,
deprecated_unsafe: Some(phf_set!(
"horiz-adv-x",
"vert-adv-y",
"vert-origin-x",
"vert-origin-y",
)),
content_groups: Some(&[
&ANIMATION,
&DESCRIPTIVE,
&PAINT_SERVER,
&SHAPE,
&STRUCTURAL,
]),
content: Some(phf_set!(
"a",
"altGlyphDef",
"clipPath",
"color-profile",
"cursor",
"filter",
"font-face",
"font",
"foreignObject",
"image",
"marker",
"mask",
"pattern",
"script",
"style",
"switch",
"text",
"view",
)),
},
"hatch" => AllowedContent {
attrs_groups: &[
&CORE,
&PRESENTATION,
&X_LINK
],
attrs: Some(phf_set!(
"class",
"hatchContentUnits",
"hatchUnits",
"pitch",
"rotate",
"style",
"transform",
"x",
"y",
)),
defaults: Some(phf_map!{
"hatchUnits" => "objectBoundingBox",
"hatchContentUnits" => "userSpaceOnUse",
"x" => "0",
"y" => "0",
"pitch" => "0",
"rotate" => "0",
}),
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: Some(&[
&ANIMATION,
&DESCRIPTIVE
]),
content: Some(phf_set!("hatchPath")),
},
"hatchPath" => AllowedContent {
attrs_groups: &[
&CORE,
&PRESENTATION,
&X_LINK
],
attrs: Some(phf_set!("class", "style", "d", "offset")),
defaults: Some(phf_map!{"offset" => "0"}),
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: Some(&[
&ANIMATION,
&DESCRIPTIVE
]),
content: None,
},
"hkern" => AllowedContent {
attrs_groups: &[&CORE],
attrs: Some(phf_set!("u1", "g1", "u2", "g2", "k")),
defaults: None,
deprecated_safe: None,
deprecated_unsafe: Some(phf_set!("g1", "g2", "k", "u1", "u2")),
content_groups: None,
content: None,
},
"image" => AllowedContent {
attrs_groups: &[
&CONDITIONAL_PROCESSING,
&CORE,
&GRAPHICAL_EVENT,
&PRESENTATION,
&X_LINK,
],
attrs: Some(phf_set!(
"class",
"externalResourcesRequired",
"height",
"href",
"preserveAspectRatio",
"style",
"transform",
"width",
"x",
"xlink:href",
"y",
)),
defaults: Some(phf_map!{
"x" => "0",
"y" => "0",
"preserveAspectRatio" => "xMidYMid meet",
}),
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: Some(&[
&ANIMATION,
&DESCRIPTIVE
]),
content: None,
},
"line" => AllowedContent {
attrs_groups: &[
&CONDITIONAL_PROCESSING,
&CORE,
&GRAPHICAL_EVENT,
&PRESENTATION,
],
attrs: Some(phf_set!(
"class",
"externalResourcesRequired",
"style",
"transform",
"x1",
"x2",
"y1",
"y2",
)),
defaults: Some(phf_map!{
"x1" => "0",
"y1" => "0",
"x2" => "0",
"y2" => "0",
}),
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: Some(&[
&ANIMATION,
&DESCRIPTIVE
]),
content: None,
},
"linearGradient" => AllowedContent {
attrs_groups: &[
&CORE,
&PRESENTATION,
&X_LINK
],
attrs: Some(phf_set!(
"class",
"externalResourcesRequired",
"gradientTransform",
"gradientUnits",
"href",
"spreadMethod",
"style",
"x1",
"x2",
"xlink:href",
"y1",
"y2",
)),
defaults: Some(phf_map!{
"x1" => "0",
"y1" => "0",
"x2" => "100%",
"y2" => "0",
"spreadMethod" => "pad",
}),
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: Some(&[&DESCRIPTIVE]),
content: Some(phf_set!(
"animate",
"animateTransform",
"set",
"stop",
)),
},
"marker" => AllowedContent {
attrs_groups: &[&CORE, &PRESENTATION],
attrs: Some(phf_set!(
"class",
"externalResourcesRequired",
"markerHeight",
"markerUnits",
"markerWidth",
"orient",
"preserveAspectRatio",
"refX",
"refY",
"style",
"viewBox",
)),
defaults: Some(phf_map!{
"markerUnits" => "strokeWidth",
"refX" => "0",
"refY" => "0",
"markerWidth" => "3",
"markerHeight" => "3",
}),
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: Some(&[
&ANIMATION,
&DESCRIPTIVE,
&PAINT_SERVER,
&SHAPE,
&STRUCTURAL,
]),
content: Some(phf_set!(
"a",
"altGlyphDef",
"clipPath",
"color-profile",
"cursor",
"filter",
"font-face",
"font",
"foreignObject",
"image",
"marker",
"mask",
"pattern",
"script",
"style",
"switch",
"text",
"view",
)),
},
"mask" => AllowedContent {
attrs_groups: &[
&CONDITIONAL_PROCESSING,
&CORE,
&PRESENTATION
],
attrs: Some(phf_set!(
"class",
"externalResourcesRequired",
"height",
"mask-type",
"maskContentUnits",
"maskUnits",
"style",
"width",
"x",
"y",
)),
defaults: Some(phf_map!{
"maskUnits" => "objectBoundingBox",
"maskContentUnits" => "userSpaceOnUse",
"x" => "-10%",
"y" => "-10%",
"width" => "120%",
"height" => "120%",
}),
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: Some(&[
&ANIMATION,
&DESCRIPTIVE,
&PAINT_SERVER,
&SHAPE,
&STRUCTURAL,
]),
content: Some(phf_set!(
"a",
"altGlyphDef",
"clipPath",
"color-profile",
"cursor",
"filter",
"font-face",
"font",
"foreignObject",
"image",
"marker",
"mask",
"pattern",
"script",
"style",
"switch",
"text",
"view",
)),
},
"metadata" => AllowedContent {
attrs_groups: &[&CORE],
attrs: None,
defaults: None,
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: None,
content: None,
},
"missing-glyph" => AllowedContent {
attrs_groups: &[&CORE, &PRESENTATION],
attrs: Some(phf_set!(
"class",
"d",
"horiz-adv-x",
"style",
"vert-adv-y",
"vert-origin-x",
"vert-origin-y",
)),
defaults: None,
deprecated_safe: None,
deprecated_unsafe: Some(phf_set!(
"horiz-adv-x",
"vert-adv-y",
"vert-origin-x",
"vert-origin-y",
)),
content_groups: Some(&[
&ANIMATION,
&DESCRIPTIVE,
&PAINT_SERVER,
&SHAPE,
&STRUCTURAL,
]),
content: Some(phf_set!(
"a",
"altGlyphDef",
"clipPath",
"color-profile",
"cursor",
"filter",
"font-face",
"font",
"foreignObject",
"image",
"marker",
"mask",
"pattern",
"script",
"style",
"switch",
"text",
"view",
)),
},
"mpath" => AllowedContent {
attrs_groups: &[&CORE, &X_LINK],
attrs: Some(phf_set!(
"externalResourcesRequired",
"href",
"xlink:href",
)),
defaults: None,
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: Some(&[&DESCRIPTIVE]),
content: None,
},
"path" => AllowedContent {
attrs_groups: &[
&CONDITIONAL_PROCESSING,
&CORE,
&GRAPHICAL_EVENT,
&PRESENTATION,
],
attrs: Some(phf_set!(
"class",
"d",
"externalResourcesRequired",
"pathLength",
"style",
"transform",
)),
defaults: None,
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: Some(&[
&ANIMATION,
&DESCRIPTIVE
]),
content: None,
},
"pattern" => AllowedContent {
attrs_groups: &[
&CONDITIONAL_PROCESSING,
&CORE,
&PRESENTATION,
&X_LINK,
],
attrs: Some(phf_set!(
"class",
"externalResourcesRequired",
"height",
"href",
"patternContentUnits",
"patternTransform",
"patternUnits",
"preserveAspectRatio",
"style",
"viewBox",
"width",
"x",
"xlink:href",
"y",
)),
defaults: Some(phf_map!{
"patternUnits" => "objectBoundingBox",
"patternContentUnits" => "userSpaceOnUse",
"x" => "0",
"y" => "0",
"width" => "0",
"height" => "0",
"preserveAspectRatio" => "xMidYMid meet",
}),
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: Some(&[
&ANIMATION,
&DESCRIPTIVE,
&PAINT_SERVER,
&SHAPE,
&STRUCTURAL,
]),
content: Some(phf_set!(
"a",
"altGlyphDef",
"clipPath",
"color-profile",
"cursor",
"filter",
"font-face",
"font",
"foreignObject",
"image",
"marker",
"mask",
"pattern",
"script",
"style",
"switch",
"text",
"view",
)),
},
"polygon" => AllowedContent {
attrs_groups: &[
&CONDITIONAL_PROCESSING,
&CORE,
&GRAPHICAL_EVENT,
&PRESENTATION,
],
attrs: Some(phf_set!(
"class",
"externalResourcesRequired",
"points",
"style",
"transform",
)),
defaults: None,
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: Some(&[
&ANIMATION,
&DESCRIPTIVE
]),
content: None,
},
"polyline" => AllowedContent {
attrs_groups: &[
&CONDITIONAL_PROCESSING,
&CORE,
&GRAPHICAL_EVENT,
&PRESENTATION,
],
attrs: Some(phf_set!(
"class",
"externalResourcesRequired",
"points",
"style",
"transform",
)),
defaults: None,
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: Some(&[
&ANIMATION,
&DESCRIPTIVE
]),
content: None,
},
"radialGradient" => AllowedContent {
attrs_groups: &[
&CORE,
&PRESENTATION,
&X_LINK
],
attrs: Some(phf_set!(
"class",
"cx",
"cy",
"externalResourcesRequired",
"fr",
"fx",
"fy",
"gradientTransform",
"gradientUnits",
"href",
"r",
"spreadMethod",
"style",
"xlink:href",
)),
defaults: Some(phf_map!{
"gradientUnits" => "objectBoundingBox",
"cx" => "50%",
"cy" => "50%",
"r" => "50%",
}),
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: Some(&[&DESCRIPTIVE]),
content: Some(phf_set!(
"animate",
"animateTransform",
"set",
"stop",
)),
},
"meshGradient" => AllowedContent {
attrs_groups: &[
&CORE,
&PRESENTATION,
&X_LINK
],
attrs: Some(phf_set!(
"class",
"style",
"x",
"y",
"gradientUnits",
"transform",
)),
defaults: None,
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: Some(&[
&DESCRIPTIVE,
&PAINT_SERVER,
&ANIMATION
]),
content: Some(phf_set!("meshRow")),
},
"meshRow" => AllowedContent {
attrs_groups: &[&CORE, &PRESENTATION],
attrs: Some(phf_set!("class", "style")),
defaults: None,
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: Some(&[&DESCRIPTIVE]),
content: Some(phf_set!("meshPatch")),
},
"meshPatch" => AllowedContent {
attrs_groups: &[&CORE, &PRESENTATION],
attrs: Some(phf_set!("class", "style")),
defaults: None,
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: Some(&[&DESCRIPTIVE]),
content: Some(phf_set!("stop")),
},
"rect" => AllowedContent {
attrs_groups: &[
&CONDITIONAL_PROCESSING,
&CORE,
&GRAPHICAL_EVENT,
&PRESENTATION,
],
attrs: Some(phf_set!(
"class",
"externalResourcesRequired",
"height",
"rx",
"ry",
"style",
"transform",
"width",
"x",
"y",
)),
defaults: Some(phf_map!{"x" => "0", "y" => "0"}),
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: Some(&[
&ANIMATION,
&DESCRIPTIVE
]),
content: None,
},
"script" => AllowedContent {
attrs_groups: &[&CORE, &X_LINK],
attrs: Some(phf_set!(
"externalResourcesRequired",
"type",
"href",
"xlink:href",
)),
defaults: None,
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: None,
content: None,
},
"set" => AllowedContent {
attrs_groups: &[
&ANIMATION_ATTRIBUTE_TARGET,
&ANIMATION_TIMING,
&CONDITIONAL_PROCESSING,
&CORE,
&X_LINK,
],
attrs: Some(phf_set!("externalResourcesRequired", "to")),
defaults: None,
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: Some(&[&DESCRIPTIVE]),
content: None,
},
"solidColor" => AllowedContent {
attrs_groups: &[&CORE, &PRESENTATION],
attrs: Some(phf_set!("class", "style")),
defaults: None,
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: Some(&[&PAINT_SERVER]),
content: None,
},
"stop" => AllowedContent {
attrs_groups: &[&CORE, &PRESENTATION],
attrs: Some(phf_set!("class", "style", "offset", "path")),
defaults: None,
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: None,
content: Some(phf_set!("animate", "animateColor", "set")),
},
"style" => AllowedContent {
attrs_groups: &[&CORE],
attrs: Some(phf_set!("type", "media", "title")),
defaults: Some(phf_map!{"type" => "text/css"}),
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: None,
content: None,
},
"svg" => AllowedContent {
attrs_groups: &[
&CONDITIONAL_PROCESSING,
&CORE,
&DOCUMENT_EVENT,
&GRAPHICAL_EVENT,
&PRESENTATION,
],
attrs: Some(phf_set!(
"baseProfile",
"class",
"contentScriptType",
"contentStyleType",
"height",
"preserveAspectRatio",
"style",
"version",
"viewBox",
"width",
"x",
"y",
"zoomAndPan",
)),
defaults: Some(phf_map!{
"x" => "0",
"y" => "0",
"width" => "100%",
"height" => "100%",
"preserveAspectRatio" => "xMidYMid meet",
"zoomAndPan" => "magnify",
"version" => "1.1",
"baseProfile" => "none",
"contentScriptType" => "application/ecmascript",
"contentStyleType" => "text/css",
}),
deprecated_safe: Some(phf_set!("version")),
deprecated_unsafe: Some(phf_set!(
"baseProfile",
"contentScriptType",
"contentStyleType",
"zoomAndPan",
)),
content_groups: Some(&[
&ANIMATION,
&DESCRIPTIVE,
&PAINT_SERVER,
&SHAPE,
&STRUCTURAL,
]),
content: Some(phf_set!(
"a",
"altGlyphDef",
"clipPath",
"color-profile",
"cursor",
"filter",
"font-face",
"font",
"foreignObject",
"image",
"marker",
"mask",
"pattern",
"script",
"style",
"switch",
"text",
"view",
)),
},
"switch" => AllowedContent {
attrs_groups: &[
&CONDITIONAL_PROCESSING,
&CORE,
&GRAPHICAL_EVENT,
&PRESENTATION,
],
attrs: Some(phf_set!(
"class",
"externalResourcesRequired",
"style",
"transform",
)),
defaults: None,
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: Some(&[
&ANIMATION,
&DESCRIPTIVE,
&SHAPE
]),
content: Some(phf_set!(
"a",
"foreignObject",
"g",
"image",
"svg",
"switch",
"text",
"use",
)),
},
"symbol" => AllowedContent {
attrs_groups: &[
&CORE,
&GRAPHICAL_EVENT,
&PRESENTATION
],
attrs: Some(phf_set!(
"class",
"externalResourcesRequired",
"preserveAspectRatio",
"refX",
"refY",
"style",
"viewBox",
)),
defaults: Some(phf_map!{"refX" => "0", "refY" => "0"}),
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: Some(&[
&ANIMATION,
&DESCRIPTIVE,
&PAINT_SERVER,
&SHAPE,
&STRUCTURAL,
]),
content: Some(phf_set!(
"a",
"altGlyphDef",
"clipPath",
"color-profile",
"cursor",
"filter",
"font-face",
"font",
"foreignObject",
"image",
"marker",
"mask",
"pattern",
"script",
"style",
"switch",
"text",
"view",
)),
},
"text" => AllowedContent {
attrs_groups: &[
&CONDITIONAL_PROCESSING,
&CORE,
&GRAPHICAL_EVENT,
&PRESENTATION,
],
attrs: Some(phf_set!(
"class",
"dx",
"dy",
"externalResourcesRequired",
"lengthAdjust",
"rotate",
"style",
"textLength",
"transform",
"x",
"y",
)),
defaults: Some(phf_map!{
"x" => "0",
"y" => "0",
"lengthAdjust" => "spacing",
}),
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: Some(&[
&ANIMATION,
&DESCRIPTIVE,
&TEXT_CONTENT_CHILD,
]),
content: Some(phf_set!("a")),
},
"textPath" => AllowedContent {
attrs_groups: &[
&CONDITIONAL_PROCESSING,
&CORE,
&GRAPHICAL_EVENT,
&PRESENTATION,
&X_LINK,
],
attrs: Some(phf_set!(
"class",
"d",
"externalResourcesRequired",
"href",
"method",
"spacing",
"startOffset",
"style",
"xlink:href",
)),
defaults: Some(phf_map!{
"startOffset" => "0",
"method" => "align",
"spacing" => "exact",
}),
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: Some(&[&DESCRIPTIVE]),
content: Some(phf_set!(
"a",
"altGlyph",
"animate",
"animateColor",
"set",
"tref",
"tspan",
)),
},
"title" => AllowedContent {
attrs_groups: &[&CORE],
attrs: Some(phf_set!("class", "style")),
defaults: None,
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: None,
content: None,
},
"tref" => AllowedContent {
attrs_groups: &[
&CONDITIONAL_PROCESSING,
&CORE,
&GRAPHICAL_EVENT,
&PRESENTATION,
&X_LINK,
],
attrs: Some(phf_set!(
"class",
"externalResourcesRequired",
"href",
"style",
"xlink:href",
)),
defaults: None,
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: Some(&[&DESCRIPTIVE]),
content: Some(phf_set!("animate", "animateColor", "set")),
},
"tspan" => AllowedContent {
attrs_groups: &[
&CONDITIONAL_PROCESSING,
&CORE,
&GRAPHICAL_EVENT,
&PRESENTATION,
],
attrs: Some(phf_set!(
"class",
"dx",
"dy",
"externalResourcesRequired",
"lengthAdjust",
"rotate",
"style",
"textLength",
"x",
"y",
)),
defaults: None,
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: Some(&[&DESCRIPTIVE]),
content: Some(phf_set!(
"a",
"altGlyph",
"animate",
"animateColor",
"set",
"tref",
"tspan",
)),
},
"use" => AllowedContent {
attrs_groups: &[
&CONDITIONAL_PROCESSING,
&CORE,
&GRAPHICAL_EVENT,
&PRESENTATION,
&X_LINK,
],
attrs: Some(phf_set!(
"class",
"externalResourcesRequired",
"height",
"href",
"style",
"transform",
"width",
"x",
"xlink:href",
"y",
)),
defaults: Some(phf_map!{"x" => "0", "y" => "0"}),
deprecated_safe: None,
deprecated_unsafe: None,
content_groups: Some(&[
&ANIMATION,
&DESCRIPTIVE
]),
content: None,
},
"view" => AllowedContent {
attrs_groups: &[&CORE],
attrs: Some(phf_set!(
"externalResourcesRequired",
"preserveAspectRatio",
"viewBox",
"viewTarget",
"zoomAndPan",
)),
defaults: None,
deprecated_safe: None,
deprecated_unsafe: Some(phf_set!("viewTarget", "zoomAndPan")),
content_groups: Some(&[&DESCRIPTIVE]),
content: None,
},
"vkern" => AllowedContent {
attrs_groups: &[&CORE],
attrs: Some(phf_set!("u1", "g1", "u2", "g2", "k")),
defaults: None,
deprecated_safe: None,
deprecated_unsafe: Some(phf_set!("g1", "g2", "k", "u1", "u2")),
content_groups: None,
content: None,
},
};
pub static ANIMATION_ATTRIBUTE_TARGET_DEPRECATED: phf::Set<&'static str> = phf_set! {
"attributeType"
};
pub static CONDITIONAL_PROCESSING_DEPRECATED: phf::Set<&'static str> = phf_set! {
"requiredFeatures"
};
pub static CORE_DEPRECATED: phf::Set<&'static str> = phf_set! {
"xml:base", "xml:lang", "xml:space"
};
pub static PRESENTATION_DEPRECATED: phf::Set<&'static str> = phf_set! {
"clip",
"color-profile",
"enable-background",
"glyph-orientation-horizontal",
"glyph-orientation-vertical",
"kerning"
};
pub fn attrs_group_deprecated_unsafe<'a>(
attrs_group: &'static phf::Set<&'static str>,
) -> Option<&'a phf::Set<&'static str>> {
if attrs_group.map.key == ANIMATION_ATTRIBUTE_TARGET.map.key {
Some(&ANIMATION_ATTRIBUTE_TARGET_DEPRECATED)
} else if attrs_group.map.key == CONDITIONAL_PROCESSING.map.key {
Some(&CONDITIONAL_PROCESSING_DEPRECATED)
} else if attrs_group.map.key == CORE.map.key {
Some(&CORE_DEPRECATED)
} else if attrs_group.map.key == PRESENTATION.map.key {
Some(&PRESENTATION_DEPRECATED)
} else {
None
}
}