Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 19 additions & 15 deletions docs/_static/switcher.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,60 +4,64 @@
"url": "https://python-visualization.github.io/folium/dev/"
},
{
"name": "latest (v0.17.0)",
"version": "latest",
"name": "latest (0.18.0)",
"version": "0.18.0",
"url": "https://python-visualization.github.io/folium/latest/"
},
{
"version": "v0.16.0",
"version": "0.17.0",
"url": "https://python-visualization.github.io/folium/v0.17.0/"
},
{
"version": "0.16.0",
"url": "https://python-visualization.github.io/folium/v0.16.0/"
},
{
"version": "v0.15.1",
"version": "0.15.1",
"url": "https://python-visualization.github.io/folium/v0.15.1/"
},
{
"version": "v0.14.0",
"version": "0.14.0",
"url": "https://python-visualization.github.io/folium/version-v0.14.0/"
},
{
"version": "v0.12.1",
"version": "0.12.1",
"url": "https://python-visualization.github.io/folium/version-v0.12.1/"
},
{
"version": "v0.12.0",
"version": "0.12.0",
"url": "https://python-visualization.github.io/folium/version-v0.12.0/"
},
{
"version": "v0.11.0",
"version": "0.11.0",
"url": "https://python-visualization.github.io/folium/version-v0.11.0/"
},
{
"version": "v0.10.1",
"version": "0.10.1",
"url": "https://python-visualization.github.io/folium/version-v0.10.1/"
},
{
"version": "v0.10.0",
"version": "0.10.0",
"url": "https://python-visualization.github.io/folium/version-v0.10.0/"
},
{
"version": "v0.9.1",
"version": "0.9.1",
"url": "https://python-visualization.github.io/folium/version-v0.9.1/"
},
{
"version": "v0.9.0",
"version": "0.9.0",
"url": "https://python-visualization.github.io/folium/version-v0.9.0/"
},
{
"version": "v0.8.3",
"version": "0.8.3",
"url": "https://python-visualization.github.io/folium/version-v0.8.3/"
},
{
"version": "v0.8.2",
"version": "0.8.2",
"url": "https://python-visualization.github.io/folium/version-v0.8.2/"
},
{
"version": "v0.8.1",
"version": "0.8.1",
"url": "https://python-visualization.github.io/folium/version-v0.8.1/"
}
]
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@

import folium

# N.B. this version is without the "v" prefix
version = release = folium.__version__
print(f"Version: {version}")

Expand Down
22 changes: 12 additions & 10 deletions docs/update_switcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import argparse
import json
import os
import re


def main():
Expand All @@ -16,6 +15,8 @@ def main():
"--version", "-v", required=True, type=str, help="The new version to add"
)
args = parser.parse_args()
# drop the "v" prefix
new_version_without_prefix = args.version[1:]

# Setup path to switcher.json (relative to this script) and load it
switcher_path = os.path.join(os.path.dirname(__file__), "_static", "switcher.json")
Expand All @@ -24,17 +25,18 @@ def main():

# first we get the version number of the previous version
for i, version in enumerate(switcher):
if version["version"] == "latest":
if version.get("name", "").startswith("latest"):
latest_index = i
previous_version = re.search(
r"latest \(([v.\d]+)\)", version["name"]
).group(1)
if previous_version == args.version:
print(f"Version {args.version} already is the latest version. Exiting.")
previous_version = version["version"]
if previous_version == new_version_without_prefix:
print(
f"Version {new_version_without_prefix} already is the latest version. Exiting."
)
return

# now replace the name of this one with the new version
switcher[i]["name"] = f"latest ({args.version})"
# now replace the name and version of this one with the new version
switcher[i]["name"] = f"latest ({new_version_without_prefix})"
switcher[i]["version"] = new_version_without_prefix
break
else:
raise ValueError("'latest' version not found in switcher.json")
Expand All @@ -47,7 +49,7 @@ def main():
else:
previous_version_entry = {
"version": previous_version,
"url": f"https://python-visualization.github.io/folium/{previous_version}/",
"url": f"https://python-visualization.github.io/folium/v{previous_version}/",
}
switcher.insert(latest_index + 1, previous_version_entry)

Expand Down