From 57aa116144d51783a12bb288554dd69846706386 Mon Sep 17 00:00:00 2001 From: Viatrix Date: Sun, 15 Mar 2026 15:29:42 -0700 Subject: Groups now work. --- imagemap.py | 2 +- tests/data/refs/imagemap__--maptype__HTML__group__svg.out | 3 +++ tests/data/svg/group.svg | 11 +++++++++++ tests/test_imagemap_comparison.py | 1 + 4 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 tests/data/refs/imagemap__--maptype__HTML__group__svg.out create mode 100644 tests/data/svg/group.svg diff --git a/imagemap.py b/imagemap.py index 30fa0cd..9ab1e55 100644 --- a/imagemap.py +++ b/imagemap.py @@ -66,7 +66,7 @@ class ImageMap(inkex.OutputExtension): # save link attributes because they get removed when flattening link={attr:AREA_ATTRS[attr](a) for attr in AREA_ATTRS.keys()} for el in a.iterdescendants(): # CSS is preserved when flattening (for paths) - if not isinstance(el,inkex.ShapeElement): continue + if not isinstance(el,inkex.ShapeElement) or isinstance(el,inkex.Group): continue style=el.effective_style() style[CSS_LINK_INDEX]=f'" {CSS_LINK_INDEX}-{len(links)} "' if el.tag=='{http://www.w3.org/2000/svg}image': diff --git a/tests/data/refs/imagemap__--maptype__HTML__group__svg.out b/tests/data/refs/imagemap__--maptype__HTML__group__svg.out new file mode 100644 index 0000000..ff94203 --- /dev/null +++ b/tests/data/refs/imagemap__--maptype__HTML__group__svg.out @@ -0,0 +1,3 @@ + + + diff --git a/tests/data/svg/group.svg b/tests/data/svg/group.svg new file mode 100644 index 0000000..18646af --- /dev/null +++ b/tests/data/svg/group.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/tests/test_imagemap_comparison.py b/tests/test_imagemap_comparison.py index 2dda137..b4fae16 100644 --- a/tests/test_imagemap_comparison.py +++ b/tests/test_imagemap_comparison.py @@ -7,6 +7,7 @@ class ImageMapComparisonTest(ComparisonMixin, TestCase): 'svg/alt.svg', 'svg/enclave.svg', 'svg/fillstroke.svg', + 'svg/group.svg', 'svg/image.svg', 'svg/intersect.svg', 'svg/oob.svg', -- cgit