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