diff --git a/.changeset/skill-content-corrections.md b/.changeset/skill-content-corrections.md new file mode 100644 index 0000000..1206f43 --- /dev/null +++ b/.changeset/skill-content-corrections.md @@ -0,0 +1,21 @@ +--- +"@makespdf/cli": patch +--- + +Refresh the baked-in `pdf-template-author.md` snapshot from the monorepo +after the MAK-305 content corrections (lecstor/makespdf#379). Three +corrections to what `makespdf skill` prints: + +- **§ Script shape** no longer claims the DSL subset is `const`-only with no + `if` statements. It reads "only `const`/`let` declarations at the top + level — no loops, no `switch`, no bare identifiers", which is what the + executor actually enforces and what the DSL Traps section already said. +- **Step 6** uses `template.js` in its `preview` / `validate` examples. The + old `template.dsl` was rejected by both commands (`unknown template + extension ".dsl"`). +- The `lang` bullet links `/skills/pdf-fonts.md` like the file's other + references. + +Also carries the `translate`-before-`rotate` note from MAK-245, which had +not reached the snapshot yet. No code changes — `scripts/bake-skill.mjs` +picks the new markdown up at build time. diff --git a/skills/pdf-template-author.md b/skills/pdf-template-author.md index 0cd331b..d58f761 100644 --- a/skills/pdf-template-author.md +++ b/skills/pdf-template-author.md @@ -272,8 +272,9 @@ Output ONLY valid JavaScript. No markdown fences, no explanations. The script mu ### Script shape -The script is data, not a program: only `const` declarations at the top -level — no `for`/`while` loops, no `if` statements, no bare identifiers. +The script is data, not a program: declare with `const`/`let` at the +top level — no loops, no `switch`, no bare identifiers. A top-level +`if`/`else` or ternary is fine; use `when()` for conditional _content_. Five shapes cover nearly every failure: - **Repeat with `each()`, not a loop.** `each("book in books", col(...))` @@ -351,7 +352,8 @@ Options: `{ size, title, author, subject, keywords, lang, styles, padding }` - `lang`: Document language as a BCP 47 tag (`"ja"`, `"zh-Hant"`, `"ko"`...). Sets the PDF `/Lang` and picks the built-in CJK font — Chinese, Japanese and Korean text renders with no font upload. Without it the script is inferred from the text (kana -> Japanese, Hangul -> Korean, - else Simplified Chinese). See `/skills/pdf-fonts.md`. + else Simplified Chinese). + See [`/skills/pdf-fonts.md`](https://makespdf.com/skills/pdf-fonts.md). - `styles`: Custom style classes to merge with the standard kit - `padding`: Page padding in points (default 30) @@ -1176,6 +1178,12 @@ Supported style keys: `position`, `top`, `left`, `right`, `bottom`, `width`, the element centre), `page-repeat: true` (clone onto every page for watermarks). +`translate` is applied in the element's own frame **before** the rotation — +CSS transform-list order, `transform: rotate(θ) translate(dx, dy)` — so the +offset is carried around by the rotation: `{ rotate: 30, translate: [40, 60] }` +shifts the stamp by the rotated vector (about `+4.6, +72`), not by +`+40, +60`. Use `top` / `left` when you want a plain page-space offset. + Absolutes must live inside a `` ancestor (or at doc-root for `page-repeat` watermarks). They are rendered as PDF `/Artifact` content so they don't pollute the tagged-PDF structure tree. @@ -1487,8 +1495,8 @@ Write the extracted data down in this shape before drafting — it's compact, li ### Step 6 — Preview, validate, compare, iterate ```bash -makespdf preview template.dsl -o draft.pdf # render -makespdf validate template.dsl # structural + a11y issues +makespdf preview template.js -o draft.pdf # render +makespdf validate template.js # structural + a11y issues ``` Then run a three-way compare against the original: