Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
55f23c42
Commit
55f23c42
authored
Oct 28, 2012
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#8040: port versionswitcher patch to 2.6.
parent
cca96f09
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
78 additions
and
3 deletions
+78
-3
Doc/Makefile
Doc/Makefile
+1
-1
Doc/tools/sphinxext/layout.html
Doc/tools/sphinxext/layout.html
+11
-2
Doc/tools/sphinxext/static/version_switch.js
Doc/tools/sphinxext/static/version_switch.js
+66
-0
No files found.
Doc/Makefile
View file @
55f23c42
...
@@ -164,7 +164,7 @@ check:
...
@@ -164,7 +164,7 @@ check:
# for development releases: always build
# for development releases: always build
autobuild-dev
:
autobuild-dev
:
make update
make update
make dist
SPHINXOPTS
=
'-A daily=1'
make dist
SPHINXOPTS
=
'-A daily=1
-A versionswitcher=1
'
# for stable releases: only build if not in pre-release stage (alpha, beta, rc)
# for stable releases: only build if not in pre-release stage (alpha, beta, rc)
autobuild-stable
:
autobuild-stable
:
...
...
Doc/tools/sphinxext/layout.html
View file @
55f23c42
...
@@ -2,17 +2,26 @@
...
@@ -2,17 +2,26 @@
{% block rootrellink %}
{% block rootrellink %}
<li><img
src=
"{{ pathto('_static/py.png', 1) }}"
alt=
""
<li><img
src=
"{{ pathto('_static/py.png', 1) }}"
alt=
""
style=
"vertical-align: middle; margin-top: -1px"
/></li>
style=
"vertical-align: middle; margin-top: -1px"
/></li>
<li><a
href=
"{{ pathto('index') }}"
>
{{ shorttitle }}
</a>
{{ reldelim1 }}
</li>
<li><a
href=
"http://www.python.org/"
>
Python
</a>
{{ reldelim1 }}
</li>
<li>
{%- if versionswitcher is defined %}
<span
class=
"version_switcher_placeholder"
>
{{ release }}
</span>
<a
href=
"{{ pathto('index') }}"
>
Documentation
</a>
{{ reldelim1 }}
{%- else %}
<a
href=
"{{ pathto('index') }}"
>
{{ shorttitle }}
</a>
{{ reldelim1 }}
{%- endif %}
</li>
{% endblock %}
{% endblock %}
{% block extrahead %}
{% block extrahead %}
<link
rel=
"shortcut icon"
type=
"image/png"
href=
"{{ pathto('_static/py.png', 1) }}"
/>
<link
rel=
"shortcut icon"
type=
"image/png"
href=
"{{ pathto('_static/py.png', 1) }}"
/>
{% if versionswitcher is defined and not embedded %}
<script
type=
"text/javascript"
src=
"{{ pathto('_static/version_switch.js', 1) }}"
></script>
{% endif %}
{{ super() }}
{{ super() }}
{% endblock %}
{% endblock %}
{% block footer %}
{% block footer %}
<div
class=
"footer"
>
<div
class=
"footer"
>
©
<a
href=
"{{ pathto('copyright') }}"
>
Copyright
</a>
{{ copyright|e }}.
©
<a
href=
"{{ pathto('copyright') }}"
>
Copyright
</a>
{{ copyright|e }}.
<br
/>
<br
/>
The Python Software Foundation is a non-profit corporation.
The Python Software Foundation is a non-profit corporation.
<a
href=
"http://www.python.org/psf/donations/"
>
Please donate.
</a>
<a
href=
"http://www.python.org/psf/donations/"
>
Please donate.
</a>
<br
/>
<br
/>
Last updated on {{ last_updated|e }}.
Last updated on {{ last_updated|e }}.
...
...
Doc/tools/sphinxext/static/version_switch.js
0 → 100644
View file @
55f23c42
(
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
,
current_release
)
{
var
buf
=
[
'
<select>
'
];
$
.
each
(
all_versions
,
function
(
version
,
title
)
{
buf
.
push
(
'
<option value="
'
+
version
+
'
"
'
);
if
(
version
==
current_version
)
buf
.
push
(
'
selected="selected">
'
+
current_release
+
'
</option>
'
);
else
buf
.
push
(
'
>
'
+
title
+
'
</option>
'
);
});
buf
.
push
(
'
</select>
'
);
return
buf
.
join
(
''
);
}
function
patch_url
(
url
,
new_version
)
{
var
url_re
=
/
\.
org
\/(\d
|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
$
.
ajax
({
url
:
new_url
,
success
:
function
()
{
window
.
location
.
href
=
new_url
;
},
error
:
function
()
{
window
.
location
.
href
=
'
http://docs.python.org/
'
+
selected
;
}
});
}
}
$
(
document
).
ready
(
function
()
{
var
release
=
DOCUMENTATION_OPTIONS
.
VERSION
;
var
version
=
release
.
substr
(
0
,
3
);
var
select
=
build_select
(
version
,
release
);
$
(
'
.version_switcher_placeholder
'
).
html
(
select
);
$
(
'
.version_switcher_placeholder select
'
).
bind
(
'
change
'
,
on_switch
);
});
})();
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment