API reference

Functions and macros

HAML.Codegen.@haml_strMacro
@haml_str(source)
haml"..."

Include HAML source code into Julia source. The code will be executed in the context (module / function) where it appears and has access to the same variables.

Example

julia> using HAML

julia> haml"%p Hello, world"
"<p>Hello, world</p>"
source
HAML.Templates.includehamlFunction
includehaml(mod::Module, fn::Symbol, path, indent="")
includehaml(mod::Module, fns::Pair{Symbol}...)

Define methods for the function mod.fn that allow rendering the HAML template in the file path. These methods have the following signatures:

fn(io::IO, indent=""; variables...)
fn(f::Function, indent=""; variables...)
fn(indent=""; variables...)

where the output of the template will be written to io / passed to f / returned respectively.

source
HAML.Templates.renderFunction
render(io, path; variables=(), indent="")

Evaluate HAML code in the file specified by path and write the result to io. Any variables passed as variables will be available to the resulting code as $key.

source
HAML.Templates.@includeMacro
@include(relpath, args...)

Include HAML code from another file. This macro can only be used from within other HAML code. args should be key=value parameters and they will be accessible in the included code by using $key.

source
HAML.Helpers.@sourcefileMacro
- @sourcefile(relpath)

Include the contents of the file at relpath (relative to the current file's directory) literally into the output.

source
HAML.Helpers.@cdatafileMacro
- @cdatafile(relpath)

Include the contents of the file at relpath (relative to the current file's directory) as a CDATA section in the output. Any occurrences of ]]> are suitably escaped.

source
HAML.Helpers.@surroundMacro
- @surround(before, after) do
  <haml block>

Surround the output of <haml block> with before and after with no space in between.

source
HAML.Helpers.@precedeMacro
- @precede(before) do
  <haml block>

Precede the output of <haml block> with before with no space in between.

source
HAML.Helpers.@succeedMacro
- @succeed(after) do
  <haml block>

Follow the output of <haml block> with after with no space in between.

source

Types

HAML.Parse.SourceType
HAML.Source("/path/to/file.hamljl")
HAML.Source(::LineNumberNode, ::AbstractString)

Represent Julia-flavoured HAML source code that can be parsed using the Meta.parse function.

source