dlang.org icon indicating copy to clipboard operation
dlang.org copied to clipboard

Remove leading dot from DDOC_ANCHOR

Open JakobOvrum opened this issue 8 years ago • 4 comments

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.

JakobOvrum avatar Jan 08 '16 11:01 JakobOvrum

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.

adamdruppe avatar Jan 08 '16 15:01 adamdruppe

Does this fix anything in practice? Because obviously it does break legacy links, and breaking links is bad practice.

CyberShadow avatar Jan 08 '16 17:01 CyberShadow

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.

aG0aep6G avatar Feb 04 '16 14:02 aG0aep6G

I suspect those legacy links were already really broken. I never used them because they wouldn't link to the right place anyway!

adamdruppe avatar Mar 08 '16 04:03 adamdruppe