8 Commits

Author SHA1 Message Date
dd2191829d fix: flush static buffer in conditionals and correct helpers import path
- Flush static buffer at end of each conditional branch (if/else/else-if)
  to ensure content is rendered inside the correct blocks
- Add helpers_path parameter to zig_codegen.generate() for correct
  relative imports in nested directories (e.g., '../helpers.zig')
- Fix build.zig to use correct CLI path (src/tpl_compiler/main.zig)
- Export zig_codegen from root.zig for CLI module usage

Bump version to 0.3.11
2026-01-30 22:59:47 +05:30
5ce319b335 Fix mixin expansion in conditionals and include resolution in extends
- mixin.zig: expandNode and expandNodeWithArgs now recurse into
  node.consequent and node.alternate for Conditional nodes
- view_engine.zig: process includes and collect mixins from child
  template before extracting blocks in processExtends

This fixes mixin calls inside if/else blocks not being rendered
in compiled templates.
2026-01-30 22:24:27 +05:30
036befa23c include, extend file path correction 2026-01-29 19:09:53 +05:30
14128aeeea feat: add @TypeOf type hints for compiled templates
- Add TypeHint node type in parser for //- @TypeOf(field): type syntax
- Support scalar types (f32, i32, bool, etc.) and array/struct types
- Use helpers.appendValue() for non-string typed fields
- Filter out loop variable references from Data struct fields
- Preserve @TypeOf comments during comment stripping

Example usage:
  //- @TypeOf(subtotal): f32
  span $#{subtotal}

  //- @TypeOf(items): []{name: []const u8, price: f32}
  each item in items
    h3 #{item.name}
2026-01-28 22:31:24 +05:30
8db2e0df37 Genearte .zig verions of templates to use in production. 2026-01-28 17:01:28 +05:30
aaf6a1af2d fix: add scoped error logging for lexer/parser errors
- Add std.log.scoped(.pugz) to template.zig and view_engine.zig
- Log detailed error info (code, line, column, message) when parsing fails
- Log template path context in ViewEngine on parse errors
- Remove debug print from lexer, use proper scoped logging instead
- Move benchmarks, docs, examples, playground, tests out of src/ to project root
- Update build.zig and documentation paths accordingly
- Bump version to 0.3.1
2026-01-25 17:10:02 +05:30
7bcb79c7bc refactor: move docs and examples to src folder, update README with accurate benchmarks 2026-01-25 15:32:38 +05:30
1b2da224be feat: add template inheritance (extends/block) support
- ViewEngine now supports extends and named blocks
- Each route gets exclusive cached AST (no shared parent layouts)
- Fix iteration over struct arrays in each loops
- Add demo app with full e-commerce layout using extends
- Serve static files from public folder
- Bump version to 0.3.0
2026-01-25 15:23:57 +05:30