You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
596 B
Lua
29 lines
596 B
Lua
local Boards = require "models.boards"
|
|
local Pages = require "models.pages"
|
|
local markdown = require "markdown"
|
|
|
|
return function(self)
|
|
-- Get all board data
|
|
self.boards = Boards:get_boards()
|
|
|
|
-- Get page
|
|
self.page = Pages:get_page(self.params.page)
|
|
|
|
if not self.page then
|
|
return self:write({ redirect_to = self:url_for("web.pages.c404") })
|
|
end
|
|
|
|
-- Page title
|
|
self.page_title = self.page.title
|
|
|
|
-- Markdown
|
|
if self.page.content then
|
|
self.page.content = markdown(self.page.content)
|
|
end
|
|
|
|
-- Display a theme
|
|
self.board = { theme = "yotsuba_b" }
|
|
|
|
return { render = "page" }
|
|
end
|