mirror of
https://github.com/vale981/sphinx-multiversion
synced 2025-03-04 17:11:39 -05:00
Fix handling of absolute paths
This commit is contained in:
parent
9a7966057a
commit
e7dfaff99b
4 changed files with 34 additions and 7 deletions
|
@ -7,6 +7,15 @@ Changelog
|
||||||
Version 0.2
|
Version 0.2
|
||||||
===========
|
===========
|
||||||
|
|
||||||
|
Version 0.2.1
|
||||||
|
-------------
|
||||||
|
|
||||||
|
* Fix handling of absolute output paths in `vpathto` and ensure that all generated paths are relative.
|
||||||
|
|
||||||
|
|
||||||
|
Version 0.2.0
|
||||||
|
-------------
|
||||||
|
|
||||||
* Added a way to override config variables using placeholders that expand to each version's actual value (`#4 <issue4_>`_, `#7 <issue7_>`_).
|
* Added a way to override config variables using placeholders that expand to each version's actual value (`#4 <issue4_>`_, `#7 <issue7_>`_).
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import time
|
||||||
|
|
||||||
author = "Jan Holthuis"
|
author = "Jan Holthuis"
|
||||||
project = "sphinx-multiversion"
|
project = "sphinx-multiversion"
|
||||||
release = "0.2.0"
|
release = "0.2.1"
|
||||||
version = "0.2"
|
version = "0.2"
|
||||||
copyright = "{}, {}".format(time.strftime("%Y"), author)
|
copyright = "{}, {}".format(time.strftime("%Y"), author)
|
||||||
|
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -20,7 +20,7 @@ setup(
|
||||||
author="Jan Holthuis",
|
author="Jan Holthuis",
|
||||||
author_email="holthuis.jan@googlemail.com",
|
author_email="holthuis.jan@googlemail.com",
|
||||||
url="https://holzhaus.github.io/sphinx-multiversion/",
|
url="https://holzhaus.github.io/sphinx-multiversion/",
|
||||||
version="0.2.0",
|
version="0.2.1",
|
||||||
install_requires=["sphinx >= 2.1"],
|
install_requires=["sphinx >= 2.1"],
|
||||||
license="BSD",
|
license="BSD",
|
||||||
packages=["sphinx_multiversion"],
|
packages=["sphinx_multiversion"],
|
||||||
|
|
|
@ -99,13 +99,31 @@ class VersionInfo:
|
||||||
|
|
||||||
# Find output root
|
# Find output root
|
||||||
current_version = self.metadata[self.current_version_name]
|
current_version = self.metadata[self.current_version_name]
|
||||||
relpath = pathlib.PurePath(current_version["outputdir"])
|
other_version = self.metadata[other_version_name]
|
||||||
relpath_dir = relpath.joinpath(self.context["pagename"]).parent
|
outputroot = os.path.commonpath(
|
||||||
outputroot = os.path.join(*(".." for x in relpath_dir.parts))
|
(current_version["outputdir"], other_version["outputdir"])
|
||||||
|
)
|
||||||
|
|
||||||
|
current_outputroot = pathlib.PurePath(
|
||||||
|
current_version["outputdir"]
|
||||||
|
).relative_to(outputroot)
|
||||||
|
other_outputroot = pathlib.PurePath(
|
||||||
|
other_version["outputdir"]
|
||||||
|
).relative_to(outputroot)
|
||||||
|
|
||||||
|
relative_path_to_outputroot = os.path.join(
|
||||||
|
*(
|
||||||
|
".."
|
||||||
|
for x in current_outputroot.joinpath(
|
||||||
|
self.context["pagename"]
|
||||||
|
).parent.parts
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
# Find output dir of other version
|
# Find output dir of other version
|
||||||
other_version = self.metadata[other_version_name]
|
outputdir = posixpath.join(
|
||||||
outputdir = posixpath.join(outputroot, other_version["outputdir"])
|
relative_path_to_outputroot, other_outputroot
|
||||||
|
)
|
||||||
|
|
||||||
if not self.vhasdoc(other_version_name):
|
if not self.vhasdoc(other_version_name):
|
||||||
return posixpath.join(outputdir, "index.html")
|
return posixpath.join(outputdir, "index.html")
|
||||||
|
|
Loading…
Add table
Reference in a new issue