From 680f1d8daed83e2f5091358f775673203a95d424 Mon Sep 17 00:00:00 2001 From: Jarrod Millman Date: Tue, 27 Feb 2024 12:15:42 -0800 Subject: [PATCH] Use grid of cards for team gallery --- Makefile | 10 ++--- doc/content/about/_index.md | 2 +- doc/content/about/theme-team.toml | 44 ++++++++++++++++++++++ doc/static/teams/theme-team.html | 61 ------------------------------- tools/team_query.py | 36 +++++------------- 5 files changed, 60 insertions(+), 93 deletions(-) create mode 100644 doc/content/about/theme-team.toml delete mode 100644 doc/static/teams/theme-team.html diff --git a/Makefile b/Makefile index 930aec03..03b6cb8f 100644 --- a/Makefile +++ b/Makefile @@ -2,23 +2,23 @@ .DEFAULT_GOAL := doc-serve GH_ORG = scientific-python -TEAMS_DIR = doc/static/teams +TEAMS_DIR = doc/content/about TEAMS = theme-team TEAMS_QUERY = python tools/team_query.py $(TEAMS_DIR): mkdir -p $(TEAMS_DIR) -$(TEAMS_DIR)/%.md: $(TEAMS_DIR) +$(TEAMS_DIR)/%.toml: $(TEAMS_DIR) $(eval TEAM_NAME=$(shell python -c "import re; print(' '.join(x.capitalize() for x in re.split('-|_', '$*')))")) - $(TEAMS_QUERY) --org $(GH_ORG) --team "$*" > $(TEAMS_DIR)/$*.html + $(TEAMS_QUERY) --org $(GH_ORG) --team "$*" > $(TEAMS_DIR)/$*.toml teams-clean: for team in $(TEAMS); do \ - rm -f $(TEAMS_DIR)/$${team}.html ;\ + rm -f $(TEAMS_DIR)/$${team}.toml ;\ done -teams: | teams-clean $(patsubst %,$(TEAMS_DIR)/%.md,$(TEAMS)) +teams: | teams-clean $(patsubst %,$(TEAMS_DIR)/%.toml,$(TEAMS)) doc/content/shortcodes.md: $(wildcard layouts/shortcodes/*.html) (cd layouts && python ../tools/render_shortcode_docs.py > ../doc/content/shortcodes.md) diff --git a/doc/content/about/_index.md b/doc/content/about/_index.md index 7bbde830..b7470b36 100644 --- a/doc/content/about/_index.md +++ b/doc/content/about/_index.md @@ -7,4 +7,4 @@ The **Scientific Python Hugo Theme** is a theme for the [Hugo](https://gohugo.io) static site generator built on the [Fresh](https://github.com/StefMa/hugo-fresh) theme. -{{< include-html "static/teams/theme-team.html" >}} +{{< grid1 file="theme-team.toml" columns="2 3 4 5" />}} diff --git a/doc/content/about/theme-team.toml b/doc/content/about/theme-team.toml new file mode 100644 index 00000000..14414bab --- /dev/null +++ b/doc/content/about/theme-team.toml @@ -0,0 +1,44 @@ +[[item]] +type = 'card' +header = 'Adam Porter' +body = '''{{< image >}} +src = 'https://avatars.githubusercontent.com/u/601365?v=4"' +alt = 'Avatar of Adam Porter' +{{< /image >}}''' +link = 'https://github.com/alphapapa' + +[[item]] +type = 'card' +header = 'Brian Hawthorne' +body = '''{{< image >}} +src = 'https://avatars.githubusercontent.com/u/352264?u=1fd523aa28b0451454989400579d97a8c1bc1b9a&v=4"' +alt = 'Avatar of Brian Hawthorne' +{{< /image >}}''' +link = 'https://github.com/brianhawthorne' + +[[item]] +type = 'card' +header = 'Jarrod Millman' +body = '''{{< image >}} +src = 'https://avatars.githubusercontent.com/u/123428?v=4"' +alt = 'Avatar of Jarrod Millman' +{{< /image >}}''' +link = 'https://github.com/jarrodmillman' + +[[item]] +type = 'card' +header = 'Stefan van der Walt' +body = '''{{< image >}} +src = 'https://avatars.githubusercontent.com/u/45071?u=c779b5e06448fbc638bc987cdfe305c7f9a7175e&v=4"' +alt = 'Avatar of Stefan van der Walt' +{{< /image >}}''' +link = 'https://github.com/stefanv' + +[[item]] +type = 'card' +header = 'Pamphile Roy' +body = '''{{< image >}} +src = 'https://avatars.githubusercontent.com/u/23188539?u=64445b52dbf3f75de8006ed4264fdd2afaed97a3&v=4"' +alt = 'Avatar of Pamphile Roy' +{{< /image >}}''' +link = 'https://github.com/tupui' diff --git a/doc/static/teams/theme-team.html b/doc/static/teams/theme-team.html deleted file mode 100644 index bc3b24f4..00000000 --- a/doc/static/teams/theme-team.html +++ /dev/null @@ -1,61 +0,0 @@ -
-

Theme Team

- -
diff --git a/tools/team_query.py b/tools/team_query.py index 94764607..eb3e4d7a 100644 --- a/tools/team_query.py +++ b/tools/team_query.py @@ -61,30 +61,17 @@ def api(query): members = resp["data"]["organization"]["team"]["members"]["nodes"] team_name = resp["data"]["organization"]["team"]["name"] -team_template = string.Template( - """\ -
-

${team_name}

-
-${members} -
-
""" -) - member_template = string.Template( """\ -
- -
- Avatar of ${name} -
- ${name} -
-
""" +[[item]] +type = 'card' +header = '${name}' +body = '''{{< image >}} +src = '${avatarUrl}"' +alt = 'Avatar of ${name}' +{{< /image >}}''' +link = '${url}' +""" ) members_list = [] @@ -92,7 +79,4 @@ def api(query): m["name"] = m["name"] or m["login"] members_list.append(member_template.substitute(**m)) -members_str = "".join(members_list) -team_str = team_template.substitute(members=members_str, team=team, team_name=team_name) - -print(team_str) +print("\n".join(members_list).rstrip())