diff src/edit.html.luan @ 13:24668255cede

preprocess urls
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 03 Jul 2022 23:59:41 -0600
parents 9674275019bb
children
line wrap: on
line diff
--- a/src/edit.html.luan	Sun Jul 03 22:01:23 2022 -0600
+++ b/src/edit.html.luan	Sun Jul 03 23:59:41 2022 -0600
@@ -12,6 +12,8 @@
 local forum_title = Forum.title or error()
 local Post = require "site:/lib/Post.luan"
 local User = require "site:/lib/User.luan"
+local Bbcode = require "site:/lib/Bbcode.luan"
+local bbcode_preprocess = Bbcode.preprocess or error()
 
 
 return function()
@@ -20,7 +22,9 @@
 	local post_id = Http.request.parameters.post or error()
 	local post = Post.get_by_id(post_id) or error()
 	if Http.request.method == "POST" then
-		post.content = Http.request.parameters.content or error()
+		local content = Http.request.parameters.content or error()
+		content = bbcode_preprocess(content)
+		post.content = content
 		post.save()
 		Http.response.send_redirect("/thread.html?root="..post.root_id)
 		return