Index

resty-gitweb / adbeb10

A git web interface for Lua/OpenResty (you're on it right now!)

Latest Commit

{#}TimeHashSubjectAuthor#(+)(-)GPG?
113 Dec 2020 16:16e49d46eInitial commit (imported, read description)Josh Stockin1350G

Blob @ resty-gitweb / utils / builder.lua

text/plain522 bytesdownload raw
1-- builder.lua
2-- HTML builder class
3
4-- Copyright (c) 2020 Joshua 'joshuas3' Stockin
5-- <https://joshstock.in>
6
7local _M = {}
8_M.__index = _M
9
10function _M:new()
11 local o = {}
12 o.title = ""
13 o.meta_tags = {}
14 o.body = ""
15 setmetatable(o, self)
16 return o
17end
18
19function _M:set_title(str)
20 self.title = str
21end
22
23function _M:add(str)
24 self.body = self.body..str.."\n"
25end
26
27function _M:meta(tag)
28 table.insert(self.meta_tags, tag)
29end
30
31function _M:build() -- TODO
32 return self.body
33end
34
35return _M
36