dlang.org
dlang.org copied to clipboard
Remove leading dot from DDOC_ANCHOR
The leading dot was introduced in #179 to avoid conflicts with legacy fragment names.
However, the legacy fragment name scheme is not compatible with HTML. Fragment names must be unique in the document, whether using name
(removed in HTML5) or id
, otherwise behaviour is undefined. For example, for http://dlang.org/phobos/std_stdio#writeln, Firefox links to the name="writeln"
appearing earliest in the document, which is actually std.stdio.File.writeln
, as opposed to the std.stdio.writeln
one would expect.
With this PR, only the qualified name (rooted in the module) emits a fragment, so we can remove the leading dot.
Apropos name
, it should be changed to id
everywhere for HTML5 compatbility. This PR only does it in one place.
Looks good to me. If there's no objections by the end of the day, someone ping me and I'll hit the merge myself.
Does this fix anything in practice? Because obviously it does break legacy links, and breaking links is bad practice.
How about generating both dot-prefixed and non-prefixed anchors via DDOC_ANCHOR
? I.e.:
DDOC_PSYMBOL = $(SPANC ddoc_psymbol, $0)
DDOC_ANCHOR = $(ADEF .$1)$(ADEF $1)$(DIVCID quickindex, quickindex.$1, )
This should get us rid of the duplicates and keep all links working.
I suspect those legacy links were already really broken. I never used them because they wouldn't link to the right place anyway!