diff -r 2b7e58153d11 Doc/tools/sphinxext/layout.html --- a/Doc/tools/sphinxext/layout.html Fri Oct 26 22:40:56 2012 +0300 +++ b/Doc/tools/sphinxext/layout.html Sat Oct 27 17:49:35 2012 +0200 @@ -3,11 +3,19 @@
  • Python{{ reldelim1 }}
  • -
  • {{ shorttitle }}{{ reldelim1 }}
  • +
  • + {%- if versionswitcher is defined %} + {{ release }} + Documentation{{ reldelim1 }} + {%- else %} + {{ shorttitle }}{{ reldelim1 }} + {%- endif %} +
  • {% endblock %} {% block extrahead %} {% if not embedded %}{% endif %} + {% if versionswitcher is defined %}{% endif %} {% if pagename == 'whatsnew/changelog' %} type="text/javascript"> $(document).ready(function() { diff -r 2b7e58153d11 Doc/tools/sphinxext/static/version_switch.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Doc/tools/sphinxext/static/version_switch.js Sat Oct 27 17:49:35 2012 +0200 @@ -0,0 +1,58 @@ +(function() { + 'use strict'; + + var all_versions = { + '3.4': 'dev (3.4)', + '3.3': '3.3', + '3.2': '3.2', + '2.7': '2.7', + '2.6': '2.6' + }; + + function build_select(current_version) { + var buf = [''); + return buf.join(''); + } + + function patch_url(url, new_version) { + var url_re = /\.org\/(py3k|dev|((release\/)?\d\.\d[\w\d\.]*))\//, + new_url = url.replace(url_re, '.org/' + new_version + '/'); + + if (new_url == url && !new_url.match(url_re)) { + // python 2 url without version? + new_url = url.replace(/\.org\//, '.org/' + new_version + '/'); + } + return new_url; + } + + function on_switch() { + var selected = $(this).children('option:selected').attr('value'); + + var url = window.location.href, + new_url = patch_url(url, selected); + + if (new_url != url) { + // check beforehand if url exists, else redirect to version's start page + $.get(new_url, function() { + window.location.href = new_url; + }).error(function() { + window.location.href = 'http://docs.python.org/' + selected; + }); + } + } + + $(document).ready(function() { + var select = build_select(DOCUMENTATION_OPTIONS.VERSION); + $('.version_switcher_placeholder').html(select); + $('.version_switcher_placeholder select').bind('change', on_switch); + }); +})();

    AltStyle によって変換されたページ (->オリジナル) /