File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
src/librustdoc/html/static Expand file tree Collapse file tree 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() {
1616 return ;
1717 }
1818
19+ var featureRegexp = new RegExp ( '^\s*#!\\[feature\\(\.*?\\)\\]' ) ;
1920 var elements = document . querySelectorAll ( 'pre.rust' ) ;
2021
2122 Array . prototype . forEach . call ( elements , function ( el ) {
@@ -29,8 +30,14 @@ document.addEventListener('DOMContentLoaded', function() {
2930 a . setAttribute ( 'class' , 'test-arrow' ) ;
3031
3132 var code = el . previousElementSibling . textContent ;
33+
34+ var channel = '' ;
35+ if ( featureRegexp . test ( code ) ) {
36+ channel = '&version=nightly' ;
37+ }
38+
3239 a . setAttribute ( 'href' , window . playgroundUrl + '?code=' +
33- encodeURIComponent ( code ) ) ;
40+ encodeURIComponent ( code ) + channel ) ;
3441 a . setAttribute ( 'target' , '_blank' ) ;
3542
3643 el . appendChild ( a ) ;
You can’t perform that action at this time.
0 commit comments