all repos

olexsmir.xyz @ 620792cf2ab97761a56488444d1732ee99e76f22

my site, yes, i like lua

olexsmir.xyz/lua/lego/html/attribute.lua(view raw)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
local hattribute = {}

---@class lego.HtmlAttribute
---@field [string] string

---@param attribute string
---@param value string
---@return lego.HtmlAttribute
function hattribute.attr(attribute, value)
  return { [attribute] = value }
end

-- COMMON ATTRIBUTES
-- stylua: ignore start

---@param class string
function hattribute.class(class) return hattribute.attr("class", class) end

---@param link string
function hattribute.href(link) return hattribute.attr("href", link) end

---@param id string
function hattribute.id(id) return hattribute.attr("id", id) end

-- stylua: ignore end

return hattribute