<%
/*
pub-listing.ejs — Quarto custom listing template for academic publications
Line 1: authors. year. title. journal vol(issue): pages. doi [badges]
Line 2: PDF | Preprint | SharedIt | Code | Data | Supplemental | metrics
Line 3: Award (if any)
Line 4: Coverage (if any)
Line 5: Invited presentations (if any)
Requires Quarto >= 1.6.42:
- metadataAttrs(item) on each item element (enables List.js sort/filter/pagination)
- utils.b64encode(category) in category onclick (categories are base64-encoded since 1.6.42)
- Outer wrapper must have class="list" for List.js to recognise the container
*/
%>
<%/* ── Outer wrapper: class="list" is required for List.js */%>
<% for (const item of items) {
const catsArr = Array.isArray(item.categories)
? item.categories
: (item.categories ? String(item.categories).split(new RegExp('[,;|]')).map(function(s){ return s.trim(); }).filter(Boolean) : []);
const vol = item.volume ? String(item.volume) : "";
const iss = item.issue ? String(item.issue) : "";
const pgs = item.pages ? String(item.pages) : "";
let volRef = "";
if (vol) volRef += vol;
if (iss) volRef += "(" + iss + ")";
if (pgs) volRef += ": " + pgs;
const itemMediaCoverage = item["mediacoverage"] || "";
const itemInvitedPresentation = item["invitedpresentation"] || "";
const itemHighlyCited = item["highlycited"] || 0;
const itemHotPaper = item["hotpaper"] || 0;
const hasDoi = !!(item.doi && item.doi !== "");
const hasPdf = !!(item.pdf && item.pdf !== "");
const hasPreprint = !!(item.preprint && item.preprint !== "");
const hasShareIt = !!(item.shareit && item.shareit !== "");
const hasGitHub = !!(item.github && item.github !== "");
const hasCode = !!(item.code && item.code !== "");
const hasData = !!(item.data && item.data !== "");
const hasSup = !!(item.supplemental && item.supplemental !== "");
const internalTags = ["selected", "peer-reviewed", "highly-cited", "hot-paper"];
const visibleTags = catsArr.filter(function(c){ return internalTags.indexOf(c) === -1; });
const isoDate = item.date
? String(item.date)
: (item.year ? String(item.year) + "-01-01" : "");
%>
<%/*
metadataAttrs(item) emits all the data-* attributes List.js needs for
sort / filter / search. It MUST be on the element that wraps each item.
*/%>
>
<%/* Hidden fields for List.js */%>
<%- item.title %>
<%- item.authors %>
<%= isoDate %>
<%/*
listing-categories: each span's onclick must use utils.b64encode(cat)
— required for Quarto >= 1.6.42 where categories are base64-encoded.
*/%>
<% catsArr.forEach(function(cat) { %>
<%- cat %>
<% }); %>
<%/* ── LINE 1: Citation ───────────────────────────────────────── */%>
<%
%><%- item.authors %>. <%
if (item.year) { %><%= item.year %>. <% } %><%
if (item.path && item.path !== "") { %><%- item.title %><%
} else { %><%- item.title %><% } %>.<%
if (item.journal) { %> <%- item.journal %><%
if (volRef) { %> <%- volRef %><% } %>.<%
} %><%
if (hasDoi) { %> doi: <%= item.doi %>.<% } %><%
if (itemHighlyCited) { %>
<% } %><%
if (itemHotPaper) { %>
<% } %>
<%/* ── LINE 2: Links & metric badges ─────────────────────────── */%>
<% if (hasDoi || hasPdf || hasPreprint || hasShareIt || hasGitHub || hasCode || hasData || hasSup) { %>
<%
if (hasPdf) { %> PDF <% } %><%
if (hasPreprint) { %> Preprint <% } %><%
if (hasShareIt) { %> SharedIt <% } %><%
if (hasGitHub) { %> GitHub <% } %><%
if (hasCode) { %> Code <% } %><%
if (hasData) { %> Data <% } %><%
if (hasSup) { %> Supplemental <% } %><%
if (hasDoi) { %> <% } %><%
if (hasDoi) { %><% } %>
<% } %>
<%/* ── LINE 3: Award ──────────────────────────────────────────── */%>
<% if (item.awards && item.awards !== "") { %>
Award: <%- item.awards %>
<% } %>
<%/* ── LINE 4: Media coverage */%>
<% if (itemMediaCoverage !== "") { %>
Coverage: <%- itemMediaCoverage %>
<% } %>
<%/* ── LINE 5: Invited presentations */%>
<% if (itemInvitedPresentation !== "") { %>
Invited presentation: <%- itemInvitedPresentation %>
<% } %>
<% } %>
<%/* end .pub-listing.list */%>