// SPDX-License-Identifier: GPL-2.0 // Adapted 2026-10-04 from Web3Templates Stablo cover-card composition. // Pinned source and full license: ../../../third_party/stablo/NOTICE.md and LICENSE. const escape=value=>String(value).replace(/[&<>"']/g,c=>({'&':'&','<':'<','>':'>','"':'"',"'":'''}[c])); /** Takes only validated preview records, never raw work metadata or filesystem paths. */ export function renderCards(works,lang) { if(!works.length) return `

${lang==='zh'?'当前预览暂无文章。':'No articles in this preview.'}

`; return `
    ${works.map((work,index)=>{ const locale=work.language==='zh-Hans'?'zh':'en'; const date=work.date?``:work.publicDisplay?'': `${lang==='zh'?'私有草稿':'Private draft'}`; return `
  1. ${escape(work.cover.alt)}

    ${escape(work.title)}

    ${work.excerpt?`

    ${escape(work.excerpt)}

    `:''}
    ${date}${lang==='zh'&&work.language==='en'?'英文原稿':''}
  2. `; }).join('')}
`; }