comparison util/stanza.lua @ 13569:59dacbd637c2

util.stanza: Handle Clark notation for attributes in :find()
author Kim Alvefur <zash@zash.se>
date Sun, 17 Nov 2024 13:40:20 +0100
parents 3615590fd9ed
children 9991b6bd98ef
comparison
equal deleted inserted replaced
13568:3615590fd9ed 13569:59dacbd637c2
275 275
276 repeat 276 repeat
277 local xmlns, name, text; 277 local xmlns, name, text;
278 local char = s_sub(path, pos, pos); 278 local char = s_sub(path, pos, pos);
279 if char == "@" then 279 if char == "@" then
280 if s_sub(path, pos + 1, pos + 1) == "{" then
281 return self.attr[s_gsub(s_sub(path, pos+2), "}", "\1", 1)];
282 end
280 local prefix, attr = s_match(path, "^([^:]+):(.*)", pos+1); 283 local prefix, attr = s_match(path, "^([^:]+):(.*)", pos+1);
281 if prefix and self.namespaces and self.namespaces[prefix] then 284 if prefix and self.namespaces and self.namespaces[prefix] then
282 return self.attr[self.namespaces[prefix] .. "\1" .. attr]; 285 return self.attr[self.namespaces[prefix] .. "\1" .. attr];
283 end 286 end
284 return self.attr[s_sub(path, pos + 1)]; 287 return self.attr[s_sub(path, pos + 1)];