D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 3840 - Jump to: section in the docs should be sorted
Summary: Jump to: section in the docs should be sorted
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: Other All
: P2 enhancement
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-21 09:01 UTC by Adam D. Ruppe
Modified: 2014-02-15 02:42 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Adam D. Ruppe 2010-02-21 09:01:06 UTC
The Jump To: section on the phobos 2 docs could be made a lot easier by sorting the anchors listed alphabetically.

I looked at the html source and noticed that they are generated by some Javascript.

Here's a replacement for the function in there now that does this sorting:

<script>
function listanchors()
{
    var a = document.getElementById("quickindex");
    if (!a) return;
    var newText = "";
    var hash = new Array;
    var n = 0;
    var values = new Array;
    // List all anchors.
    for (var i = 0; i < document.anchors.length; i++)
    {
        var a = document.anchors[i];
        var text = a.name;
        if (hash[text] > 0) continue;
        hash[text] = 1;
	values[n++] = a.name
    }

    values.sort();

    for(var i = 0; i < values.length; i++) {
    	var a = values[i];
        newText += '<a href="#' + a + '"><span class="d_psymbol">'
                + a + '</span></a> ';
    }
    if (newText != "") newText = "<p><b>Jump to:</b> " + newText + '</p>';
    var a = document.getElementById("quickindex");
    a.innerHTML = newText;
}
</script>
Comment 1 Walter Bright 2010-03-08 22:24:17 UTC
Fixed dmd 1.057 and 2.041