1
0
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:
lxsang
2020-12-22 12:57:23 +00:00
parent 489c93dd61
commit 083a2d9a4d
7 changed files with 186 additions and 144 deletions

View File

@ -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

View File

@ -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