diff src/bbcode/Bbcode.luan @ 48:4e1a01db19ec

add lists
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 17 Nov 2022 00:11:44 -0700
parents 2d4f00755092
children f225e82b2bf8
line wrap: on
line diff
--- a/src/bbcode/Bbcode.luan	Mon Nov 14 23:01:29 2022 -0700
+++ b/src/bbcode/Bbcode.luan	Thu Nov 17 00:11:44 2022 -0700
@@ -212,23 +212,18 @@
 local function list_to_html(bbcode,options)
 	local list = to_list(bbcode.contents)
 	for _, item in ipairs(list) do
-		if type(item) == "table" and item.name == "li" then
+		if type(item) == "table" and item.name == "item" then
 			%><li><% to_html(item.contents,options) %></li><%
 		end
 	end
 	options.strip_newline = true
 end
 
-function html.ul(bbcode,options)
-	%><ul><%
+function html.list(bbcode,options)
+	local tag = bbcode.param == "1" and "ol" or "ul"
+	%><<%=tag%>><%
 	list_to_html(bbcode,options)
-	%></ul><%
-end
-
-function html.ol(bbcode,options)
-	%><ol><%
-	list_to_html(bbcode,options)
-	%></ol><%
+	%></<%=tag%>><%
 end
 
 function to_html(bbcode,options)