Skip to content

Commit 7d33017

Browse files
Added Latest LTS versions entry if current branch is lts
Signed-off-by: Ihor Aleksandrychiev <[email protected]>
1 parent 0cae6d4 commit 7d33017

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

generator/_scripts/cfdoc_patch_header_nav.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,20 @@
2525
import sys
2626

2727

28-
def patch(current_branch):
28+
def patch(current_branch, lts_version):
2929
url = "https://docs.cfengine.com/docs/branches.json"
3030
response = urllib.request.urlopen(url)
3131
data = json.loads(response.read())
3232

3333
with open("_includes/header_nav_options.html", "w") as f:
34+
# Add Latest LTS entry if current branch is lts
35+
if current_branch == "lts":
36+
print(
37+
'<a onclick="selectVersion(\'javascript:void(0);\')" href="#" selected="selected">Latest LTS (%s)</a>'
38+
% lts_version,
39+
file=f,
40+
)
41+
3442
for branch in data["docs"]:
3543
if (
3644
"(LTS)" not in branch["Title"]

generator/_scripts/cfdoc_preprocess.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
linkresolver.run(config)
4646
# generate links to known targets
4747
linkresolver.apply(config)
48-
patch_header_nav.patch(sys.argv[1])
48+
patch_header_nav.patch(sys.argv[1], sys.argv[2])
4949
references_resolver.run(config)
5050
shortcodes_resolver.run(config)
5151
images_path_resolver.run(config)

generator/build/main.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ fi
138138
./_regenerate_json.sh || exit 4
139139

140140
# Preprocess Documentation with custom macros
141-
./_scripts/cfdoc_preprocess.py "$BRANCH" || exit 5
141+
./_scripts/cfdoc_preprocess.py "$BRANCH" "$LTS_VERSION" || exit 5
142142

143143
# rvm commands are insane scripts which pollut output
144144
# so instead of set -x we just echo each command ourselves

0 commit comments

Comments
 (0)