diff --git a/ddoc.dd b/ddoc.dd index cf1a65a78b..9b067e5a01 100644 --- a/ddoc.dd +++ b/ddoc.dd @@ -694,7 +694,7 @@ DDOC_PARAM_ID = $(TD $0) DDOC_PARAM_DESC = $(TD $0) DDOC_BLANKLINE = $(BR)$(BR) -DDOC_ANCHOR = <a name=\"$0\"></a> +DDOC_ANCHOR = <a name="$1"></a> DDOC_PSYMBOL = $(U $0) DDOC_KEYWORD = $(B $0) DDOC_PARAM = $(I $0) @@ -799,6 +799,8 @@ $(P $(TR $(TD $(B DDOC_PARAM_ROW)) $(TD Highlighting of a name=value function parameter.)) $(TR $(TD $(B DDOC_PARAM_ID)) $(TD Highlighting of the parameter name.)) $(TR $(TD $(B DDOC_PARAM_DESC)) $(TD Highlighting of the parameter value.)) + $(TR $(TD $(B DDOC_ANCHOR)) $(TD Expands to a named anchor used for hyperlinking to a + particular declaration section. Argument $1 expands to the qualified declaration name.)) $(TR $(TD $(B DDOC_PSYMBOL)) $(TD Highlighting of declaration name to which a particular section is referring.)) $(TR $(TD $(B DDOC_KEYWORD)) $(TD Highlighting of D keywords.)) $(TR $(TD $(B DDOC_PARAM)) $(TD Highlighting of function parameters.)) diff --git a/std.ddoc b/std.ddoc index 1bb174bb9b..dedbbaccdf 100644 --- a/std.ddoc +++ b/std.ddoc @@ -71,17 +71,25 @@ function listanchors() { var a = document.anchors[i]; var text = a.name; + // ignore anchors from DDOC_PSYMBOL + if (text[0] != '.') continue; if (hash[text] > 0) continue; hash[text] = 1; values[n++] = a.name } - values.sort(); + // we won't display the qualifying names to save space, so sort by last name + var lastName = function(a){ + var li = a.lastIndexOf('.'); + return a.slice(li + 1); + } + values.sort(function(a,b){return lastName(a) > lastName(b)}); for(var i = 0; i < values.length; i++) { var a = values[i]; + var text = lastName(a); newText += ' \x3Ca href="\x23' + a + - '"\x3E\x3Cspan class="d_psymbol"\x3E' + a + '\x3C/span\x3E\x3C/a\x3E'; + '"\x3E\x3Cspan class="d_psymbol"\x3E' + text + '\x3C/span\x3E\x3C/a\x3E'; } if (newText != "") newText = "\x3Cp\x3E\x3Cb\x3EJump to:\x3C/b\x3E" + newText + "\x3C/p\x3E"; var a = document.getElementById("quickindex"); @@ -336,6 +344,7 @@ BIGOH = Ο($(D $0)) GLOSSARY = $(LINK2 ../glossary.html#$0, $0) DDOC_PSYMBOL = $0 +DDOC_ANCHOR = DDOC_DECL =
$0
XREF = $(D std.$1.$2) CXREF = $(D core.$1.$2)