1
0
Fork 0
mirror of https://github.com/MillironX/Kelpie.jl.git synced 2025-01-15 09:19:07 -05:00

Add generated functions for a bunch of HTML elements

Signed-off-by: Thomas A. Christensen II <25492070+MillironX@users.noreply.github.com>
This commit is contained in:
Thomas A. Christensen II 2022-03-31 19:35:43 -05:00
parent 73de5d39ea
commit abbcbeac1d
Signed by: millironx
GPG key ID: 139C07724802BC5D

View file

@ -6,6 +6,60 @@ import EzXML: link!, EzXML
export html
export html_element
const HTML_ELEMENTS = [
:head,
:link,
:meta,
:style,
:title,
:body,
:article,
:aside,
:footer,
:header,
:h1,
:h2,
:h3,
:h4,
:h5,
:h6,
:main,
:nav,
:section,
:blockquote,
:dd,
# :div, Special case: we don't want to override the Base.div function
:dl,
:dt,
:hr,
:li,
:ol,
:p,
:ul,
:a,
:b,
:br,
:code,
:em,
:i,
:span,
:strong,
:sub,
:sup,
:u,
:img,
:iframe,
:script,
:table,
:tbody,
:td,
:tfoot,
:th,
:thead,
:tr,
:button,
]
"""
link_or_text!(node, content)
@ -88,4 +142,14 @@ function html(content)
return doc
end #function
for symbol in HTML_ELEMENTS
name = string(symbol)
@eval function $symbol(content=nothing; kwargs...)
return html_element($name, content; kwargs...)
end #function
@eval export $symbol
end
end #module