patents = FileAttachment("data/patents.json").json()
// Function to highlight Nadav Amit in the author list
function highlightAuthor(authors) {
return authors.map(author =>
author === "Nadav Amit" ?
html`<u>${author}</u>` :
author
).reduce((prev, curr, i) => {
if (i === 0) return [curr];
if (i === authors.length - 1) return [...prev, " and ", curr];
return [...prev, ", ", curr];
}, []);
}
// Display the patents using the same classes as bibliography
viewof patentsList = html`
<ol class="listing" reversed>
${patents.map(patent => html`
<li class="bib-entry">
<span class="bib-authors">${highlightAuthor(patent.authors)}</span>.
<a href="${patent.link}" target="_blank">
<span class="bib-title">${patent.title}</span>
</a>.
<span>${patent.patent_number}</span>,
${patent.year}.
</li>
`)}
</ol>
`