diff src/bbcode/Bbcode.luan @ 49:f225e82b2bf8

add code bbcode
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 17 Nov 2022 16:46:21 -0700
parents 4e1a01db19ec
children cac477dd1f82
line wrap: on
line diff
--- a/src/bbcode/Bbcode.luan	Thu Nov 17 00:11:44 2022 -0700
+++ b/src/bbcode/Bbcode.luan	Thu Nov 17 16:46:21 2022 -0700
@@ -72,9 +72,13 @@
 end
 
 function html.code(bbcode,options)
-	local s = starting_cr_regex.gsub(bbcode.contents,"")
-	%><code><%= html_encode(s) %></code><%
-	options.strip_newline = true
+	if bbcode.param == "inline" then
+		%><code inline><%= html_encode(bbcode.contents) %></code><%
+	else
+		local s = starting_cr_regex.gsub(bbcode.contents,"")
+		%><code><%= html_encode(s) %></code><%
+		options.strip_newline = true
+	end
 end
 
 function html.img(bbcode,options)
@@ -250,7 +254,7 @@
 
 function Bbcode.to_html(bbcode)
 	bbcode = bbcode_parse(bbcode)
-	%><div message><%
+	%><div from_bbcode><%
 	to_html(bbcode,{strip_newline=false})
 	%></div><%
 end