import { parseFile } from '../file/util.mjs' import { contentToBlocks, parseMediaAndBanner } from '../util.mjs' export function parseArticles(articles) { for (let i = 0; i < articles.length; i++) { parseArticle(articles[i]) } return articles } export function combineFilesWithArticles(articles, files) { let articleMap = new Map() articles.forEach(article => { article.files = [] articleMap.set(article.id, article) }) files.forEach(file => { articleMap.get(file.id).files.push(parseFile(file)) }) } export function parseArticle(article) { if (!article) { return null } article.content = contentToBlocks(article.content) parseMediaAndBanner(article) return article }