Render built-in macros from bundled Liquid macro templates (parity with bDS2) #68

Closed
opened 2026-07-20 19:43:56 +00:00 by hugo · 1 comment
Owner

Source: Audit section 1.4 (high impact).

Spec: specs/rendering.allium rule ExpandBuiltinMacros: each macro "renders a bundled macro template (macros/{name}) in an isolated Liquid subscope" (invariant MacroIsolation). Macros: youtube, vimeo, gallery, photo_archive (template macros/photo-archive), tag_cloud (macros/tag-cloud).

bDS2: ships ../bDS2/priv/starter_templates/templates/macros/{youtube,vimeo,gallery,photo-archive,tag-cloud}.liquid and renders them via the Liquid engine.

Current behaviour (RuDS): crates/bds-core/src/render/macros.rs builds the HTML in Rust format! strings; assets/starter-templates/ has no macros/ directory. Consequences: (a) output HTML parity with bDS2 is unverified, (b) no template-based override/customization path, (c) at least one hardcoded English string ("Missing Vimeo video id." in render_vimeo) violating i18n rules.

Task:

  1. Copy the five bDS2 macro liquid templates into assets/starter-templates/macros/ (bring assets into the project, no CDN refs).
  2. Render macros through the existing Liquid renderer in an isolated scope (macro-local assigns must not leak — spec MacroIsolation), keeping the current param handling/clamps (gallery columns 1..6 default 3, tag_cloud width 320..1600 def 900 / height 180..900 def 420, orientation aliases, photo_archive year/month filter) which already match spec.
  3. Compare rendered output against bDS2 for a fixture post using each macro; differences must be resolved toward bDS2.
  4. Replace hardcoded English fallbacks with render domain translations (locales/render/*.ftl).

Acceptance: Macro HTML matches bDS2 output for fixtures; macro templates live as assets; i18n clean; existing macro tests updated.

**Source:** Audit section 1.4 (high impact). **Spec:** `specs/rendering.allium` rule ExpandBuiltinMacros: each macro "renders a bundled macro template (macros/{name}) in an isolated Liquid subscope" (invariant MacroIsolation). Macros: youtube, vimeo, gallery, photo_archive (template macros/photo-archive), tag_cloud (macros/tag-cloud). **bDS2:** ships `../bDS2/priv/starter_templates/templates/macros/{youtube,vimeo,gallery,photo-archive,tag-cloud}.liquid` and renders them via the Liquid engine. **Current behaviour (RuDS):** `crates/bds-core/src/render/macros.rs` builds the HTML in Rust format! strings; `assets/starter-templates/` has no macros/ directory. Consequences: (a) output HTML parity with bDS2 is unverified, (b) no template-based override/customization path, (c) at least one hardcoded English string ("Missing Vimeo video id." in `render_vimeo`) violating i18n rules. **Task:** 1. Copy the five bDS2 macro liquid templates into `assets/starter-templates/macros/` (bring assets into the project, no CDN refs). 2. Render macros through the existing Liquid renderer in an isolated scope (macro-local assigns must not leak — spec MacroIsolation), keeping the current param handling/clamps (gallery columns 1..6 default 3, tag_cloud width 320..1600 def 900 / height 180..900 def 420, orientation aliases, photo_archive year/month filter) which already match spec. 3. Compare rendered output against bDS2 for a fixture post using each macro; differences must be resolved toward bDS2. 4. Replace hardcoded English fallbacks with `render` domain translations (locales/render/*.ftl). **Acceptance:** Macro HTML matches bDS2 output for fixtures; macro templates live as assets; i18n clean; existing macro tests updated.
hugo added the bug label 2026-07-20 19:43:56 +00:00
Author
Owner

Implemented in 8170076. Added the five bundled macro Liquid templates and routed every built-in macro through isolated Liquid assigns with bDS2-compatible HTML, data shaping, URI encoding, and localized defaults/empty states. Project partial templates with macros/* slugs now override the bundled defaults. Preserved gallery and tag-cloud bounds, orientation aliases, photo-archive filters, published tag weights, and colours. Verified with bDS2 fixture parity tests, isolated-scope and override integration tests, supported-Liquid validation, cargo fmt, clippy with warnings denied, cargo build --workspace, cargo test --workspace, and Allium check/analyse with no errors or findings.

Implemented in 8170076. Added the five bundled macro Liquid templates and routed every built-in macro through isolated Liquid assigns with bDS2-compatible HTML, data shaping, URI encoding, and localized defaults/empty states. Project partial templates with macros/* slugs now override the bundled defaults. Preserved gallery and tag-cloud bounds, orientation aliases, photo-archive filters, published tag weights, and colours. Verified with bDS2 fixture parity tests, isolated-scope and override integration tests, supported-Liquid validation, cargo fmt, clippy with warnings denied, cargo build --workspace, cargo test --workspace, and Allium check/analyse with no errors or findings.
hugo closed this issue 2026-07-21 18:44:50 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: hugo/RuDS#68