Mercurial Hosting > freedit
diff src/save_edit.js.luan @ 52:9f8ebc757814
add convert urls
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Wed, 23 Nov 2022 23:29:16 -0700 |
parents | 96f0c3d65698 |
children |
line wrap: on
line diff
--- a/src/save_edit.js.luan Tue Nov 22 22:57:43 2022 -0700 +++ b/src/save_edit.js.luan Wed Nov 23 23:29:16 2022 -0700 @@ -7,6 +7,7 @@ local Http = require "luan:http/Http.luan" local Post = require "site:/lib/Post.luan" local Bbcode = require "site:/bbcode/Bbcode.luan" +local preprocess = Bbcode.preprocess or error() local bbcode_to_html = Bbcode.to_html or error() local Db = require "site:/lib/Db.luan" local Shared = require "site:/lib/Shared.luan" @@ -18,6 +19,10 @@ return function() local post = Http.request.parameters.post or error() local text = Http.request.parameters.text or error() + local convert_urls = Http.request.parameters.convert_urls or error() + if convert_urls == "true" then + text = preprocess(text) + end Db.run_in_transaction( function() post = Post.get_by_id(post) or error() post.author_is_current() or error()