aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorViatrix2026-03-18 10:02:22 -0700
committerViatrix2026-03-18 10:02:22 -0700
commit274ad4460f3f4a35e099545a1a8408a9a67614e1 (patch)
tree37de2d2ea271c77940bc4daee2a90baba9272494
parentd3a80223412f8496433305f2cf681df1ac26966f (diff)
Fixed ALT attribute showing up on <AREA>s with no HREF.
-rw-r--r--imagemap.py6
-rw-r--r--tests/data/refs/imagemap__--maptype__HTML__overlap__svg.out2
-rw-r--r--tests/data/svg/overlap.svg2
3 files changed, 6 insertions, 4 deletions
diff --git a/imagemap.py b/imagemap.py
index 42c1d4a..a3f6490 100644
--- a/imagemap.py
+++ b/imagemap.py
@@ -157,10 +157,12 @@ class ImageMap(inkex.OutputExtension):
if len(shapes[i])==0: inkex.errormsg(_("The hyperlink \"{}\" could not be added to the output.").format(links[i]['href']))
for j in shapes[i]:
attrs=links[i].copy()
- attrs['alt']=alt
attrs.update(j)
+ if attrs['href'] is not None:
+ attrs['alt']=alt
+ alt=None
+ else: attrs['alt']=None
stream.write(bytes(shapemarkup(attrs),'utf-8'))
- alt=None
if __name__ == "__main__":
ImageMap().run()
diff --git a/tests/data/refs/imagemap__--maptype__HTML__overlap__svg.out b/tests/data/refs/imagemap__--maptype__HTML__overlap__svg.out
index de38166..5f36bd7 100644
--- a/tests/data/refs/imagemap__--maptype__HTML__overlap__svg.out
+++ b/tests/data/refs/imagemap__--maptype__HTML__overlap__svg.out
@@ -1,4 +1,4 @@
<area shape=poly coords=30,10,30,30,40,30,40,20,80,20,80,60,70,60,70,70,90,70,90,10 href=http://example.com/1>
<area shape=poly coords=30,40,30,70,60,70,60,60,40,60,40,40 href=http://example.com/1>
<area shape=rect coords=20,40,60,80>
-<area shape=rect coords=10,30,70,90 href=http://example.com/2>
+<area shape=rect coords=10,30,70,90 href=http://example.com/2 alt=blue>
diff --git a/tests/data/svg/overlap.svg b/tests/data/svg/overlap.svg
index 7a3e7aa..8e01282 100644
--- a/tests/data/svg/overlap.svg
+++ b/tests/data/svg/overlap.svg
@@ -2,7 +2,7 @@
<a xlink:href="http://example.com/1">
<rect x="35" y="15" width="50" height="50" stroke="red"/>
</a>
- <a xlink:href="http://example.com/2">
+ <a xlink:href="http://example.com/2" xlink:title="blue">
<rect x="15" y="35" width="50" height="50" stroke="blue"/>
</a>
</svg>