Skip to content

Commit 3220c9b

Browse files
committed
Add specsanalyzer docs
1 parent e368c22 commit 3220c9b

File tree

3 files changed

+82
-0
lines changed

3 files changed

+82
-0
lines changed

specsanalyzer/index.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>sed-processor documentation</title>
5+
<meta charset="UTF-8" />
6+
<meta http-equiv="refresh" content="0; URL=https://opencompes.github.io/docs/sed/stable/" />
7+
</head>
8+
<body>
9+
<p><a href="https://opencompes.github.io/docs/sed/stable/">Here</a> you find the last stable documentation of sed-processor.</p>
10+
</body>
11+
</html>

specsanalyzer/switcher.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[
2+
{
3+
"name": "latest",
4+
"version": "0.3.3a3",
5+
"url": "https://opencompes.github.io/docs/specsanalyzer/latest"
6+
},
7+
{
8+
"name": "stable",
9+
"version": "0.3.2",
10+
"url": "https://opencompes.github.io/docs/specsanalyzer/v0.3.2",
11+
"preferred": "true"
12+
}
13+
]

specsanalyzer/update_switcher.py

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import json
2+
import sys
3+
4+
if len(sys.argv) != 4:
5+
sys.exit("Usage: update_switcher.py json_file GITHUB_REF VERSION")
6+
7+
switcher_file = sys.argv[1]
8+
branch = sys.argv[2]
9+
version = sys.argv[3]
10+
11+
present = False
12+
with open(switcher_file, encoding="utf-8") as f:
13+
data = json.load(f)
14+
if branch.startswith("refs/tags"): # add a new version tag
15+
version_tag = branch.split("/")[-1]
16+
for item in data:
17+
if version_tag in item.get("name", ""):
18+
present = True
19+
if "stable" in item.get("name", ""):
20+
item["version"] = version
21+
item["url"] = "https://opencompes.github.io/docs/specsanalyzer/" + version_tag
22+
if not present:
23+
new_entry = {}
24+
new_entry["name"] = version_tag
25+
new_entry["version"] = version
26+
new_entry["url"] = "https://opencompes.github.io/docs/specsanalyzer/" + version_tag
27+
data.append(new_entry)
28+
29+
elif branch == "refs/heads/main": # update latest
30+
for item in data:
31+
if "latest" in item.get("name", ""):
32+
item["version"] = version
33+
present = True
34+
break
35+
if not present:
36+
new_entry = {}
37+
new_entry["name"] = "latest"
38+
new_entry["version"] = version
39+
new_entry["url"] = "https://opencompes.github.io/docs/specsanalyzer/latest"
40+
data.append(new_entry)
41+
42+
else: # update develop
43+
for item in data:
44+
if "develop" in item.get("name", ""):
45+
present = True
46+
item["version"] = version
47+
break
48+
if not present:
49+
new_entry = {}
50+
new_entry["name"] = "develop"
51+
new_entry["version"] = version
52+
new_entry["url"] = "https://opencompes.github.io/docs/specsanalyzer/develop"
53+
data.append(new_entry)
54+
55+
print(data)
56+
57+
with open(switcher_file, mode="w", encoding="utf-8") as f:
58+
json.dump(data, f, indent=2)

0 commit comments

Comments
 (0)