Template::HAML

Every page of the Template::HAML manual, in reading order.

  • Overview Template::HAML is a HAML implementation for Raku built on Raku Grammars. The manual covers tags, attributes, embedded code, filters, layouts, the API, and the haml CLI.
  • Getting Started Project layout for Template::HAML templates, a first .haml template rendered with HAML.render, and rendering inline template strings from Raku.
  • Tags HAML tag syntax in Template::HAML: % element names, . class and # id shorthand, interpolation inside shorthand, and object references with an optional prefix.
  • Attributes Attribute hashes in Template::HAML: value types, multi-line hashes, class shorthand merging, |$expr attribute splats, and data: and aria: key hyphenation.
  • Indentation How Template::HAML uses two-space indentation to nest child, sibling, and parent lines, and the X::IllegalIndent error raised for odd-spaced indents.
  • Doctype The !!! doctype line in Template::HAML: format-dependent defaults for html5, html4, and xhtml, named variants such as Strict and XML, and the related errors.
  • Comments HAML comments in Template::HAML: / HTML comments, /[expr] conditional comments, /![expr] revealed conditional comments, and -# silent comments.
  • Plain text Plain text lines in Template::HAML: backslash escapes for sigils, #{} escaped and !{} raw interpolation, escaping rules, and multi-line content.
  • Whitespace Whitespace control in Template::HAML: the > outer and < inner trim modifiers, preserved pre and textarea tags, remove-whitespace, and the ~ forced-preserve operator.
  • Embedded code Embedding Raku in Template::HAML with the =, !=, &=, ==, -, and ~ operators, passing :locals, HTML escaping, multi-line expressions, and X::HAML::Eval errors.
  • Control flow Control-flow keywords in Template::HAML: if, elsif, else, unless, for, while, repeat, and given/when/default, with their indentation rules and errors.
  • Filters Template::HAML filters: built-in :plain, :escaped, :javascript, :css, :cdata, :preserve, :markdown, and :raku, plus custom filters added with register-filter.
  • Layouts and partials Rendering Template::HAML files from search paths, wrapping them in layouts with yield and content-for, and rendering partials with locals and collections.
  • Helpers Template::HAML helpers for embedded code: html-safe, escape-once, surround, precede, succeed, list-of, find-and-preserve, haml-concat, tab-up, capture-haml, and page-class.
  • Render context The :context view object for HAML.render: bare-identifier resolution, context methods with arguments, overriding built-in helpers, HelpersRole, and ViewContext.
  • Configuration Template::HAML::Config rendering options: format, escape-html, output-style, remove-whitespace, trace, suppress-eval, cdata, mime-type, encoding, autoclose, and preserve.
  • Plugins Template::HAML::Plugin bundles visitors, tag transformers, filters, and a markdown backend for install-plugin and uninstall-plugin, with its lifecycle guarantees.
  • API The Template::HAML Raku API: HAML.render, render-supply streaming, compile-source-to-raku, direct-emit codegen, the on-disk compiled cache, extension registries, and exceptions.
  • CLI The haml command-line script: render with locals, streaming, and watch mode, check for parse errors, fmt for canonical formatting, and lint with built-in and custom rules.
  • Canonical form Rules haml fmt applies to produce canonical HAML source: file layout, indentation, tag head order, attribute form and quoting, comments, filters, and idempotency.
  • Tests Template::HAML test suites: prove6 .rakutest files under t/ and BDD-Behave specs under specs/, run with ./test.raku, plus golden-file tests and CI.
  • Benchmarks Benchmark harnesses that compare Template::HAML direct-emit and AST walker codegen, how to run them with HAML_BENCH_ITERS, their output, cases, and caveats.