You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/prompts/plan-upgradeGravDocs.prompt.md
+46-51Lines changed: 46 additions & 51 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,6 +37,8 @@ description: Description here.
37
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
38
39
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.
40
+
>
41
+
> **Implementation note:** When extracting the value after `description:`, use `[ \t]*` (spaces/tabs only) — **not**`\s*` — to avoid crossing newline boundaries. `\s*` will consume the newline and capture the next YAML line (e.g. `taxonomy:`) as the description value when the description is empty.
40
42
41
43
### T2 — Notice Blocks → GitHub Alerts
42
44
@@ -68,6 +70,7 @@ Line two with **bold** and a [link](/page).
68
70
> **Edge cases to handle:**
69
71
> -**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
72
> -**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.
73
+
> -**Notices inside HTML comments** (`<!-- ... -->`): do **not** convert them. Some pages use HTML comments to temporarily disable content; converting notices inside them would corrupt the comment. Detect open comment ranges before processing and skip any notice match whose start position falls within a comment range.
71
74
72
75
### T3 — Image `?resize=` Parameters
73
76
@@ -117,6 +120,8 @@ obsolete: true
117
120
(full contents of other-modular/docs.md pasted here)
118
121
```
119
122
123
+
> **Implementation note:** Modular files often contain backslash sequences (e.g. `\wsl$`, `\h`). When substituting content via regex, **never pass the modular content as a string replacement template** — regex engines interpret `\n`, `\1`, `\h`, etc. as special sequences and will throw an error or silently corrupt the content. Always use a **literal replacement function** (e.g. a lambda that returns the string directly) so the content is treated as a plain string.
124
+
120
125
The modular files themselves are deleted after all injections are resolved (see Phase 6).
121
126
122
127
### T5 — Misc Grav Syntax
@@ -157,6 +162,17 @@ Rules:
157
162
158
163
---
159
164
165
+
## Implementation Strategy
166
+
167
+
**Always implement phases 1–5b as a single Python script** that iterates over all `.md` files in one pass. Manual file-by-file editing across 150+ files is error-prone and non-repeatable. A script also guarantees:
168
+
- All transformations are applied atomically and in the correct order within each file
169
+
- The inlining lambda workaround (T4) is easy to apply
170
+
- The run can be reset via `git checkout -- app/pages/{version}/` and rerun after any fix
171
+
172
+
Save the script alongside the pages (e.g. `_meta/upgrade_grav_{version}.py`) and delete it after the upgrade is verified.
173
+
174
+
---
175
+
160
176
## Execution Phases
161
177
162
178
### Phase 0 — Discovery (run before everything else)
Report findings before proceeding. If any unknown shortcode patterns are found, flag them and wait for instructions.
@@ -202,38 +218,15 @@ For each injection point found in Phase 0:
202
218
4. For all other modular files → read the file's full content and paste it verbatim in place of the inject line
203
219
5. Confirm all injection points are resolved
204
220
205
-
### Phase 2 — Notice Conversion (T2)
206
-
207
-
Convert all `[notice...]` blocks across all files using the T2 mapping table. Run *after* Phase 1 so inlined content is also covered.
208
-
209
-
### Phase 3 — Frontmatter Upgrade (T1)
210
-
211
-
Flatten `metadata.description` and remove `taxonomy:` blocks across all files. *Can run in parallel with Phase 2.*
212
-
213
-
After running, verify no files contain `description: taxonomy:` (sign of empty-description regex bleed) and no unquoted descriptions containing a colon:
221
+
### Phase 2–5b — Apply All Remaining Transformations (T1–T6)
grep -Frn '?resize=' app/pages/{version}/# -F for literal ? matching
249
+
grep -rn '\[size=' app/pages/{version}/
257
250
```
258
251
252
+
> **Note on the `[notice` check:** Results that appear inside HTML comment blocks (`<!-- ... -->`) are **expected and acceptable** — those notices were intentionally commented out in the source and must not be converted. Confirm any hits are inside `<!--` … `-->` before treating them as failures.
0 commit comments