Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Handle extra whitespace in svg element's style value (#1170)

Mark Millerb460712878cd
diff --git a/manim/mobject/svg/style_utils.py b/manim/mobject/svg/style_utils.py
index f0bc13a2b..5d25df408 100644
--- a/manim/mobject/svg/style_utils.py
+++ b/manim/mobject/svg/style_utils.py
@@ -72,13 +72,13 @@ def cascade_element_style(
try:
key, value = style_spec.split(":")
except ValueError as e:
- if not style_spec:
+ if not style_spec.strip():
# there was just a stray semicolon at the end, producing an emptystring
pass
else:
raise e
else:
- style[key] = value
+ style[key.strip()] = value.strip()
return style
diff --git a/tests/test_graphical_units/img_svg_resources/multi_part_path.svg b/tests/test_graphical_units/img_svg_resources/multi_part_path.svg
index 46caa4e02..28eb44573 100644
--- a/tests/test_graphical_units/img_svg_resources/multi_part_path.svg
+++ b/tests/test_graphical_units/img_svg_resources/multi_part_path.svg
@@ -1,6 +1,6 @@
<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100">
<g>
- <path style="fill:white" d="m 50,50 10,10 -10,10 z m 30,0 -10,-10, -10,10 z">
+ <path style="fill : white" d="m 50,50 10,10 -10,10 z m 30,0 -10,-10, -10,10 z">
</path>
</g>
</svg>
\ No newline at end of file