Class: SvgConform::Requirements::NoExternalImagesRequirement
- Inherits:
-
BaseRequirement
- Object
- Lutaml::Model::Serializable
- BaseRequirement
- SvgConform::Requirements::NoExternalImagesRequirement
show all
- Defined in:
- lib/svg_conform/requirements/no_external_images_requirement.rb
Overview
Validates that no external image references are present All images must be embedded in the SVG
Instance Method Summary
collapse
#collect_sax_data, #element?, #get_attribute, #get_attributes, #has_attribute?, #needs_deferred_validation?, #remove_attribute, #set_attribute, #text?, #to_s, #validate_document, #validate_sax_complete
Instance Method Details
#check(node, context) ⇒ Object
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/svg_conform/requirements/no_external_images_requirement.rb', line 22
def check(node, context)
return unless element?(node)
case node.name
when "image"
check_image_element(node, context) if check_image_elements
else
check_style_attribute(node, context) if check_style_images
end
end
|
#should_check_node?(node, context = nil) ⇒ Boolean
33
34
35
36
37
38
|
# File 'lib/svg_conform/requirements/no_external_images_requirement.rb', line 33
def should_check_node?(node, context = nil)
return false unless element?(node)
return false if context&.node_structurally_invalid?(node)
node.name == "image" || has_style_attribute?(node)
end
|
#validate_sax_element(element, context) ⇒ Object
40
41
42
43
44
45
46
47
|
# File 'lib/svg_conform/requirements/no_external_images_requirement.rb', line 40
def validate_sax_element(element, context)
case element.name
when "image"
check_image_element_sax(element, context) if check_image_elements
else
check_style_attribute_sax(element, context) if check_style_images
end
end
|