24
|
1 local Luan = require "luan:Luan.luan"
|
|
2 local error = Luan.error
|
|
3 local Parsers = require "luan:Parsers.luan"
|
|
4 local json_string = Parsers.json_string or error()
|
|
5 local Io = require "luan:Io.luan"
|
|
6 local Http = require "luan:http/Http.luan"
|
|
7 local Post = require "site:/lib/Post.luan"
|
|
8 local get_post_by_id = Post.get_by_id or error()
|
|
9
|
|
10
|
|
11 return function()
|
|
12 local post = Http.request.parameters.post or error()
|
|
13 post = get_post_by_id(post) or error()
|
|
14 Io.stdout = Http.response.text_writer()
|
|
15 %>
|
|
16 openEditPost('<%=post.id%>',<%=json_string(post.content)%>);
|
|
17 <%
|
|
18 end
|