const moment = require('moment'); const { Component, Fragment } = require('inferno'); const { toMomentLocale } = require('hexo/dist/plugins/helper/date'); const Share = require('./share'); const Donates = require('./donates'); const Comment = require('./comment'); const ArticleLicensing = require('hexo-component-inferno/lib/view/misc/article_licensing'); /** * Get the word count of text. */ function getWordCount(content) { if (typeof content === 'undefined') { return 0; } content = content.replace(/<\/?[a-z][^>]*>/gi, ''); content = content.trim(); return content ? (content.match(/[\u00ff-\uffff]|[a-zA-Z]+/g) || []).length : 0; } module.exports = class extends Component { render() { const { config, helper, page, index } = this.props; const { article, plugins } = config; const { url_for, date, date_xml, __, _p } = helper; const defaultLanguage = Array.isArray(config.language) && config.language.length ? config.language[0] : config.language; const indexLanguage = toMomentLocale(defaultLanguage || 'en'); const language = toMomentLocale(page.lang || page.language || defaultLanguage || 'en'); const cover = page.cover ? url_for(page.cover) : null; const updateTime = article && article.update_time !== undefined ? article.update_time : true; const isUpdated = page.updated && !moment(page.date).isSame(moment(page.updated)); const shouldShowUpdated = page.updated && ((updateTime === 'auto' && isUpdated) || updateTime === true); return {/* Main content */}
{/* Thumbnail */} {cover ?
{index ? {page.title : {page.title }
: null}
{/* Metadata */} {page.layout !== 'page' ? : null} {/* Title */} {page.title !== '' && index ?

{page.title}

: null} {page.title !== '' && !index ?

{page.title}

: null} {/* Content/Excerpt */}
{/* Licensing block */} {!index && article && article.licenses && Object.keys(article.licenses) ? : null} {/* Tags */} {!index && page.tags && page.tags.length ? : null} {/* "Read more" button */} {index && page.excerpt ? {__('article.more')} : null} {/* Share button */} {!index ? : null}
{/* Donate button */} {!index ? : null} {/* Post navigation */} {!index && (page.prev || page.next) ? : null} {/* Comment */} {!index ? : null}
; } };