Skip to content

Commit c73567d

Browse files
committed
Enhance upgrade plan with additional edge cases for metadata handling and notice conversion, learned from the 5.1 upgrade
1 parent 7841617 commit c73567d

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

.github/prompts/plan-upgradeGravDocs.prompt.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,12 @@ description: Description here.
3131

3232
- `metadata.description` → promoted to top-level `description:`
3333
- `taxonomy:` block → removed entirely
34-
- Pages with no `metadata.description` → keep only `title:`
34+
- Pages with no `metadata.description` (empty or missing value) → keep only `title:`, do **not** emit `description:` at all
3535
- Do not add any other fields
3636
- If the description value is wrapped in YAML double quotes (e.g. `"Some text."`), strip the surrounding quotes in the output — unless the value contains a colon (`:`), in which case keep the quotes for valid YAML
37+
- If the description value is **not** quoted but **contains a colon** (`:`) in its text, wrap the entire value in double quotes to produce valid YAML (e.g. `description: "Some text: here."`)
38+
39+
> **Edge case:** When `metadata.description:` is present but empty (no value on the line), the regex must not consume the next YAML line. Always check that the extracted description value is non-empty before promoting it.
3740
3841
### T2 — Notice Blocks → GitHub Alerts
3942

@@ -62,6 +65,10 @@ Line two with **bold** and a [link](/page).
6265
> Line two with **bold** and a [link](/page).
6366
```
6467

68+
> **Edge cases to handle:**
69+
> - **Indented notices** (e.g. inside a numbered list): ` [notice=tip]...[/notice]` — match regardless of leading whitespace, not just at line start. Move the converted alert block *outside* the list item (alerts cannot be nested in list items).
70+
> - **Inline notices** (opening tag mid-sentence): e.g. `Some text. [notice]Warning.[/notice]` — split the sentence before the tag, then output the alert on its own line.
71+
6572
### T3 — Image `?resize=` Parameters
6673

6774
Remove Grav's image processing query parameters from all image references:
@@ -203,6 +210,13 @@ Convert all `[notice...]` blocks across all files using the T2 mapping table. Ru
203210

204211
Flatten `metadata.description` and remove `taxonomy:` blocks across all files. *Can run in parallel with Phase 2.*
205212

213+
After running, verify no files contain `description: taxonomy:` (sign of empty-description regex bleed) and no unquoted descriptions containing a colon:
214+
215+
```bash
216+
grep -rn "description: taxonomy:" app/pages/{version}/
217+
grep -rn '^description:' app/pages/{version}/ | grep ':' | grep -v 'description: "'
218+
```
219+
206220
### Phase 4 — Image Path Cleanup (T3)
207221

208222
Remove `?resize=` parameters from all files identified in Phase 0. *Can run in parallel with Phase 2.*
@@ -255,4 +269,10 @@ grep -rEn "\]\([a-z]" app/pages/{version}/ | grep -v "http"
255269

256270
Also verify:
257271
- Modular folders no longer exist under `app/pages/{version}/`
272+
- No `description: taxonomy:` values (empty-description regex bleed)
273+
- No unquoted `description:` values containing a colon — run:
274+
```bash
275+
# Descriptions with colons that are not wrapped in double quotes
276+
grep -rn '^description:' app/pages/{version}/ | grep ':' | grep -v 'description: "'
277+
```
258278
- Spot-check 5–6 converted pages for correct frontmatter, alert rendering, and working links in the dev server

0 commit comments

Comments
 (0)