Skip to content

Commit af0b577

Browse files
aleoligiorio94
authored andcommitted
doc fix
1 parent 9be1012 commit af0b577

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

docs/conf.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import semver
2+
import requests
23

34
# Configuration file for the Sphinx documentation builder.
45
#
@@ -107,10 +108,14 @@ def __get_download_url(file: str) -> str:
107108

108109
# generate_clone_example generates the clone and checkout code for the given example.
109110
def generate_clone_example(example_name: str) -> str:
111+
version = html_context['github_version']
112+
if 'current_version' in html_context and html_context['current_version'] == 'stable':
113+
x = requests.get('https://api.github.com/repos/liqotech/liqo/releases/latest')
114+
version = x.json()['tag_name']
110115
return f"```bash\n\
111116
git clone https://github.com/liqotech/liqo.git\n\
112117
cd liqo\n\
113-
git checkout {html_context['github_version']}\n\
118+
git checkout {version}\n\
114119
cd examples/{example_name}\n\
115120
./setup.sh\n\
116121
```\n"
@@ -137,11 +142,11 @@ def generate_liqoctl_install(platform: str, arch: str) -> str:
137142

138143
# __is_sem_version returns True if the given string is a semantic version or the 'stable' string.
139144
def __is_sem_version(version: str) -> bool:
140-
return version == 'stable' or semver.VersionInfo.isvalid(version.lstrip("v"))
145+
return semver.VersionInfo.isvalid(version.lstrip("v"))
141146

142147
# generate_liqoctl_version_warning generates the liqoctl version warning when the documentation is not for a released version.
143148
def generate_liqoctl_version_warning() -> str:
144-
if 'github_version' not in html_context or not __is_sem_version(html_context['github_version']):
149+
if 'current_version' not in html_context or (not __is_sem_version(html_context['current_version']) and html_context['current_version'] != 'stable'):
145150
return "```{warning}\n\
146151
The following instructions will guide you through the installation of the **latest stable version of *liqoctl***, which might exhibit a different behavior compared to the one shown in the rest of this documentation. If you want to use the latest *liqoctl* version, [build it from source](InstallationLiqoctlFromSource).\n\
147152
```\n"

0 commit comments

Comments
 (0)