Bug 9728 – Ddoc anchors non-unique across overloads
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-03-15T09:54:00Z
Last change time
2015-02-18T03:38:26Z
Keywords
pull
Assigned to
nobody
Creator
hsteoh
Comments
Comment #0 by hsteoh — 2013-03-15T09:54:15Z
If there are overloaded functions, the same anchor ID is generated for all overloads, making it impossible to link to a specific one.
Example code:
/// First overload
void func() { }
/// Second overload
void func(int x) { }
/// Main
void main() {}
Ddoc output:
<html><head>
<META http-equiv="content-type" content="text/html; charset=utf-8">
<title>test</title>
</head><body>
<h1>test</h1>
<!-- Generated by Ddoc from test.d -->
<br><br>
<dl><dt><big><a name="func"></a>void <u>func</u>();
</big></dt>
<dd>First overload<br><br>
</dd>
<dt><big><a name="func"></a>void <u>func</u>(int <i>x</i>);
</big></dt>
<dd>Second overload<br><br>
</dd>
<dt><big><a name="main"></a>void <u>main</u>();
</big></dt>
<dd>Main<br><br>
</dd>
</dl>
<hr><small>Page generated by <a href="http://dlang.org/ddoc.html">Ddoc</a>. </small>
</body></html>
--------
Note that overriding the default Ddoc macros does not help, because DDOC_ANCHOR is only passed the function name, so there is no way to distinguish between overloads.
Not to mention, this breaks HTML compliance (anchor names are supposed to be unique).