Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jinja-zig

An implementation of the Jinja templating language in Zig.

Compatible with Zig 0.14

Open source under the BSD-3-Clause license

This project is currently WIP and missing many features!

Add to your project

Run the following command:

zig fetch --save git+https://github.com/imbev/jinja-zig

Then add the following to your build.zig:

const jinja_zig = b.dependency("jinja_zig", .{
        .target = target,
        .optimize = optimize,
    });

exe.root_module.addImport("jinja_zig", jinja_zig.module("jinja_zig"));

Example use in a Zap project

const std = @import("std");
const zap = @import("zap");
const jinja = @import("jinja_zig");

pub fn on_request(r: zap.Request) !void {
    r.sendBody(try jinja.eval_file(std.heap.page_allocator, "index.jinja")) catch return;
}

Roadmap

  • Plain HTML
  • Statements
    • for
    • if
    • macro
    • call
    • filter
      • upper()
      • ...
    • set
    • extends
    • block
    • include
    • import
  • Expressions
    • Variables
      • value
      • methods
      • attribute
    • Literals
      • string
      • integer
      • float
      • list
      • tuple
      • dict
      • boolean
    • Math
      • +
      • ...
    • Comparisons
      • ...
    • Logic
      • and
      • or
      • not
      • (expr)
    • in
    • is
    • filter
    • concatenate
    • callable
    • inline if
  • Comments
    • Single-line
    • Multi-line
  • Performance
    • Memoization
    • Compile-time optimizations

About

An implementation of the Jinja templating language in Zig.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages