Skip to content

Commit c0cf150

Browse files
Refactor table such that descriptions are nested under titles
1 parent b1b653a commit c0cf150

1 file changed

Lines changed: 5 additions & 9 deletions

File tree

build_support/catalog/update.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,31 +15,27 @@ def generate_rst_table(df: pd.DataFrame, rst_path: Path):
1515
with open(rst_path, "w", encoding="utf-8") as f:
1616
f.write(".. list-table::\n")
1717
f.write(" :header-rows: 1\n")
18-
f.write(" :widths: 20 20 80 20\n")
18+
f.write(" :widths: 20 80 20\n")
1919
f.write(" :class: tight-table\n")
2020
f.write("\n")
2121

2222
f.write(" * - **Game**\n")
23-
f.write(" - **Title**\n")
2423
f.write(" - **Description**\n")
2524
f.write(" - **Download**\n")
2625

2726
for _, row in df.iterrows():
2827
f.write(f" * - {row['Game']}\n")
29-
f.write(f" - {row['Title']}\n")
3028

3129
description_cell_lines = []
30+
title = str(row.get("Title", "")).strip()
3231
description = str(row.get("Description", "")).strip()
33-
# Create a single-line summary for the dropdown title
34-
temp_desc_for_summary = description.replace("\n", " ")
35-
if len(description) > 80 and ". " in temp_desc_for_summary:
36-
summary = temp_desc_for_summary.split(". ", 1)[0] + "."
37-
description_cell_lines.append(f".. dropdown:: {summary}")
32+
if description:
33+
description_cell_lines.append(f".. dropdown:: {title}")
3834
description_cell_lines.append(" ") # Indented blank line
3935
for line in description.splitlines():
4036
description_cell_lines.append(f" {line}")
4137
else:
42-
description_cell_lines.append(description.replace("\n", " "))
38+
description_cell_lines.append(title)
4339

4440
f.write(f" - {description_cell_lines[0]}\n")
4541
for line in description_cell_lines[1:]:

0 commit comments

Comments
 (0)