Forge.Lower
Forge.Lower — bastion lower CLI subcommand.
Lowers .march.html template files to .march modules with ~H sigils.
Usage: forge bastion.lower <input.march.html> <output.march> <output.march.spans>
The lowering pass:
- Extracts the --- frontmatter block (fn signature + use declarations)
- Parses the template body into tokens (literal HTML, {expr}, {#if}, etc.)
- Resolves <.Component /> calls to module-qualified function calls
- Assembles <:slot> blocks into IOList arguments
- Emits a .march module wrapping the body in ~H"""..."""
- Writes a .march.spans sidecar for source-map error reporting
The generated .march file is a build artifact — never committed.
Types
Functions
Lower a .march.html template file to a .march module source string.
Returns a tuple of (march_source, spans_table).
let (source, spans) = Forge.Lower.lower(content, "src/my_app/templates/home.march.html")fnlower_filelower_file(input_path : String, output_march : String, output_spans : String) : Result(String, String)#
Lower a .march.html file and write the output files.
Reads input_path, writes output_march and output_spans.