Diff

teal-src/util/datamapper.tl @ 11468:348b191cd850

util.datamapper: Complete array building support
author Kim Alvefur <zash@zash.se>
date Sat, 20 Mar 2021 21:29:51 +0100
parent 11467:88792dd2bee9
child 11469:087d710ed520
line wrap: on
line diff
--- a/teal-src/util/datamapper.tl	Sat Mar 20 21:25:45 2021 +0100
+++ b/teal-src/util/datamapper.tl	Sat Mar 20 21:29:51 2021 +0100
@@ -323,18 +323,9 @@
 		return out;
 
 	elseif schema.type == "array" then
-		local proptype, value_where, name, namespace = unpack_propschema(schema.items, current_name, current_ns)
-		-- TODO , prefix, single_attribute
-		if proptype == "string" then
-			for _, item in ipairs(t as { string }) do
-				if value_where == "in_text_tag" then
-				out:text_tag(name, item, { xmlns = namespace });
-			else
-				error "NYI"
-			end
-			end
-		else
-			error "NYI"
+		local proptype, value_where, name, namespace, prefix, single_attribute = unpack_propschema(schema.items, current_name, current_ns)
+		for _, item in ipairs(t as { string }) do
+			unparse_property(out, item, proptype, schema.items, value_where, name, namespace, current_ns, prefix, single_attribute)
 		end
 		return out;
 	end