Genie.Renderer.Html.normal_element
— Functionnormal_element(f::Function, elem::String, attrs::Vector{Pair{Symbol,Any}} = Pair{Symbol,Any}[]) :: HTMLString
Generates a HTML element in the form <...></...>
Genie.Renderer.Html.prepare_template
— Functionprepare_template(s::String)
prepare_template{T}(v::Vector{T})
Cleans up the template before rendering (ex by removing empty nodes).
Genie.Renderer.Html.attributes
— Functionattributes(attrs::Vector{Pair{Symbol,String}} = Vector{Pair{Symbol,String}}()) :: Vector{String}
Parses HTML attributes.
Genie.Renderer.Html.parseattr
— Functionparseattr(attr) :: String
Converts Julia keyword arguments to HTML attributes with illegal Julia chars.
Genie.Renderer.Html.normalize_element
— Functionnormalize_element(elem::String)
Cleans up problematic characters or DOM elements.
Genie.Renderer.Html.denormalize_element
— Functiondenormalize_element(elem::String)
Replaces -
with the char defined to replace dashes, as Julia does not support them in names.
Genie.Renderer.Html.void_element
— Functionvoid_element(elem::String, attrs::Vector{Pair{Symbol,String}} = Vector{Pair{Symbol,String}}()) :: HTMLString
Generates a void HTML element in the form <...>
Missing docstring for skip_element
. Check Documenter's build log for details.
Missing docstring for include_markdown
. Check Documenter's build log for details.
Genie.Renderer.Html.get_template
— Functionget_template(path::String; partial::Bool = true, context::Module = @__MODULE__, vars...) :: Function
Resolves the inclusion and rendering of a template file
Genie.Renderer.Html.doctype
— FunctionOutputs document's doctype.
Genie.Renderer.Html.doc
— FunctionOutputs document's doctype.
Genie.Renderer.Html.parseview
— Functionparseview(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.
Genie.Renderer.Html.render
— Functionrender(data::String; context::Module = @__MODULE__, layout::Union{String,Nothing} = nothing, vars...) :: Function
Renders the string as an HTML view.
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.
Genie.Renderer.Html.parsehtml
— Functionparsehtml(input::String; partial::Bool = true) :: String
parsehtml(elem, output; partial = true) :: String
Parses a HTML tree structure into a string
of Julia code.
Genie.Renderer.render
— Functionrender
Abstract function that needs to be specialized by individual renderers.
Genie.Renderer.Html.html
— Functionhtml(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 renderedcontext::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 responseheaders::HTTPHeaders
: HTTP response headerslayout::Union{String,Nothing}
: layout file for renderingdata
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>"
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
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 aRenderer.FilePath
, ieRenderer.filepath("/path/to/file.html.jl")
orpath"/path/to/file.html.jl"
layout::FilePath
: filesystem path to the layout file as aRenderer.FilePath
, ieRenderer.FilePath("/path/to/file.html.jl")
orpath"/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 responseheaders::HTTPHeaders
: HTTP response headers
Genie.Renderer.Html.safe_attr
— Functionsafe_attr(attr) :: String
Replaces illegal Julia characters from HTML attributes with safe ones, to be used as keyword arguments.
Missing docstring for parsehtml
. Check Documenter's build log for details.
Genie.Renderer.Html.html_to_julia
— Functionhtml_to_julia(file_path::String; partial = true) :: String
Converts a HTML document to Julia code.
Genie.Renderer.Html.string_to_julia
— Functionstring_to_julia(content::String; partial = true, f_name::Union{Symbol,Nothing} = nothing, prepend = "") :: String
Converts string view data to Julia code
Genie.Renderer.Html.to_julia
— Functionto_julia(input::String, f::Function; partial = true, f_name::Union{Symbol,Nothing} = nothing, prepend = "") :: String
Converts an input file to Julia code
Genie.Renderer.Html.partial
— Functionpartial(path::String; context::Module = @__MODULE__, vars...) :: String
Renders (includes) a view partial within a larger view or layout file.
Genie.Renderer.Html.template
— Functiontemplate(path::String; partial::Bool = true, context::Module = @__MODULE__, vars...) :: String
Renders a template file.
Genie.Renderer.Html.read_template_file
— Functionread_template_file(file_path::String) :: String
Reads file_path
template from disk.
Genie.Renderer.Html.parse_template
— Functionparse_template(file_path::String; partial = true) :: String
Parses a HTML file into Julia code.
Genie.Renderer.Html.parse_string
— Functionparse_string(data::String; partial = true) :: String
Parses a HTML string into Julia code.
Missing docstring for parse
. Check Documenter's build log for details.
Missing docstring for parsetags
. Check Documenter's build log for details.
Genie.Renderer.Html.register_elements
— Functionregister_elements() :: Nothing
Generated functions that represent Julia functions definitions corresponding to HTML elements.
Genie.Renderer.Html.register_element
— Functionregister_element(elem::Union{Symbol,String}, elem_type::Union{Symbol,String} = :normal; context = @__MODULE__) :: Nothing
Generates a Julia function representing an HTML element.
Genie.Renderer.Html.register_normal_element
— Functionregister_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>
Genie.Renderer.Html.register_void_element
— Functionregister_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 />
Missing docstring for attr
. Check Documenter's build log for details.
Genie.Renderer.Html.for_each
— Functionfor_each(f::Function, v)
Iterates over the v
Vector and applies function f
for each element. The results of each iteration are concatenated and the final string is returned.
Genie.Renderer.Html.collection
— Functioncollection(template::Function, collection::Vector{T})::String where {T}
Creates a view fragment by repeateadly applying a function to each element of the collection.
Genie.Router.error
— Functionerror
Not implemented function for error response.
Genie.Renderer.Html.serve_error_file
— Functionserve_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.
Genie.Renderer.Html.@yield
— Macro@yield
Outputs the rendering of the view within the template.
Missing docstring for el
. Check Documenter's build log for details.