Skip to content

Commit 87f78da

Browse files
committed
Enhancement: Add authors to sync table and trigger update
1 parent 38f74fe commit 87f78da

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

scripts/generate_readme_table.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
import yaml
22
import sys
3+
import re
4+
5+
def slugify(text):
6+
text = str(text).lower().strip()
7+
text = re.sub(r'\s+', '-', text)
8+
text = re.sub(r'[^\w\-]+', '', text)
9+
return re.sub(r'\-\-+', '-', text)
310

411
def generate_table():
512
with open('src/data/lessons.yml', 'r') as f:
613
data = yaml.safe_load(f)
714

815
# Table Header
9-
markdown = "| Lesson | Status | Links |\n"
10-
markdown += "| :--- | :--- | :--- |\n"
16+
markdown = "| Lesson | Authors | Status | Links |\n"
17+
markdown += "| :--- | :--- | :--- | :--- |\n"
1118

1219
for lesson in data['lessons']:
1320
# Skip external resources if you only want your curriculum
@@ -17,6 +24,16 @@ def generate_table():
1724
name = lesson['name']
1825
status = lesson.get('status', 'Unknown')
1926

27+
# Build Author Links
28+
authors = lesson.get('authors', [])
29+
author_links = []
30+
if authors:
31+
for author in authors:
32+
slug = slugify(author)
33+
link = f"[{author}](https://ucla-imls-open-sci.info/authors/{slug})"
34+
author_links.append(link)
35+
author_str = ", ".join(author_links)
36+
2037
# Build Links
2138
links = []
2239
if lesson.get('url'):
@@ -35,7 +52,7 @@ def generate_table():
3552
elif 'pre' in status.lower():
3653
status_badge = f"⚪ {status}"
3754

38-
markdown += f"| {name} | {status_badge} | {link_str} |\n"
55+
markdown += f"| {name} | {author_str} | {status_badge} | {link_str} |\n"
3956

4057
return markdown
4158

src/data/lessons.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,4 +557,4 @@ lessons:
557557
- Contrast CARE with FAIR.
558558
- Recognize ethical dimensions of data governance.
559559
url: https://www.gida-global.org/care
560-
repo: null
560+
repo: null

0 commit comments

Comments
 (0)