2020-06-22 22:14:52 +02:00
|
|
|
BaseController:subclass("IndexController")
|
|
|
|
|
|
|
|
function IndexController:index(...)
|
2020-12-22 13:57:23 +01:00
|
|
|
local file = io.open("/home/mrsang/doc/library.md", "r")
|
|
|
|
if file then
|
|
|
|
local content = ""
|
|
|
|
local md = require("md")
|
|
|
|
local callback = function(s) content = content .. s end
|
|
|
|
md.to_html(file:read("*a"), callback)
|
|
|
|
file.close()
|
|
|
|
self.template:set("data", content)
|
|
|
|
end
|
2020-06-22 22:14:52 +02:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
|
|
|
function IndexController:actionnotfound(...)
|
2020-12-22 13:57:23 +01:00
|
|
|
self.template:setView("book")
|
|
|
|
return self:book(table.unpack({...}))
|
|
|
|
end
|
|
|
|
|
|
|
|
function IndexController:book(...)
|
|
|
|
return true
|
2020-06-22 22:14:52 +02:00
|
|
|
end
|