Skip to content

Commit 1d7dee3

Browse files
authored
Make oasisctl content less redundant & fix titles (#494)
Fix title substitutions, suppress lead paragraph, don't capitalize command in headline
1 parent 5620740 commit 1d7dee3

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

toolchain/scripts/generators/oasisctl.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
'cacertificate': 'CA Certificate',
3030
'cacertificates': 'CA Certificates',
3131
'diskperformances': 'Disk Performances',
32+
'generate-docs': 'Generate Documentation',
3233
'ipallowlist': 'IP Allowlist',
3334
'ipallowlists': 'IP Allowlists',
3435
'notebookmodels': 'Notebook Models',
@@ -126,8 +127,9 @@ def rewrite_content(data, section, filename, weight):
126127
continue
127128

128129
if flags["inFrontMatter"] and not flags["endFrontMatter"]:
129-
if line.startswith("description: ") and filename.endswith("/options.md"):
130-
content = content + "description: Command-line client tool for managing ArangoGraph\n"
130+
if line.startswith("description: "):
131+
if filename.endswith("/options.md"):
132+
content = content + "description: Command-line client tool for managing ArangoGraph\n"
131133
continue
132134

133135
if line.startswith("layout: "):
@@ -139,13 +141,11 @@ def rewrite_content(data, section, filename, weight):
139141
continue
140142

141143
menuTitle = ""
142-
title = line.replace("title: ", "")
143-
lineWords = title.split(" ")
144-
for word in lineWords:
144+
title = line.rstrip().replace("title: ", "")
145+
for word in title.split(" "):
145146
menuTitle = menuTitle + f" {TITLE_CASE.get(word.lower(), word)}"
146147

147-
menuTitle = menuTitle.replace("Oasisctl ", "")
148-
content = content + f"{line}menuTitle:{menuTitle}weight: {weight}\n"
148+
content = content + f"title: {menuTitle}\nmenuTitle:{menuTitle.replace('Oasisctl ', '')}\nweight: {weight}\n"
149149
continue
150150

151151
if line.startswith("###### Auto generated"):
@@ -169,7 +169,7 @@ def rewrite_content(data, section, filename, weight):
169169
continue
170170

171171
if line.startswith("## "):
172-
content = content + string.capwords(line)
172+
content = content + line
173173
continue
174174

175175
if line == "---\n":

0 commit comments

Comments
 (0)