module

Haml

Constants

VERSION = "1.1.0"

Class methods

compile(source : String, filename : String = "inline.haml", io_name : String = "__haml_io", options : Options = Options.new) : String
Source
compile_file(filename : String, io_name : String = "__haml_io", options : Options = Options.new) : String
Source

Macros

def_to_s(filename, indent_width = 2)
Source
embed(filename, io_name, indent_width = 2)

The delayed {{ run(...) }} expansion follows Crystal stdlib ECR. It lets a fresh macro IO variable be named before its name is sent to the generator. The generator program is resolved relative to THIS file, so both a local checkout and installation as lib/haml work without symlinks or CRYSTAL_PATH tricks. Template filenames, like ECR's, are relative to the build's cwd. Use an absolute path (typically interpolating DIR) for relocatability.

Source
embed_string(source, io_name, filename = "inline.haml", indent_width = 2)

Compile-time inline strings are useful for small fragments and specs. This is not eval: source must be known at compile time. Large inputs should use files because operating systems limit argument length for macro-run tools.

Source
render(filename, indent_width = 2)
Source
render_string(source, filename = "inline.haml", indent_width = 2)
Source

Nested types