提交 d59edfc2 authored 作者: Simon Lefrancois's avatar Simon Lefrancois

fix doc version switch

上级 fa9e909a
...@@ -20,13 +20,13 @@ ...@@ -20,13 +20,13 @@
// Get current version // Get current version
var current_version = url.match(version_regex)[0] var current_version = url.match(version_regex)[0]
current_version = current_version.substring(1, current_version.length - 1) current_version = current_version.substring(1, current_version.length - 1)
// Add current version in case versions.json is unavailable // Add current version in case versions.json is unavailable
if (current_version != "theano" && current_version != "html") { if (current_version != "theano" && current_version != "html") {
ver = current_version.replace("theano_versions/", "") ver = current_version.replace("theano_versions/", "")
versions_dir[ver] = current_version versions_dir[ver] = current_version
} }
function build_vswitch() { function build_vswitch() {
// Build HTML string for version selector, based on ReadTheDocs theme's versions.html // Build HTML string for version selector, based on ReadTheDocs theme's versions.html
...@@ -38,33 +38,33 @@ ...@@ -38,33 +38,33 @@
vswitch.push('<span class="rst-current-version" data-toggle="rst-current-version">'); vswitch.push('<span class="rst-current-version" data-toggle="rst-current-version">');
vswitch.push('<span class="fa fa-book"></span>'); vswitch.push('<span class="fa fa-book"></span>');
vswitch.push('v: ', vlabel, ' '); vswitch.push('v: ', vlabel, ' ');
vswitch.push('<span class="fa fa-caret-down"></span>'); vswitch.push('<span class="fa fa-caret-down"></span>');
vswitch.push('</span>'); vswitch.push('</span>');
vswitch.push('<div class="rst-other-versions">');
vswitch.push('<dl>'); vswitch.push('<div class="rst-other-versions">');
vswitch.push('<dl>');
vswitch.push('<dt>Versions</dt>'); vswitch.push('<dt>Versions</dt>');
for (var version in versions_dir) { for (var version in versions_dir) {
var new_url = url.replace(url.match(version_regex)[0], '/' + versions_dir[version] + '/'); var new_url = url.replace(url.match(version_regex)[0], '/' + versions_dir[version] + '/');
vswitch.push('<dd><a href=\"', new_url, '\">', version, '</a></dd>'); vswitch.push('<dd><a href=\"', new_url, '\">', version, '</a></dd>');
} }
vswitch.push('</dl>'); vswitch.push('</dl>');
vswitch.push('<dl>'); vswitch.push('<dl>');
vswitch.push('<dt>Downloads</dt>'); vswitch.push('<dt>Downloads</dt>');
var pdf_url = root_url + current_version + "/theano.pdf" var pdf_url = root_url + current_version + "/theano.pdf"
vswitch.push('<dd><a href=\"', pdf_url, '\">', 'PDF', '</a></dd>'); vswitch.push('<dd><a href=\"', pdf_url, '\">', 'PDF', '</a></dd>');
vswitch.push('</dl>'); vswitch.push('</dl>');
vswitch.push('<dl>'); vswitch.push('<dl>');
vswitch.push('<dt>On GitHub</dt>'); vswitch.push('<dt>On GitHub</dt>');
var git_master = "https://github.com/Theano/Theano" 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('</dl>');
vswitch.push('</div>'); vswitch.push('</div>');
vswitch.push('</div>'); vswitch.push('</div>');
return vswitch.join(''); return vswitch.join('');
} }
...@@ -75,10 +75,13 @@ ...@@ -75,10 +75,13 @@
if (vlabel == 'theano') { if (vlabel == 'theano') {
vlabel = 'release'; vlabel = 'release';
} }
else if (vlabel != "dev") {
vlabel = '';
}
var vswitch = ['<div class="rst-versions-up" data-toggle="rst-versions" role="note" aria-label="versions" align=center>']; var vswitch = ['<div class="rst-versions-up" data-toggle="rst-versions" role="note" aria-label="versions" align=center>'];
vswitch.push('<span class="rst-current-version" data-toggle="rst-current-version">'); vswitch.push('<span class="rst-current-version" data-toggle="rst-current-version">');
vswitch.push(vlabel); vswitch.push(vlabel);
vswitch.push('<span class="fa fa-caret-down"></span>'); vswitch.push(' <span class="fa fa-caret-down"></span>');
vswitch.push('</span>'); vswitch.push('</span>');
vswitch.push('</div>'); vswitch.push('</div>');
return vswitch.join(''); return vswitch.join('');
...@@ -99,6 +102,6 @@ ...@@ -99,6 +102,6 @@
$('.version_switcher_placeholder').html(build_vswitch()); $('.version_switcher_placeholder').html(build_vswitch());
$('.version_switcher_placeholder_up').html(build_vswitch_up()); $('.version_switcher_placeholder_up').html(build_vswitch_up());
}); });
} }
}); });
})(); })();
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论