const getAuthors = function (node) { const result = []; const authorCount = node.getAttribute('authorcount') if (authorCount > 1) { for (let index = 1; index < authorCount + 1; index++) { const author = node.getAttribute(`author_${index}`) const email = node.getAttribute(`email_${index}`) const bio = node.getAttribute(`authorbio_${index}`) let twitter; if (email && email.startsWith("https://twitter.com/")) { twitter = email.replace("https://twitter.com/", ""); } result.push({ name: author, email: email, bio: bio, twitter: twitter }) } } else { const author = node.getAttribute('author') const email = node.getAttribute('email') const bio = node.getAttribute(`authorbio`) let twitter; if (email && email.startsWith("https://twitter.com/")) { twitter = email.replace("https://twitter.com/", ""); } result.push({ name: author, email: email, bio: bio, twitter: twitter }) } return result; } const renderAuthors = function (node) { const authors = getAuthors(node) return authors.map(author => { const authorImageUri = node.getMediaUri(`${author.twitter}.jpg`) return `
`; }).join('\n') } module.exports = { paragraph: (node) => `${node.getContent()}
`, document: (node) => `