From abbcbeac1d5c011d126d480b34d9f4b7b67b9a1e Mon Sep 17 00:00:00 2001 From: "Thomas A. Christensen II" <25492070+MillironX@users.noreply.github.com> Date: Thu, 31 Mar 2022 19:35:43 -0500 Subject: [PATCH] Add generated functions for a bunch of HTML elements Signed-off-by: Thomas A. Christensen II <25492070+MillironX@users.noreply.github.com> --- src/Kelpie.jl | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/src/Kelpie.jl b/src/Kelpie.jl index 582d2fc..581c8c5 100644 --- a/src/Kelpie.jl +++ b/src/Kelpie.jl @@ -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