2023-02-19 20:53:39 +00:00
|
|
|
local Object = require 'nature.object'
|
|
|
|
|
|
|
|
local Page = Object:extend()
|
|
|
|
|
2023-07-10 02:38:34 +00:00
|
|
|
function Page:new(title, text)
|
2023-02-19 20:53:39 +00:00
|
|
|
self:setText(text)
|
2023-07-10 02:38:34 +00:00
|
|
|
self.title = title or 'Page'
|
2023-10-25 03:51:42 +00:00
|
|
|
self.lazy = false
|
|
|
|
self.loaded = true
|
|
|
|
self.children = {}
|
2023-02-19 20:53:39 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function Page:setText(text)
|
|
|
|
self.lines = string.split(text, '\n')
|
|
|
|
end
|
|
|
|
|
2023-07-10 02:38:34 +00:00
|
|
|
function Page:setTitle(title)
|
|
|
|
self.title = title
|
|
|
|
end
|
|
|
|
|
2023-10-25 03:51:42 +00:00
|
|
|
function Page:dynamic(initializer)
|
|
|
|
self.initializer = initializer
|
|
|
|
self.lazy = true
|
|
|
|
self.loaded = false
|
|
|
|
end
|
|
|
|
|
|
|
|
function Page:initialize()
|
|
|
|
self.initializer()
|
|
|
|
self.loaded = true
|
|
|
|
end
|
|
|
|
|
2023-02-19 20:53:39 +00:00
|
|
|
return Page
|