Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
609e0c58
Unverified
Commit
609e0c58
authored
Jun 24, 2020
by
Sylvain Gugger
Committed by
GitHub
Jun 24, 2020
Browse files
Fix links (#5248)
parent
c9163a8d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
docs/source/_static/js/custom.js
docs/source/_static/js/custom.js
+9
-2
No files found.
docs/source/_static/js/custom.js
View file @
609e0c58
...
...
@@ -85,8 +85,12 @@ function addVersionControl() {
// To grab the version currently in view, we parse the url
const
parts
=
location
.
toString
().
split
(
'
/
'
);
let
versionIndex
=
parts
.
length
-
2
// Index page may not have a last part with filename.html so we need to go up
if
(
!
parts
[
versionIndex
].
match
(
/
\.
html$/
))
{
versionIndex
=
parts
.
length
-
1
}
// Main classes and models are nested so we need to go deeper
if
(
parts
[
versionIndex
]
==
"
main_classes
"
||
parts
[
versionIndex
]
==
"
model_doc
"
)
{
else
if
(
parts
[
versionIndex
]
==
"
main_classes
"
||
parts
[
versionIndex
]
==
"
model_doc
"
)
{
versionIndex
=
parts
.
length
-
3
}
const
version
=
parts
[
versionIndex
];
...
...
@@ -96,7 +100,10 @@ function addVersionControl() {
const
htmlLines
=
[];
for
(
const
[
key
,
value
]
of
Object
.
entries
(
versionMapping
))
{
var
urlParts
=
(
key
==
""
)
?
[]
:
[
key
];
var
urlParts
=
parts
.
slice
(
0
,
versionIndex
-
1
);
if
(
key
!=
""
)
{
urlParts
=
urlParts
.
concat
([
key
]);
}
urlParts
=
urlParts
.
concat
(
parts
.
slice
(
versionIndex
));
htmlLines
.
push
(
`<a href="
${
urlParts
.
join
(
'
/
'
)}
">
${
value
}
</a>`
);
}
...
...
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