aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--imagemap.py2
-rw-r--r--tests/data/refs/imagemap__--maptype__HTML__group__svg.out3
-rw-r--r--tests/data/svg/group.svg11
-rw-r--r--tests/test_imagemap_comparison.py1
4 files changed, 16 insertions, 1 deletions
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 @@
+<area shape=poly coords=50,25,25,75,75,75 href=http://example.com>
+<area shape=poly coords=75,25,100,75,125,25 href=http://example.com>
+<area shape=poly coords=150,25,125,75,175,75 href=http://example.com>
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 @@
+<svg width="200" height="100" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <a xlink:href="http://example.com">
+ <polyline points="50,25 75,75 25,75"/>
+ <g>
+ <polyline points="100,75 125,25 75,25"/>
+ <g>
+ <polyline points="150,25 175,75 125,75"/>
+ </g>
+ </g>
+ </a>
+</svg>
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',