Jinja

1.2.0

A minimalistic Swift implementation of the Jinja templating engine, specifically designed for parsing and rendering ML chat templates.
johnmai-dev/Jinja

What's New

1.2.0

2025-05-14T04:58:29Z

What's Changed

  • Adding support for IBM's Granite model by @smdesai in #16

New Contributors

Full Changelog: 1.1.2...1.2.0

Jinja

A minimalistic Swift implementation of the Jinja templating engine, specifically designed for parsing and rendering ML chat templates.

SwiftPM

To use Jinja with SwiftPM, you can add this to your Package.swift:

dependencies: [
    .package(url: "https://github.com/maiqingqiang/Jinja", branch: "main")
]

And then, add the Transformers library as a dependency to your target:

targets: [
    .target(
        name: "YourTargetName",
        dependencies: [
            .product(name: "Jinja", package: "Jinja")
        ]
    )
]

Usage

import Jinja

let template = """
{% for item in items %}
{{ item }}
{% endfor %}
"""

let context = [
    "items": [
        "item1", 
        "item2", 
        "item3"
    ]
]

let result = try Template(template).render(context)

Description

  • Swift Tools 5.8.0
View More Packages from this Author

Dependencies

Last updated: Thu May 15 2025 07:43:37 GMT-0900 (Hawaii-Aleutian Daylight Time)