import Article from "./models/article.ts"; import Profile from "./models/profile.ts"; import { isoDate } from "./dates.ts"; export function profileAtomFeed(profile: Profile, articles: Article[]) { const feedId = `tag:${profile.nip05},nostr-p-${profile.pubkey}-k-30023`; const lastUpdate = articles.sort((a, b) => b.updatedAt - a.updatedAt)[0] ?.updatedAt; const articlesXml = articles.map((article) => { const articleId = `tag:${profile.nip05},nostr-d-${article.identifier}-k-30023`; return ` ${articleId} ${article.title} ${isoDate(article.updatedAt)} ${isoDate(article.publishedAt)} ${article.summary} `; }).join("\n"); return ` ${profile.name} on Nostr (Articles) ${feedId} ${isoDate(lastUpdate)} ${profile.picture} ${name} ${articlesXml} `.trim(); } export function cleanContentHtml(html: string) { const cleanHtml = html.replace( /