API reference
Functions and macros
HAML.Codegen.@haml_str
— Macro@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>"
HAML.Templates.includehaml
— Functionincludehaml(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.
HAML.Templates.render
— Functionrender(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
.
HAML.Templates.@include
— Macro@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
.
HAML.Helpers.@sourcefile
— Macro- @sourcefile(relpath)
Include the contents of the file at relpath
(relative to the current file's directory) literally into the output.
HAML.Helpers.@cdatafile
— Macro- @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.
HAML.Helpers.@surround
— Macro- @surround(before, after) do
<haml block>
Surround the output of <haml block>
with before
and after
with no space in between.
HAML.Helpers.@precede
— Macro- @precede(before) do
<haml block>
Precede the output of <haml block>
with before
with no space in between.
HAML.Helpers.@succeed
— Macro- @succeed(after) do
<haml block>
Follow the output of <haml block>
with after
with no space in between.
Types
HAML.Parse.Source
— TypeHAML.Source("/path/to/file.hamljl")
HAML.Source(::LineNumberNode, ::AbstractString)
Represent Julia-flavoured HAML source code that can be parsed using the Meta.parse
function.