/**
* timeline
* by Jerry
*/
'use strict'
function timeLineFn (args, content) {
const tlBlock = /\n([\w\W\s\S]*?)/g
let result = ''
if (args.length) {
args = hexo.render.renderSync({ text: args.join(' '), engine: 'markdown' })
result += `
`
}
const matches = []
let match
while ((match = tlBlock.exec(content)) !== null) {
matches.push(match[1])
matches.push(match[2])
}
console.log(matches)
for (let i = 0; i < matches.length; i += 2) {
const tlChildTitle = hexo.render.renderSync({ text: matches[i], engine: 'markdown' })
const tlChildContent = hexo.render.renderSync({ text: matches[i + 1], engine: 'markdown' })
const tlTitleHtml = ``
const tlContentHtml = `${tlChildContent}
`
result += `${tlTitleHtml + tlContentHtml}
`
}
return `${result}
`
}
hexo.extend.tag.register('timeline', timeLineFn, { ends: true })