From e5010f6d1ed8e99de593825bb853312f08d55a47 Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Mon, 22 Oct 2012 17:30:19 +0100 Subject: [PATCH 1/3] Document DDOC_ANCHOR --- ddoc.dd | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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.)) From ce1c5812128021a27bfbf96102157b004c08a932 Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Mon, 22 Oct 2012 17:03:08 +0100 Subject: [PATCH 2/3] Use DDOC_ANCHOR with a dot prefix for qualified jump-to links The dot prefix distinguishes qualified anchors from the old unqualifed DDOC_PSYMBOL anchors. We need to keep the latter for backward compatibility with various links online. --- std.ddoc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/std.ddoc b/std.ddoc index 1bb174bb9b..c875dc3992 100644 --- a/std.ddoc +++ b/std.ddoc @@ -71,6 +71,8 @@ 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 @@ -81,7 +83,7 @@ function listanchors() for(var i = 0; i < values.length; i++) { var a = values[i]; newText += ' \x3Ca href="\x23' + a + - '"\x3E\x3Cspan class="d_psymbol"\x3E' + a + '\x3C/span\x3E\x3C/a\x3E'; + '"\x3E\x3Cspan class="d_psymbol"\x3E' + a.slice(1) + '\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 +338,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) From aeb95e0bbe371e849ccd990a9606ae908eb10b56 Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Tue, 23 Oct 2012 14:54:48 +0100 Subject: [PATCH 3/3] Don't display qualifying symbol names in Jump-to links to save space --- std.ddoc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/std.ddoc b/std.ddoc index c875dc3992..dedbbaccdf 100644 --- a/std.ddoc +++ b/std.ddoc @@ -78,12 +78,18 @@ function listanchors() 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.slice(1) + '\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");