Expand description
Forge → Askama preprocessor. Used from build.rs to compile .forge.html files
into Askama-compatible .html templates.
Supports:
@if/@elseif/@else/@endif→{% if %}/{% elif %}/{% else %}/{% endif %}@foreach/@endforeach→{% for %}/{% endfor %}(withloop.index,loop.first, etc.)@extends('layout')→{% extends "layout.html" %}@section('name')/@endsection→{% block name %}/{% endblock %}@yield('name')→{% block name %}{% endblock %}@parent→{{ super() }}@include('partial')→{% include "partial.html" %}@push('stack')/@endpush→ call intoforge::stack::push@stack('stack')→ placeholder for post-render swap@vite([...])→ call intoforge::vite::render@auth/@guest/@can— sugar over@if{{ x }}→{{ x }}(Askama auto-escapes){!! x !!}→{{ x|safe }}<x-component prop="...">body</x-component>→{% call ... %}body{% endcall %}
Re-exports§
pub use compiler::compile_dir;pub use compiler::compile_file;pub use compiler::compile_source;pub use compiler::compile_source_runtime;pub use lower::LowerTarget;
Modules§
- compiler
- Compile Forge templates to Askama (compile-time, build.rs path) or to a MiniJinja-compatible runtime form used by Spark.
- lower
- Lower a Forge token stream into Askama template syntax (the default) or into a MiniJinja-compatible runtime form (for Spark component bodies and other dynamic templates).
- parser
- Parser for Forge
.forge.htmlfiles. Produces a flat token stream that the lowering pass converts to Askama syntax.