comparison src/bbcode/test.js.luan @ 44:96f0c3d65698

add /bbcode
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 10 Nov 2022 23:18:58 -0700
parents
children
comparison
equal deleted inserted replaced
43:298c71e0c854 44:96f0c3d65698
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 output_of = Io.output_of or error()
7 local Http = require "luan:http/Http.luan"
8 local Bbcode = require "site:/bbcode/Bbcode.luan"
9 local bbcode_to_html = Bbcode.to_html or error()
10
11
12 return function()
13 local text = Http.request.parameters.text or error()
14 local html = output_of(function() bbcode_to_html(text) end)
15 Io.stdout = Http.response.text_writer()
16 %>
17 document.querySelector('p[result]').innerHTML = <%= json_string(html) %>;
18 <%
19 end