Changeset

9059:e1db06a0cc6b

util.vcard: Use the new :text_tag API in more places
author Kim Alvefur <zash@zash.se>
date Thu, 26 Jul 2018 00:17:23 +0200
parents 9058:35421a289a75
children 9060:69bc3144c2b7
files util/vcard.lua
diffstat 1 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/util/vcard.lua	Wed Jul 25 23:54:48 2018 +0200
+++ b/util/vcard.lua	Thu Jul 26 00:17:23 2018 +0200
@@ -71,12 +71,12 @@
 		end
 
 		if prop_def.value then
-			t:tag(prop_def.value):text(item[1]):up();
+			t:text_tag(prop_def.value, item[1]);
 		elseif prop_def.values then
 			local prop_def_values = prop_def.values;
 			local repeat_last = prop_def_values.behaviour == "repeat-last" and prop_def_values[#prop_def_values];
 			for i=1,#item do
-				t:tag(prop_def.values[i] or repeat_last):text(item[i]):up();
+				t:text_tag(prop_def.values[i] or repeat_last, item[i]);
 			end
 		end
 	end
@@ -318,7 +318,7 @@
 	self:tag(node:lower())
 	-- FIXME params
 	if type(value) == "string" then
-		self:tag("text"):text(value):up()
+		self:text_tag("text", value);
 	elseif vcard4[node] then
 		vcard4[node](value);
 	end
@@ -327,7 +327,7 @@
 
 function vcard4.N(value)
 	for i, k in ipairs(vCard_dtd.N.values) do
-		value:tag(k):text(value[i]):up();
+		value:text_tag(k, value[i]);
 	end
 end
 
@@ -339,17 +339,17 @@
 
 	local prop_def = vCard4_dtd[typ];
 	if prop_def == "text" then
-		t:tag("text"):text(item[1]):up();
+		t:text_tag("text", item[1]);
 	elseif prop_def == "uri" then
 		if item.ENCODING and item.ENCODING[1] == 'b' then
-			t:tag("uri"):text("data:;base64,"):text(item[1]):up();
+			t:text_tag("uri", "data:;base64," .. item[1]);
 		else
-			t:tag("uri"):text(item[1]):up();
+			t:text_tag("uri", item[1]);
 		end
 	elseif type(prop_def) == "table" then
 		if prop_def.values then
 			for i, v in ipairs(prop_def.values) do
-				t:tag(v:lower()):text(item[i] or ""):up();
+				t:text_tag(v:lower(), item[i]);
 			end
 		else
 			t:tag("unsupported",{xmlns="http://zash.se/protocol/vcardlib"})