1
0
mirror of https://github.com/golang/go synced 2024-09-30 20:18:33 -06:00

Revert "godoc: accessible permalinks"

This reverts commit f57adc1821.

Reason for revert: See https://github.com/golang/go/issues/22171#issuecomment-339125376 for reasoning.

Change-Id: Ifd81ad716cf2acdf7a1d73602ac781186aca5596
Reviewed-on: https://go-review.googlesource.com/73150
Reviewed-by: Andrew Bonventre <andybons@golang.org>
This commit is contained in:
Andrew Bonventre 2017-10-24 20:45:43 +00:00
parent 9bd2f44268
commit 5ec91747d9
4 changed files with 26 additions and 12 deletions

View File

@ -180,7 +180,7 @@ function setupInlinePlayground() {
code.on('keyup', resize); code.on('keyup', resize);
code.keyup(); // resize now. code.keyup(); // resize now.
}; };
// If example already visible, set up playground now. // If example already visible, set up playground now.
if ($(el).is(':visible')) { if ($(el).is(':visible')) {
setup(); setup();
@ -314,7 +314,7 @@ function addPermalinks() {
// Already attached. // Already attached.
return; return;
} }
parent.append(" ").append($("<a class='permalink' title='permalink' aria-label='permalink'>&#xb6;</a>").attr("href", "#" + id)); parent.append(" ").append($("<a class='permalink'>&#xb6;</a>").attr("href", "#" + id));
} }
$("#page .container").find("h2[id], h3[id]").each(function() { $("#page .container").find("h2[id], h3[id]").each(function() {

View File

@ -166,7 +166,7 @@
{{/* Name is a string - no need for FSet */}} {{/* Name is a string - no need for FSet */}}
{{$name_html := html .Name}} {{$name_html := html .Name}}
<h2 id="{{$name_html}}">func <a href="{{posLink_url $ .Decl}}">{{$name_html}}</a> <h2 id="{{$name_html}}">func <a href="{{posLink_url $ .Decl}}">{{$name_html}}</a>
<a class="permalink" title="permalink" aria-label="permalink" href="#{{$name_html}}">&#xb6;</a> <a class="permalink" href="#{{$name_html}}">&#xb6;</a>
</h2> </h2>
<pre>{{node_html $ .Decl true}}</pre> <pre>{{node_html $ .Decl true}}</pre>
{{comment_html .Doc}} {{comment_html .Doc}}
@ -178,7 +178,7 @@
{{$tname := .Name}} {{$tname := .Name}}
{{$tname_html := html .Name}} {{$tname_html := html .Name}}
<h2 id="{{$tname_html}}">type <a href="{{posLink_url $ .Decl}}">{{$tname_html}}</a> <h2 id="{{$tname_html}}">type <a href="{{posLink_url $ .Decl}}">{{$tname_html}}</a>
<a class="permalink" title="permalink" aria-label="permalink" href="#{{$tname_html}}">&#xb6;</a> <a class="permalink" href="#{{$tname_html}}">&#xb6;</a>
</h2> </h2>
{{comment_html .Doc}} {{comment_html .Doc}}
<pre>{{node_html $ .Decl true}}</pre> <pre>{{node_html $ .Decl true}}</pre>
@ -200,7 +200,7 @@
{{range .Funcs}} {{range .Funcs}}
{{$name_html := html .Name}} {{$name_html := html .Name}}
<h3 id="{{$name_html}}">func <a href="{{posLink_url $ .Decl}}">{{$name_html}}</a> <h3 id="{{$name_html}}">func <a href="{{posLink_url $ .Decl}}">{{$name_html}}</a>
<a class="permalink" title="permalink" aria-label="permalink" href="#{{$name_html}}">&#xb6;</a> <a class="permalink" href="#{{$name_html}}">&#xb6;</a>
</h3> </h3>
<pre>{{node_html $ .Decl true}}</pre> <pre>{{node_html $ .Decl true}}</pre>
{{comment_html .Doc}} {{comment_html .Doc}}
@ -211,7 +211,7 @@
{{range .Methods}} {{range .Methods}}
{{$name_html := html .Name}} {{$name_html := html .Name}}
<h3 id="{{$tname_html}}.{{$name_html}}">func ({{html .Recv}}) <a href="{{posLink_url $ .Decl}}">{{$name_html}}</a> <h3 id="{{$tname_html}}.{{$name_html}}">func ({{html .Recv}}) <a href="{{posLink_url $ .Decl}}">{{$name_html}}</a>
<a class="permalink" title="permalink" aria-label="permalink" href="#{{$tname_html}}.{{$name_html}}">&#xb6;</a> <a class="permalink" href="#{{$tname_html}}.{{$name_html}}">&#xb6;</a>
</h3> </h3>
<pre>{{node_html $ .Decl true}}</pre> <pre>{{node_html $ .Decl true}}</pre>
{{comment_html .Doc}} {{comment_html .Doc}}

View File

@ -766,7 +766,7 @@ function setupInlinePlayground() {
code.on('keyup', resize); code.on('keyup', resize);
code.keyup(); // resize now. code.keyup(); // resize now.
}; };
// If example already visible, set up playground now. // If example already visible, set up playground now.
if ($(el).is(':visible')) { if ($(el).is(':visible')) {
setup(); setup();
@ -900,7 +900,7 @@ function addPermalinks() {
// Already attached. // Already attached.
return; return;
} }
parent.append(" ").append($("<a class='permalink' title='permalink' aria-label='permalink'>&#xb6;</a>").attr("href", "#" + id)); parent.append(" ").append($("<a class='permalink'>&#xb6;</a>").attr("href", "#" + id));
} }
$("#page .container").find("h2[id], h3[id]").each(function() { $("#page .container").find("h2[id], h3[id]").each(function() {
@ -1789,7 +1789,7 @@ function cgAddChild(tree, ul, cgn) {
{{/* Name is a string - no need for FSet */}} {{/* Name is a string - no need for FSet */}}
{{$name_html := html .Name}} {{$name_html := html .Name}}
<h2 id="{{$name_html}}">func <a href="{{posLink_url $ .Decl}}">{{$name_html}}</a> <h2 id="{{$name_html}}">func <a href="{{posLink_url $ .Decl}}">{{$name_html}}</a>
<a class="permalink" title="permalink" aria-label="permalink" href="#{{$name_html}}">&#xb6;</a> <a class="permalink" href="#{{$name_html}}">&#xb6;</a>
</h2> </h2>
<pre>{{node_html $ .Decl true}}</pre> <pre>{{node_html $ .Decl true}}</pre>
{{comment_html .Doc}} {{comment_html .Doc}}
@ -1801,7 +1801,7 @@ function cgAddChild(tree, ul, cgn) {
{{$tname := .Name}} {{$tname := .Name}}
{{$tname_html := html .Name}} {{$tname_html := html .Name}}
<h2 id="{{$tname_html}}">type <a href="{{posLink_url $ .Decl}}">{{$tname_html}}</a> <h2 id="{{$tname_html}}">type <a href="{{posLink_url $ .Decl}}">{{$tname_html}}</a>
<a class="permalink" title="permalink" aria-label="permalink" href="#{{$tname_html}}">&#xb6;</a> <a class="permalink" href="#{{$tname_html}}">&#xb6;</a>
</h2> </h2>
{{comment_html .Doc}} {{comment_html .Doc}}
<pre>{{node_html $ .Decl true}}</pre> <pre>{{node_html $ .Decl true}}</pre>
@ -1823,7 +1823,7 @@ function cgAddChild(tree, ul, cgn) {
{{range .Funcs}} {{range .Funcs}}
{{$name_html := html .Name}} {{$name_html := html .Name}}
<h3 id="{{$name_html}}">func <a href="{{posLink_url $ .Decl}}">{{$name_html}}</a> <h3 id="{{$name_html}}">func <a href="{{posLink_url $ .Decl}}">{{$name_html}}</a>
<a class="permalink" title="permalink" aria-label="permalink" href="#{{$name_html}}">&#xb6;</a> <a class="permalink" href="#{{$name_html}}">&#xb6;</a>
</h3> </h3>
<pre>{{node_html $ .Decl true}}</pre> <pre>{{node_html $ .Decl true}}</pre>
{{comment_html .Doc}} {{comment_html .Doc}}
@ -1834,7 +1834,7 @@ function cgAddChild(tree, ul, cgn) {
{{range .Methods}} {{range .Methods}}
{{$name_html := html .Name}} {{$name_html := html .Name}}
<h3 id="{{$tname_html}}.{{$name_html}}">func ({{html .Recv}}) <a href="{{posLink_url $ .Decl}}">{{$name_html}}</a> <h3 id="{{$tname_html}}.{{$name_html}}">func ({{html .Recv}}) <a href="{{posLink_url $ .Decl}}">{{$name_html}}</a>
<a class="permalink" title="permalink" aria-label="permalink" href="#{{$tname_html}}.{{$name_html}}">&#xb6;</a> <a class="permalink" href="#{{$tname_html}}.{{$name_html}}">&#xb6;</a>
</h3> </h3>
<pre>{{node_html $ .Decl true}}</pre> <pre>{{node_html $ .Decl true}}</pre>
{{comment_html .Doc}} {{comment_html .Doc}}
@ -2937,6 +2937,13 @@ a:hover,
text-decoration: none; text-decoration: none;
} }
.permalink {
display: none;
}
:hover > .permalink {
display: inline;
}
p, li { p, li {
max-width: 800px; max-width: 800px;
word-wrap: break-word; word-wrap: break-word;

View File

@ -60,6 +60,13 @@ a:hover,
text-decoration: none; text-decoration: none;
} }
.permalink {
display: none;
}
:hover > .permalink {
display: inline;
}
p, li { p, li {
max-width: 800px; max-width: 800px;
word-wrap: break-word; word-wrap: break-word;