# HG changeset patch # User Kim Alvefur # Date 1535838379 -7200 # Node ID 292d283c7694edc772f8c58fe14b6e4a311c1005 # Parent 3f31e10e8256b454060e3dc356cf5305bfd82c5d mod_vcard_legacy: Add translation of telephone field diff -r 3f31e10e8256 -r 292d283c7694 plugins/mod_vcard_legacy.lua --- a/plugins/mod_vcard_legacy.lua Sat Sep 01 23:45:58 2018 +0200 +++ b/plugins/mod_vcard_legacy.lua Sat Sep 01 23:46:19 2018 +0200 @@ -59,6 +59,20 @@ end vcard_temp:up(); end + elseif tag.name == "tel" then + local text = tag:get_child_text("uri"); + if text then + if text:sub(1, 4) == "tel:" then + text = text:sub(5) + end + vcard_temp:tag("TEL"):text_tag("NUMBER", text); + if tag:find"parameters/type/text#" == "home" then + vcard_temp:tag("HOME"):up(); + elseif tag:find"parameters/type/text#" == "work" then + vcard_temp:tag("WORK"):up(); + end + vcard_temp:up(); + end end end end