提交 28a88a29 authored 作者: slefrancois's avatar slefrancois

correct version switcher in RTD theme

上级 a3bbfb8c
......@@ -33,7 +33,7 @@
var vswitch = ['<div class="rst-versions" data-toggle="rst-versions" role="note" aria-label="versions" align=left>'];
vswitch.push('<span class="rst-current-version" data-toggle="rst-current-version">');
vswitch.push('<span class="fa fa-book"></span>');
vswitch.push('v:' + current_version);
vswitch.push('v: ', current_version.replace("theano_versions/", ""), ' ');
vswitch.push('<span class="fa fa-caret-down"></span>');
vswitch.push('</span>');
......@@ -41,28 +41,31 @@
vswitch.push('<dl>');
vswitch.push('<dt>Versions</dt>');
$.each(versions_dir, function(version, dir){
var new_url = url.replace(url.match(version_regex)[0],
'/' + versions_dir[version] + '/');
vswitch.push('<dd><a href=' + new_url + '>' + version + '</a></dd>');
});
for (var version in versions_dir) {
var new_url = url.replace(url.match(version_regex)[0], '/' + versions_dir[version] + '/');
vswitch.push('<dd><a href=\"', new_url, '\">', version, '</a></dd>');
}
// $.each(versions_dir, function(version, dir){
// var new_url = url.replace(url.match(version_regex)[0], '/' + dir + '/');
// vswitch.push('<dd><a href=', new_url, '>', version, '</a></dd>');
// });
vswitch.push('</dl>');
vswitch.push('<dl>');
vswitch.push('<dt>Downloads</dt>');
var pdf_url = "http://deeplearning.net/software/theano/theano.pdf"
vswitch.push('<dd><a href=' + pdf_url + '>' + 'PDF' + '</a></dd>');
var pdf_url = root_url + current_version + "/theano.pdf"
vswitch.push('<dd><a href=\"', pdf_url, '\">', 'PDF', '</a></dd>');
vswitch.push('</dl>');
vswitch.push('<dl>');
vswitch.push('<dt>On GitHub</dt>');
var git_master = "https://github.com/Theano/Theano"
vswitch.push('<dd><a href=' + git_master + '>' + 'Fork me' + '</a></dd>');
vswitch.push('<dd><a href=\"', git_master + '\">', 'Fork me', '</a></dd>');
vswitch.push('</dl>');
vswitch.push('</div>');
vswitch.push('</div>');
console.log(vswitch.join(''))
return vswitch.join('');
}
......
......@@ -20,21 +20,8 @@
var span_class = document.createAttribute("class");
span_class.value = "version_switcher_placeholder";
span.setAttributeNode(span_class);
var div = document.createElement("DIV");
var text = document.createTextNode("v:");
var div_class = document.createAttribute("class");
div_class.value = "version-switcher";
div.setAttributeNode(div_class);
var style = document.createAttribute("style");
style.value = "color:#27AA5E; padding-right:5px;";
div.setAttributeNode(style);
var align = document.createAttribute("align");
align.value = "right";
div.setAttributeNode(align);
div.appendChild(text);
div.appendChild(span);
var nav_div = document.getElementsByClassName("wy-nav-side")[0];
nav_div.appendChild(div);
</script>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论