File tree 1 file changed +8
-1
lines changed
src/librustdoc/html/static 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ document.addEventListener('DOMContentLoaded', function() {
16
16
return ;
17
17
}
18
18
19
+ var featureRegexp = new RegExp ( '^\s*#!\\[feature\\(\.*?\\)\\]' ) ;
19
20
var elements = document . querySelectorAll ( 'pre.rust' ) ;
20
21
21
22
Array . prototype . forEach . call ( elements , function ( el ) {
@@ -29,8 +30,14 @@ document.addEventListener('DOMContentLoaded', function() {
29
30
a . setAttribute ( 'class' , 'test-arrow' ) ;
30
31
31
32
var code = el . previousElementSibling . textContent ;
33
+
34
+ var channel = '' ;
35
+ if ( featureRegexp . test ( code ) ) {
36
+ channel = '&version=nightly' ;
37
+ }
38
+
32
39
a . setAttribute ( 'href' , window . playgroundUrl + '?code=' +
33
- encodeURIComponent ( code ) ) ;
40
+ encodeURIComponent ( code ) + channel ) ;
34
41
a . setAttribute ( 'target' , '_blank' ) ;
35
42
36
43
el . appendChild ( a ) ;
You can’t perform that action at this time.
0 commit comments