mirror of
https://github.com/lxsang/antd-web-apps
synced 2025-07-24 01:29:48 +02:00
add index pages for documentations
This commit is contained in:
@ -1,10 +1,23 @@
|
||||
BaseController:subclass("IndexController")
|
||||
|
||||
function IndexController:index(...)
|
||||
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
|
||||
return true
|
||||
end
|
||||
|
||||
function IndexController:actionnotfound(...)
|
||||
self.template:setView("index")
|
||||
return self:index(table.unpack({...}))
|
||||
self.template:setView("book")
|
||||
return self:book(table.unpack({...}))
|
||||
end
|
||||
|
||||
function IndexController:book(...)
|
||||
return true
|
||||
end
|
@ -171,7 +171,7 @@ function DocController:index(...)
|
||||
content, has_3d = post_process_md(content, self)
|
||||
-- replace some display plugins
|
||||
|
||||
self.template:setView("index", "index")
|
||||
self.template:setView("book", "index")
|
||||
self.template:set("data", content)
|
||||
self.template:set("has_3d", has_3d)
|
||||
else
|
||||
|
Reference in New Issue
Block a user