hexo-theme-volantis
Version:
Elegant and powerful theme for Hexo.
36 lines (28 loc) • 977 B
JavaScript
/**
* timeline.js | https://volantis.js.org/v3/tag-plugins/#Timeline
*/
;
function postTimeline(args, content) {
if (args.length > 0) {
return `<div class="timeline"><p class='p h2'>${args}</p>${content}</div>`;
}
return `<div class="timeline">${content}</div>`;
}
function postTimenode(args, content) {
if (/::/g.test(args)) {
args = args.join(' ').split('::');
}
else {
args = args.join(' ').split(',');
}
var time = args[0];
return `<div class="timenode"><div class="meta"><p>${hexo.render.renderSync({ text: time, engine: 'markdown' })}</p></div><div class="body">${hexo.render.renderSync({ text: content, engine: 'markdown' }).split('\n').join('')}</div></div>`;
}
// {% timeline %}
// ... timenode ...
// {% endtimeline %}
hexo.extend.tag.register('timeline', postTimeline, { ends: true });
// {% timenode time %}
// what happened
// {% endtimenode %}
hexo.extend.tag.register('timenode', postTimenode, { ends: true });