Skip to content

Commit e590650

Browse files
HeyItsGilbertclaude
andcommitted
Address PR review feedback on archetypes setup
- frontmatter.json: write event startDate/endDate as date-only (yyyy-MM-dd) so Front Matter CMS doesn't add a time component and drift from existing calendar files - add-article.yml: strip HTML from scalar front matter fields (parity with add-event.yml), normalize CRLF and tolerate whitespace around the markdown content fences, and fall back to article-<issue#> when a title produces an empty slug Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 22c4247 commit e590650

2 files changed

Lines changed: 21 additions & 10 deletions

File tree

.github/workflows/add-article.yml

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,12 @@ jobs:
2828
python3 - <<'PYEOF'
2929
import os, re, datetime, yaml
3030
31-
body = os.environ['ISSUE_BODY']
31+
# Normalize line endings — issue bodies can contain CRLF.
32+
body = os.environ['ISSUE_BODY'].replace('\r\n', '\n').replace('\r', '\n')
33+
34+
def strip_html(s):
35+
# Strip raw HTML from scalar front matter values (matches add-event.yml).
36+
return re.sub(r'<[^>]+>', '', s).strip()
3237
3338
def field(label):
3439
m = re.search(rf'### {re.escape(label)}\s+(.+?)(?=\n###|\Z)', body, re.DOTALL)
@@ -37,16 +42,17 @@ jobs:
3742
val = m.group(1).strip()
3843
return '' if val in ('_No response_', '') else val
3944
40-
title = field('Article Title')
41-
author = field('Author Name')
42-
description = field('Description')
43-
category = field('Category')
44-
tags_raw = field('Tags (optional)')
45+
title = strip_html(field('Article Title'))
46+
author = strip_html(field('Author Name'))
47+
description = strip_html(field('Description'))
48+
category = strip_html(field('Category'))
49+
tags_raw = strip_html(field('Tags (optional)'))
4550
content = field('Article Content (Markdown)')
4651
47-
# The Article Content field is rendered as a ```markdown fenced block — unwrap it.
48-
content = re.sub(r'^```[a-zA-Z]*\n', '', content)
49-
content = re.sub(r'\n```$', '', content).strip()
52+
# The Article Content field is rendered as a ```markdown fenced block — unwrap it,
53+
# tolerating surrounding whitespace/blank lines around the fences.
54+
content = re.sub(r'^\s*```[a-zA-Z]*[ \t]*\n', '', content)
55+
content = re.sub(r'\n```[ \t]*\s*$', '', content).strip()
5056
5157
if not title:
5258
raise SystemExit('No article title found; aborting.')
@@ -63,6 +69,9 @@ jobs:
6369
date_str = today.strftime('%Y-%m-%dT%H:%M:%S+00:00')
6470
6571
slug = re.sub(r'[^a-z0-9]+', '-', title.lower()).strip('-')
72+
if not slug:
73+
# Title was only punctuation / non-ASCII — fall back to the issue number.
74+
slug = f"article-{os.environ['ISSUE_NUMBER']}"
6675
filename = f"{today.strftime('%Y-%m-%d')}-{slug}.md"
6776
6877
fm = {

frontmatter.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,13 +148,15 @@
148148
"title": "Start date",
149149
"name": "startDate",
150150
"type": "datetime",
151+
"dateFormat": "yyyy-MM-dd",
151152
"isPublishDate": true,
152153
"required": true
153154
},
154155
{
155156
"title": "End date",
156157
"name": "endDate",
157-
"type": "datetime"
158+
"type": "datetime",
159+
"dateFormat": "yyyy-MM-dd"
158160
},
159161
{
160162
"title": "Where",

0 commit comments

Comments
 (0)