|
From: <mi...@us...> - 2026-07-14 13:31:03
|
Revision: 10379
http://sourceforge.net/p/docutils/code/10379
Author: milde
Date: 2026-07-14 13:31:00 +0000 (Tue, 14 Jul 2026)
Log Message:
-----------
Add test for the bug with anonymous links to images with a :target:.
Anonymous internal hyperlinks to "clickable" images currently link to the
wrapping `<reference>` instead of the `<image>`.
The reference is handled similar to an indirect target: the reference's
"refid" or "refuri" is transferred to the internal reference.
As a result, clicking the hyperlink reference to the image brings you
directly to the image's "target" (instead of the internal image).
Modified Paths:
--------------
trunk/docutils/test/test_transforms/test_hyperlinks.py
Modified: trunk/docutils/test/test_transforms/test_hyperlinks.py
===================================================================
--- trunk/docutils/test/test_transforms/test_hyperlinks.py 2026-07-13 11:13:03 UTC (rev 10378)
+++ trunk/docutils/test/test_transforms/test_hyperlinks.py 2026-07-14 13:31:00 UTC (rev 10379)
@@ -937,7 +937,105 @@
<reference refid="internal">
<image uri="picture.png">
"""],
+# TODO: Anonymous links to a "clickable image should go
+# to the image, not the image's click-target!
["""\
+.. _img1:
+.. image:: pic1.png
+ :target: uri1.html
+__
+.. image:: pic2.png
+__
+.. image:: pic3.png
+ :target: uri3.html
+
+Named link to img1_ with target and anonymous links to
+the targetless img2__ and
+img3__ with target (sic!).
+""",
+"""\
+<document source="test data">
+ <target refid="img1">
+ <reference ids="img1" names="img1" refuri="uri1.html">
+ <image uri="pic1.png">
+ <target anonymous="1" refid="target-1">
+ <image ids="target-1" uri="pic2.png">
+ <target anonymous="1" refid="target-2">
+ <reference ids="target-2" refuri="uri3.html">
+ <image uri="pic3.png">
+ <paragraph>
+ Named link to \n\
+ <reference refid="img1">
+ img1
+ with target and anonymous links to
+ the targetless \n\
+ <reference anonymous="1" refid="target-1">
+ img2
+ and
+ <reference anonymous="1" refuri="uri3.html">
+ img3
+ with target (sic!).
+"""],
+["""\
+__
+__
+.. image:: pic1.png
+ :target: uri1.html
+
+Two anonymous__ links to an `image with target`__ (sic!).
+
+.. _named:
+__
+.. image:: pic2.png
+ :target: uri2.html
+
+Named_ and anonymous__ link to an image with target (sic!).
+
+__
+.. _named link:
+.. image:: pic3.png
+ :target: uri3.html
+
+Anonymous__ and `named link`_ to an image with target (sic!).
+""",
+"""\
+<document source="test data">
+ <target anonymous="1" refid="target-1">
+ <target anonymous="1" refid="target-2">
+ <reference ids="target-2 target-1" refuri="uri1.html">
+ <image uri="pic1.png">
+ <paragraph>
+ Two \n\
+ <reference anonymous="1" refuri="uri1.html">
+ anonymous
+ links to an \n\
+ <reference anonymous="1" refuri="uri1.html">
+ image with target
+ (sic!).
+ <target refid="named">
+ <target anonymous="1" refid="target-3">
+ <reference ids="target-3 named" names="named" refuri="uri2.html">
+ <image uri="pic2.png">
+ <paragraph>
+ <reference refid="named">
+ Named
+ and \n\
+ <reference anonymous="1" refuri="uri2.html">
+ anonymous
+ link to an image with target (sic!).
+ <target anonymous="1" refid="target-4">
+ <target refid="named-link">
+ <reference ids="named-link target-4" names="named\\ link" refuri="uri3.html">
+ <image uri="pic3.png">
+ <paragraph>
+ <reference anonymous="1" refuri="uri3.html">
+ Anonymous
+ and \n\
+ <reference refid="named-link">
+ named link
+ to an image with target (sic!).
+"""],
+["""\
.. contents:: Table of Contents
.. _indirect reference to the table of contents: `table of contents`_
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|