244 |
245 |
245 if proptype == "string" and v is string then |
246 if proptype == "string" and v is string then |
246 out.attr[attr] = v |
247 out.attr[attr] = v |
247 elseif proptype == "number" and v is number then |
248 elseif proptype == "number" and v is number then |
248 out.attr[attr] = string.format("%g", v) |
249 out.attr[attr] = string.format("%g", v) |
249 elseif proptype == "integer" and v is number then |
250 elseif proptype == "integer" and v is number then -- TODO is integer |
250 out.attr[attr] = string.format("%d", v) |
251 out.attr[attr] = string.format("%d", v) |
251 elseif proptype == "boolean" then |
252 elseif proptype == "boolean" then |
252 out.attr[attr] = v and "1" or "0" |
253 out.attr[attr] = v and "1" or "0" |
253 end |
254 end |
254 elseif value_where == "in_text" then |
255 elseif value_where == "in_text" then |
264 |
265 |
265 if proptype == "string" and v is string then |
266 if proptype == "string" and v is string then |
266 propattr[single_attribute] = v |
267 propattr[single_attribute] = v |
267 elseif proptype == "number" and v is number then |
268 elseif proptype == "number" and v is number then |
268 propattr[single_attribute] = string.format("%g", v) |
269 propattr[single_attribute] = string.format("%g", v) |
269 elseif proptype == "integer" and v is number then |
270 elseif proptype == "integer" and v is number then -- TODO is integer |
270 propattr[single_attribute] = string.format("%d", v) |
271 propattr[single_attribute] = string.format("%d", v) |
271 elseif proptype == "boolean" and v is boolean then |
272 elseif proptype == "boolean" and v is boolean then |
272 propattr[single_attribute] = v and "1" or "0" |
273 propattr[single_attribute] = v and "1" or "0" |
273 end |
274 end |
274 out:tag(name, propattr):up(); |
275 out:tag(name, propattr):up(); |
286 end |
287 end |
287 elseif proptype == "string" and v is string then |
288 elseif proptype == "string" and v is string then |
288 out:text_tag(name, v, propattr) |
289 out:text_tag(name, v, propattr) |
289 elseif proptype == "number" and v is number then |
290 elseif proptype == "number" and v is number then |
290 out:text_tag(name, string.format("%g", v), propattr) |
291 out:text_tag(name, string.format("%g", v), propattr) |
291 elseif proptype == "integer" and v is number then |
292 elseif proptype == "integer" and v is number then -- TODO is integer |
292 out:text_tag(name, string.format("%d", v), propattr) |
293 out:text_tag(name, string.format("%d", v), propattr) |
293 elseif proptype == "boolean" and v is boolean then |
294 elseif proptype == "boolean" and v is boolean then |
294 out:text_tag(name, v and "1" or "0", propattr) |
295 out:text_tag(name, v and "1" or "0", propattr) |
295 elseif proptype == "object" and propschema is js.schema_t and v is table then |
296 elseif proptype == "object" and propschema is js.schema_t and v is table then |
296 local c = unparse(propschema, v, name, namespace); |
297 local c = unparse(propschema, v, name, namespace); |