Genie.Renderer.Html.normal_elementFunction
normal_element(f::Function, elem::String, attrs::Vector{Pair{Symbol,Any}} = Pair{Symbol,Any}[]) :: HTMLString

Generates a HTML element in the form <...></...>

source
Genie.Renderer.Html.void_elementFunction
void_element(elem::String, attrs::Vector{Pair{Symbol,String}} = Vector{Pair{Symbol,String}}()) :: HTMLString

Generates a void HTML element in the form <...>

source
Genie.Renderer.Html.get_templateFunction
get_template(path::String; partial::Bool = true, context::Module = @__MODULE__) :: Function

Resolves the inclusion and rendering of a template file

source
Genie.Renderer.Html.parseviewFunction
parseview(data::String; partial = false, context::Module = @__MODULE__) :: Function

Parses a view file, returning a rendering function. If necessary, the function is JIT-compiled, persisted and loaded into memory.

source
Genie.Renderer.Html.renderFunction
render(data::String; context::Module = @__MODULE__, layout::Union{String,Nothing} = nothing, vars...) :: Function

Renders the string as an HTML view.

source
render(viewfile::Genie.Renderer.FilePath; layout::Union{Nothing,Genie.Renderer.FilePath} = nothing, context::Module = @__MODULE__, vars...) :: Function

Renders the template file as an HTML view.

source
Genie.Renderer.Html.parsehtmlFunction
parsehtml(input::String; partial::Bool = true) :: String
source
parsehtml(elem, output, depth; partial = true) :: String

Parses a HTML tree structure into a string of Julia code.

source
Missing docstring.

Missing docstring for Genie.Renderer.render. Check Documenter's build log for details.

Genie.Renderer.Html.htmlFunction
html(data::String; context::Module = @__MODULE__, status::Int = 200, headers::HTTPHeaders = HTTPHeaders(), layout::Union{String,Nothing} = nothing, vars...) :: HTTP.Response

Parses the data input as HTML, returning a HTML HTTP Response.

Arguments

  • data::String: the HTML string to be rendered
  • context::Module: the module in which the variables are evaluated (in order to provide the scope for vars). Usually the controller.
  • status::Int: status code of the response
  • headers::HTTPHeaders: HTTP response headers
  • layout::Union{String,Nothing}: layout file for rendering data

Example

julia> html("<h1>Welcome $(@vars(:name))</h1>", layout = "<div><% @yield %></div>", name = "Adrian")
HTTP.Messages.Response:
"
HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8

<html><head></head><body><div><h1>Welcome Adrian</h1>
</div></body></html>"
source
html(md::Markdown.MD; context::Module = @__MODULE__, status::Int = 200, headers::Genie.Renderer.HTTPHeaders = Genie.Renderer.HTTPHeaders(), layout::Union{String,Nothing} = nothing, forceparse::Bool = false, vars...) :: Genie.Renderer.HTTP.Response

Markdown view rendering

source
html(viewfile::FilePath; layout::Union{Nothing,FilePath} = nothing,
      context::Module = @__MODULE__, status::Int = 200, headers::HTTPHeaders = HTTPHeaders(), vars...) :: HTTP.Response

Parses and renders the HTML viewfile, optionally rendering it within the layout file. Valid file format is .html.jl.

Arguments

  • viewfile::FilePath: filesystem path to the view file as a Renderer.FilePath, ie Renderer.FilePath("/path/to/file.html.jl")
  • layout::FilePath: filesystem path to the layout file as a Renderer.FilePath, ie Renderer.FilePath("/path/to/file.html.jl")
  • context::Module: the module in which the variables are evaluated (in order to provide the scope for vars). Usually the controller.
  • status::Int: status code of the response
  • headers::HTTPHeaders: HTTP response headers
source
Genie.Renderer.Html.safe_attrFunction
safe_attr(attr) :: String

Replaces illegal Julia characters from HTML attributes with safe ones, to be used as keyword arguments.

source
Missing docstring.

Missing docstring for parsehtml. Check Documenter's build log for details.

Genie.Renderer.Html.string_to_juliaFunction
string_to_julia(content::String; partial = true, f_name::Union{Symbol,Nothing} = nothing, prepend = "") :: String

Converts string view data to Julia code

source
Genie.Renderer.Html.to_juliaFunction
to_julia(input::String, f::Function; partial = true, f_name::Union{Symbol,Nothing} = nothing, prepend = "") :: String

Converts an input file to Julia code

source
Genie.Renderer.Html.partialFunction
partial(path::String; context::Module = @__MODULE__, vars...) :: String

Renders (includes) a view partial within a larger view or layout file.

source
Missing docstring.

Missing docstring for parse. Check Documenter's build log for details.

Genie.Renderer.Html.register_elementFunction
register_element(elem::Union{Symbol,String}, elem_type::Union{Symbol,String} = :normal; context = @__MODULE__) :: Nothing

Generates a Julia function representing an HTML element.

source
Genie.Renderer.Html.register_normal_elementFunction
register_normal_element(elem::Union{Symbol,String}; context = @__MODULE__) :: Nothing

Generates a Julia function representing a "normal" HTML element: that is an element with a closing tag, <tag>...</tag>

source
Genie.Renderer.Html.register_void_elementFunction
register_void_element(elem::Union{Symbol,String}; context::Module = @__MODULE__) :: Nothing

Generates a Julia function representing a "void" HTML element: that is an element without a closing tag, <tag />

source
Missing docstring.

Missing docstring for attr. Check Documenter's build log for details.

Genie.Renderer.Html.@foreachMacro
@foreach(f, arr)

Iterates over the arr Array and applies function f for each element. The results of each iteration are concatenated and the final string is returned.

Examples

@foreach(@vars(:translations)) do t t end

source
Genie.Renderer.Html.collectionFunction
collection(template::Function, collection::Vector{T})::String where {T}

Creates a view fragment by repeateadly applying a function to each element of the collection.

source
Genie.Renderer.Html.serve_error_fileFunction
serve_error_file(error_code::Int, error_message::String = "", params::Dict{Symbol,Any} = Dict{Symbol,Any}()) :: Response

Serves the error file correspoding to error_code and current environment.

source
Missing docstring.

Missing docstring for el. Check Documenter's build log for details.