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