ttree/eel-estimatedreadingtime

EEL 助手,用于估算文档阅读时间

1.0.0 2018-02-13 18:20 UTC

This package is auto-updated.

Last update: 2024-08-26 05:09:26 UTC


README

此包为给定的文档计算估算阅读时间。

安装

composer require ttree/eel-estimatedreadingtime

使用

该包提供了一个服务:EEL 助手和一个 Fusion 原型。

如果您在变量 content 中有内容字符串,可以使用 EEL 助手,如下所示

${EstimatedReadingTime.get(content)}

方法 get 接受一个额外的参数,即阅读速度,以每分钟单词数表示。默认值为 200。您可以在 Settings.yaml 或表达式中更改此值

${EstimatedReadingTime.get(content, 240)}

Fusion 原型使用 Neos 提供的 ContentCollection 原型,在给定的路径上渲染内容

prototype(You.Site:ReadingTimeLabel) < prototype(Neos.Fusion:Value)
	readingTime = Ttree.Eel.EstimatedReadingTime:Get {
		nodePath = 'main'
	}
	value = ${'Read the article (' + this.readingTime + ' min.)'}
}

为了正确估算,文档节点必须在 node 上下文变量中可用。

鸣谢

ttree ltd - neos 解决方案提供商 赞助开发。

我们尽力用很多爱来制作这个包,我们欢迎赞助、支持请求……请与我们联系。

许可

许可协议为 MIT,请参阅 LICENSE