Make phone link RFC 3966 compliant

This commit is contained in:
Zora Franke 2024-07-28 19:49:52 +02:00
parent 54cfeefa02
commit eb0b5e5e15
2 changed files with 10 additions and 3 deletions

View file

@ -15,7 +15,13 @@
"url": "http://localhost" "url": "http://localhost"
} }
], ],
"phones": [], "phones": [
{
"label": "Büro",
"phone": "+49 234 56789",
"phone_rfc3966": "tel:+49-234-56789"
}
],
"location": { "location": {
"address": "Einhornhöhle, August Großkopf-Weg, Herzberg", "address": "Einhornhöhle, August Großkopf-Weg, Herzberg",
"lon": 51.635, "lon": 51.635,

View file

@ -17,6 +17,7 @@ type OrgEmail = {
type OrgPhone = { type OrgPhone = {
label: string; label: string;
phone: string; phone: string;
phone_rfc3966: string;
}; };
type OrgWebsite = { type OrgWebsite = {
@ -143,8 +144,8 @@ const buildContent = (o: Organisation): string => {
for (const { label, url } of o.websites) result += li(label, url, "🌐"); for (const { label, url } of o.websites) result += li(label, url, "🌐");
for (const { label, email } of o.emails) result += li(label, email, "📧"); for (const { label, email } of o.emails) result += li(label, email, "📧");
for (const { label, phone } of o.phones) for (const { label, phone, phone_rfc3966 } of o.phones)
result += li(`${label} (${phone})`, "tel:" + phone, "☎"); result += li(`${label} (${phone})`, phone_rfc3966, "☎");
result += `</ul>`; result += `</ul>`;