Skip to content

Commit 15d2d7e

Browse files
committed
content/static: show deprecated symbols specially
For golang/go#40850 Change-Id: I1b7d2ac03dbba61646a63edc373fe2b9db993756 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/314592 Trust: Jonathan Amsterdam <[email protected]> Run-TryBot: Jonathan Amsterdam <[email protected]> TryBot-Result: kokoro <[email protected]> Reviewed-by: Jamal Carvalho <[email protected]> Reviewed-by: Julie Qiu <[email protected]>
1 parent 8f262ba commit 15d2d7e

File tree

4 files changed

+71
-18
lines changed

4 files changed

+71
-18
lines changed

content/static/css/stylesheet.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,6 @@ pre,
565565
color: var(--gray-3);
566566
}
567567

568-
/* common dialog styles */
569568
.Dialog {
570569
padding: 0;
571570
position: fixed;

content/static/css/unit_doc.css

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
.UnitDoc .Documentation h4 {
4343
font-size: 1.375rem;
4444
}
45-
4645
.Documentation {
4746
color: var(--gray-1);
4847
display: block;
@@ -301,17 +300,28 @@
301300
font-style: italic;
302301
margin-left: 0.5rem;
303302
}
304-
305-
.Documentation-bodyDeprecated {
303+
.Documentation-deprecatedBody {
306304
color: var(--gray-3);
307305
font-size: 1rem;
308306
font-style: italic;
309307
font-weight: 400;
310308
margin-left: 0.5rem;
311309
margin-right: 0.5rem;
312310
}
313-
314-
.Documentation-deprecatedShowLink {
315-
font-size: 1rem;
316-
font-weight: 400;
311+
.Documentation-deprecatedDetails .Documentation-deprecatedBody::after {
312+
color: var(--turq-dark);
313+
content: 'Show';
314+
margin-left: 1rem;
315+
}
316+
.Documentation-deprecatedDetails[open] .Documentation-deprecatedBody::after {
317+
color: var(--turq-dark);
318+
content: 'Hide';
319+
margin-left: 1rem;
320+
}
321+
.Documentation-deprecatedDetails > summary {
322+
list-style: none;
323+
opacity: 1;
324+
}
325+
.Documentation-deprecatedDetails .Documentation-source {
326+
opacity: 1;
317327
}

content/static/html/doc/body.tmpl

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,26 @@
167167

168168
{{define "item"}}
169169
{{$id := safe_id .FullName}}
170-
<h4 tabindex="-1" id="{{$id}}" data-kind="{{.Kind}}" class="{{.HeaderClass}}">
171-
<span>{{.HeaderStart}} {{source_link .Name .Decl}} <a class="Documentation-idLink" href="#{{$id}}">¶</a></span>
172-
{{- template "since_version" .FullName -}}
173-
</h4>{{"\n"}}
174-
{{- template "declaration" . -}}
175-
{{- template "example" .Examples -}}
170+
{{if .IsDeprecated}}
171+
<details class="Documentation-deprecatedDetails">
172+
<summary>
173+
<h4 tabindex="-1" id="{{$id}}" data-kind="{{.Kind}}" class="{{.HeaderClass}}">
174+
<span>
175+
{{.HeaderStart}} {{source_link .Name .Decl}} <a class="Documentation-idLink" href="#{{$id}}">¶</a>
176+
<span class="Documentation-deprecatedBody">deprecated</span>
177+
</span>
178+
{{- template "since_version" .FullName -}}
179+
</h4>{{"\n"}}
180+
</summary>
181+
{{- template "declaration" . -}}
182+
{{- template "example" .Examples -}}
183+
</details>
184+
{{else}}
185+
<h4 tabindex="-1" id="{{$id}}" data-kind="{{.Kind}}" class="{{.HeaderClass}}">
186+
<span>{{.HeaderStart}} {{source_link .Name .Decl}} <a class="Documentation-idLink" href="#{{$id}}">¶</a></span>
187+
{{- template "since_version" .FullName -}}
188+
</h4>{{"\n"}}
189+
{{- template "declaration" . -}}
190+
{{- template "example" .Examples -}}
191+
{{end}}
176192
{{end}}

internal/godoc/dochtml/testdata/deprecated-on.golden

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,17 @@ Deprecated: use GoodC.
5757
</section>
5858
<h3 tabindex="-1" id="pkg-functions" class="Documentation-functionsHeader">Functions <a href="#pkg-functions">¶</a></h3>
5959
<section class="Documentation-functions"><div class="Documentation-function">
60+
<details class="Documentation-deprecatedDetails">
61+
<summary>
6062
<h4 tabindex="-1" id="BadF" data-kind="function" class="Documentation-functionHeader">
61-
<span>func <a class="Documentation-source" href="src">BadF</a> <a class="Documentation-idLink" href="#BadF">¶</a></span>
63+
<span>
64+
func <a class="Documentation-source" href="src">BadF</a> <a class="Documentation-idLink" href="#BadF">¶</a>
65+
<span class="Documentation-deprecatedBody">deprecated</span>
66+
</span>
6267
<span class="Documentation-sinceVersion">
6368
</span>
6469
</h4>
70+
</summary>
6571
<div class="Documentation-declaration">
6672
<pre>func BadF()</pre>
6773
</div>
@@ -70,6 +76,7 @@ Deprecated: use GoodC.
7076
</div><p>BadF is bad.
7177
Deprecated: use GoodF.
7278
</p>
79+
</details>
7380
</div><div class="Documentation-function">
7481
<h4 tabindex="-1" id="GoodF" data-kind="function" class="Documentation-functionHeader">
7582
<span>func <a class="Documentation-source" href="src">GoodF</a> <a class="Documentation-idLink" href="#GoodF">¶</a></span>
@@ -82,11 +89,17 @@ Deprecated: use GoodF.
8289
</div></section>
8390
<h3 tabindex="-1" id="pkg-types" class="Documentation-typesHeader">Types <a href="#pkg-types">¶</a></h3>
8491
<section class="Documentation-types"><div class="Documentation-type">
92+
<details class="Documentation-deprecatedDetails">
93+
<summary>
8594
<h4 tabindex="-1" id="BadT" data-kind="type" class="Documentation-typeHeader">
86-
<span>type <a class="Documentation-source" href="src">BadT</a> <a class="Documentation-idLink" href="#BadT">¶</a></span>
95+
<span>
96+
type <a class="Documentation-source" href="src">BadT</a> <a class="Documentation-idLink" href="#BadT">¶</a>
97+
<span class="Documentation-deprecatedBody">deprecated</span>
98+
</span>
8799
<span class="Documentation-sinceVersion">
88100
</span>
89101
</h4>
102+
</summary>
90103
<div class="Documentation-declaration">
91104
<pre>type BadT <a href="/builtin#int">int</a></pre>
92105
</div>
@@ -96,6 +109,7 @@ Deprecated: use GoodF.
96109
Deprecated: use GoodT.
97110
Don&#39;t use this.
98111
</p>
112+
</details>
99113
</div><div class="Documentation-type">
100114
<h4 tabindex="-1" id="GoodT" data-kind="type" class="Documentation-typeHeader">
101115
<span>type <a class="Documentation-source" href="src">GoodT</a> <a class="Documentation-idLink" href="#GoodT">¶</a></span>
@@ -106,11 +120,17 @@ Don&#39;t use this.
106120
<pre>type GoodT <a href="/builtin#int">int</a></pre>
107121
</div>
108122
<div class="Documentation-typeFunc">
123+
<details class="Documentation-deprecatedDetails">
124+
<summary>
109125
<h4 tabindex="-1" id="NewGoodTBad" data-kind="function" class="Documentation-typeFuncHeader">
110-
<span>func <a class="Documentation-source" href="src">NewGoodTBad</a> <a class="Documentation-idLink" href="#NewGoodTBad">¶</a></span>
126+
<span>
127+
func <a class="Documentation-source" href="src">NewGoodTBad</a> <a class="Documentation-idLink" href="#NewGoodTBad">¶</a>
128+
<span class="Documentation-deprecatedBody">deprecated</span>
129+
</span>
111130
<span class="Documentation-sinceVersion">
112131
</span>
113132
</h4>
133+
</summary>
114134
<div class="Documentation-declaration">
115135
<pre>func NewGoodTBad() <a href="#GoodT">GoodT</a></pre>
116136
</div>
@@ -119,6 +139,7 @@ Don&#39;t use this.
119139
</div><p>NewGoodTBad is bad.
120140
Deprecated: use NewGoodTGood.
121141
</p>
142+
</details>
122143
</div><div class="Documentation-typeFunc">
123144
<h4 tabindex="-1" id="NewGoodTGood" data-kind="function" class="Documentation-typeFuncHeader">
124145
<span>func <a class="Documentation-source" href="src">NewGoodTGood</a> <a class="Documentation-idLink" href="#NewGoodTGood">¶</a></span>
@@ -129,11 +150,17 @@ Deprecated: use NewGoodTGood.
129150
<pre>func NewGoodTGood() <a href="#GoodT">GoodT</a></pre>
130151
</div>
131152
</div><div class="Documentation-typeMethod">
153+
<details class="Documentation-deprecatedDetails">
154+
<summary>
132155
<h4 tabindex="-1" id="GoodT.BadM" data-kind="method" class="Documentation-typeMethodHeader">
133-
<span>func (GoodT) <a class="Documentation-source" href="src">BadM</a> <a class="Documentation-idLink" href="#GoodT.BadM">¶</a></span>
156+
<span>
157+
func (GoodT) <a class="Documentation-source" href="src">BadM</a> <a class="Documentation-idLink" href="#GoodT.BadM">¶</a>
158+
<span class="Documentation-deprecatedBody">deprecated</span>
159+
</span>
134160
<span class="Documentation-sinceVersion">
135161
</span>
136162
</h4>
163+
</summary>
137164
<div class="Documentation-declaration">
138165
<pre>func (<a href="#GoodT">GoodT</a>) BadM()</pre>
139166
</div>
@@ -142,6 +169,7 @@ Deprecated: use NewGoodTGood.
142169
</div><p>BadM is bad.
143170
Deprecated: use GoodM.
144171
</p>
172+
</details>
145173
</div><div class="Documentation-typeMethod">
146174
<h4 tabindex="-1" id="GoodT.GoodM" data-kind="method" class="Documentation-typeMethodHeader">
147175
<span>func (GoodT) <a class="Documentation-source" href="src">GoodM</a> <a class="Documentation-idLink" href="#GoodT.GoodM">¶</a></span>

0 commit comments

Comments
 (0)