Rollup merge of #26932 - tsurai:master, r=steveklabnik
Simple adjustment to auto select the nightly channel for examples using unstable feature.
This commit is contained in:
commit
bb73c7a38d
@ -16,6 +16,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
return;
|
||||
}
|
||||
|
||||
var featureRegexp = new RegExp('^\s*#!\\[feature\\(\.*?\\)\\]');
|
||||
var elements = document.querySelectorAll('pre.rust');
|
||||
|
||||
Array.prototype.forEach.call(elements, function(el) {
|
||||
@ -29,8 +30,14 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
a.setAttribute('class', 'test-arrow');
|
||||
|
||||
var code = el.previousElementSibling.textContent;
|
||||
|
||||
var channel = '';
|
||||
if (featureRegexp.test(code)) {
|
||||
channel = '&version=nightly';
|
||||
}
|
||||
|
||||
a.setAttribute('href', window.playgroundUrl + '?code=' +
|
||||
encodeURIComponent(code));
|
||||
encodeURIComponent(code) + channel);
|
||||
a.setAttribute('target', '_blank');
|
||||
|
||||
el.appendChild(a);
|
||||
|
Loading…
x
Reference in New Issue
Block a user