cook-ssg 2.11.0 → 2.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cook-ssg",
3
- "version": "2.11.0",
3
+ "version": "2.11.1",
4
4
  "description": "Cook your static pages into a beautifully performing site. Static site generation the web platform way.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -109,7 +109,7 @@ function fold(line) {
109
109
 
110
110
  /**
111
111
  * vCard 4.0 for contact.vcf.
112
- * @param {{ name?: string, email?: string, url?: string, org?: string, title?: string }} contact
112
+ * @param {{ name?: string, email?: string|string[], url?: string, org?: string, title?: string }} contact
113
113
  * @param {{ siteUrl?: string }} [options] `URL` defaults to siteUrl
114
114
  * @returns {{ text: string|null, warning?: string }}
115
115
  */
@@ -121,7 +121,8 @@ export function renderVcard(contact, { siteUrl } = {}) {
121
121
  const lines = ['BEGIN:VCARD', 'VERSION:4.0', `FN:${escapeVcardText(c.name.trim())}`];
122
122
  if (nonEmpty(c.org)) lines.push(`ORG:${escapeVcardText(c.org.trim())}`);
123
123
  if (nonEmpty(c.title)) lines.push(`TITLE:${escapeVcardText(c.title.trim())}`);
124
- if (nonEmpty(c.email)) lines.push(`EMAIL;PREF=1:${escapeVcardText(c.email.trim())}`);
124
+ const emails = (Array.isArray(c.email) ? c.email : [c.email]).filter(nonEmpty);
125
+ emails.forEach((e, i) => lines.push(`${i === 0 ? 'EMAIL;PREF=1' : 'EMAIL'}:${escapeVcardText(e.trim())}`));
125
126
  const url = nonEmpty(c.url) ? c.url : siteUrl;
126
127
  // URI value type: not text-escaped (RFC 6350); only strip whitespace so it cannot break a line.
127
128
  if (nonEmpty(url)) lines.push(`URL:${String(url).replace(/\s+/g, '')}`);