WikiProducers
Editing
Module:VCard
Jump to:
navigation
,
search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
local p = {} local function esc(s) if not s or s == '' then return nil end s = tostring(s) s = s:gsub("\\","\\\\"):gsub("\n","\\n"):gsub(",","\\,"):gsub(";","\\;") return s end local function line(label, value) if value and value ~= '' then return label .. ':' .. value end return nil end function p._vcard(a) local L = {} table.insert(L, 'BEGIN:VCARD') table.insert(L, 'VERSION:3.0') table.insert(L, line('FN', esc(a.name))) table.insert(L, line('ORG', esc(a.org))) table.insert(L, line('TITLE', esc(a.title))) table.insert(L, line('TEL;TYPE=CELL,VOICE', esc(a.phone))) table.insert(L, line('EMAIL;TYPE=INTERNET', esc(a.email))) if a.street or a.city or a.state or a.zip or a.country then local adr = table.concat({ '', '', esc(a.street or ''), esc(a.city or ''), esc(a.state or ''), esc(a.zip or ''), esc(a.country or 'USA') }, ';') table.insert(L, 'ADR;TYPE=WORK:' .. adr) end table.insert(L, line('URL', esc(a.website))) if a.linkedin and a.linkedin ~= '' then table.insert(L, 'X-SOCIALPROFILE;type=linkedin:' .. esc(a.linkedin)) end if a.instagram and a.instagram ~= '' then table.insert(L, 'X-SOCIALPROFILE;type=instagram:' .. esc(a.instagram)) end if a.x and a.x ~= '' then table.insert(L, 'X-SOCIALPROFILE;type=x:' .. esc(a.x)) end table.insert(L, 'END:VCARD') return table.concat(L, '\r\n') end function p.dataURI(frame) local a = frame:getParent().args local vcard = p._vcard(a) return mw.uri.encode(vcard, 'PATH') -- URI-encode for data: URL end function p.plain(frame) local a = frame:getParent().args return p._vcard(a) -- raw vCard text (useful for QR codes) end return p
Summary:
Please note that all contributions to WikiProducers may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
WikiProducers:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Template used on this page:
Module:VCard/doc
(
edit
)
Edit Module