mirror of
https://github.com/mustbeperfect/definitive-opensource.git
synced 2026-04-21 08:15:39 +02:00
Fixed backticks still in applications.json platform tags
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import json
|
||||
|
||||
def slugify(name):
|
||||
#Create an anchor-friendly slug from a string.
|
||||
#Create an anchor-friendly slug from a string
|
||||
return name.lower().replace(" ", "-").replace("(", "").replace(")", "")
|
||||
|
||||
def generate_table_of_contents():
|
||||
@@ -18,15 +18,15 @@ def generate_table_of_contents():
|
||||
for name in subcat_names:
|
||||
alphabetical_md += f"- [{name}](#{slugify(name)})\n"
|
||||
|
||||
# Build the categorized list.
|
||||
# Create a mapping from parent id to parent name.
|
||||
# Build the categorized list
|
||||
# Create a mapping from parent id to parent name
|
||||
parent_map = {cat["id"]: cat["Name"] for cat in categories}
|
||||
# Group subcategories by their parent id.
|
||||
# Group subcategories by their parent id
|
||||
grouped = {}
|
||||
for sub in subcategories:
|
||||
parent = sub.get("parent", "other")
|
||||
grouped.setdefault(parent, []).append(sub["Name"])
|
||||
# Sort each group's subcategories alphabetically.
|
||||
# Sort each group's subcategories alphabetically
|
||||
for key in grouped:
|
||||
grouped[key].sort(key=lambda x: x.lower())
|
||||
# Sort parent categories (exclude "other", which is appended at the end)
|
||||
@@ -41,7 +41,7 @@ def generate_table_of_contents():
|
||||
for subname in grouped[pid]:
|
||||
categorized_md_lines.append(f" - [{subname}](#{slugify(subname)})")
|
||||
|
||||
# Append fixed sections at the end of the categorized TOC.
|
||||
# Append fixed sections at the end of the categorized TOC
|
||||
fixed_sections = ["Removed Projects", "FAQ", "Honorable Mentions of Closed-Source Software"]
|
||||
for item in fixed_sections:
|
||||
categorized_md_lines.append(f"- [{item}](#{slugify(item)})")
|
||||
|
||||
Reference in New Issue
Block a user