Skip to content

feat(wrap): oliver wrap template dialect (Phase 6 S2) - #112

Merged
drawmeanelephant merged 3 commits into
mainfrom
feat/wrap-s2
Aug 21, 2026
Merged

drawmeanelephant merged 3 commits into
mainfrom
feat/wrap-s2

Conversation

@drawmeanelephant

Copy link
Copy Markdown
Owner

Summary

Implements the oliver wrap subcommand with the 7-token template dialect (Phase 6 S2, issue #108).

What's new

  • src/wrap.zig — Template dialect engine (filesystem-free, pure bytes → bytes)

    • 7 tokens: $title$/$description$/$author$/$date$/$palette$ (HTML-escaped), $assets_root$/$body$ (literal)
    • $if(name)$...$endif$ conditional blocks: first $endif$ closes, no nesting, verbatim unknown names, empty fields remove block
    • HTML escaping: & < > " '&amp; &lt; &gt; &quot; &#39; (matches GAWK html_escape)
    • JSON parsing via std.json.parseFromSlice with ignore_unknown_fields
    • 28 unit tests
  • src/main.zig — CLI integration

    • New Command.wrap variant and 4 wrap-specific flags (--template, --meta-json, --assets-root, --body)
    • wrapDispatch() reads files from disk via std.Io.Dir.cwd().openFile(), resolves dialect, writes to stdout
    • Updated usage text and flag-scoping validation

CLI

oliver wrap --template <file> --meta-json <json> --assets-root <prefix> --body <file> > page.html

Contract

Matches oliver-contract.md:115-145:

  • 7 tokens with correct escaping split
  • $if$ one-pass title→palette, first $endif$ closes, no nesting, verbatim unknown
  • All $if$ resolved before literal substitutions

Verification

  • zig build — clean compile
  • zig build test — all tests pass (437/437)

Closes #108

drawmeanelephant and others added 3 commits August 21, 2026 10:07
…-root <prefix> --body <file> (Phase 6 S2)

Implements the 7-token template dialect for `oliver wrap`:
- $title$/$description$/$author$/$date$/$palette$ → html_escaped meta
- $assets_root$/$body$ → literal
- $if(name)$...$endif$ → conditional blocks (first $endif$ closes, no nesting, verbatim unknown)
- Unknown $word$ → verbatim passthrough

Closes #108

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
@drawmeanelephant
drawmeanelephant merged commit a97131c into main Aug 21, 2026
3 checks passed
@drawmeanelephant
drawmeanelephant deleted the feat/wrap-s2 branch August 21, 2026 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: oliver wrap --template <file> --meta-json <json> --assets-root <prefix> --body <file> (Phase 6 S2)

1 participant