wegmeister / hyphenator
基于TeX-Hyphenation算法的PHP单词连字符的Neos插件。
4.0.1
2022-09-19 14:37 UTC
Requires
- php: >=7.0
- neos/neos: ^7.0 || ^8.0
- org_heigl/hyphenator: ^2.3
README
基于TeX-Hyphenation算法的PHP单词连字符的Neos插件。
安装
要安装此包,请运行以下命令
composer require wegmeister/hyphenator
用法
将连字符添加到您希望进行连字符分割的元素中
通过融合使用
prototype(Vendor.Package:Element) {
# Add the hyphenator to a specific property only:
property = ${q(node).property('property')}
property.@process.hyphenate = Wegmeister.Hyphenator:Hyphenate {
# Set locale to the locale you want to use, defaults to the current locale
locale = 'de_DE'
# Set forceConversion to "true" if you also want to hyphenate the text in the backend.
forceConversion = true
}
# Instead of applying the hyphenator to all properties, you can hyphenate the complete element.
# This will not hyphenate html tags:
@process.hyphenateWholeElement = Wegmeister.Hyphenator:Hyphenate
}
通过流体使用
{namespace hyphenator=Wegmeister\Hyphenator\ViewHelpers}
<!--
Parameters are optional:
- locale: Custom locale to use for hyphenation (default: locale of current language)
- force: Force hyphenation in backend, too.
-->
<hyphenator:format.hyphenate locale="de_DE" force="{true}">
Text and <span>HTML</span> to hyphenate.
</hyphenator:format.hyphenate>
OR
{text -> hyphenator:format.hyphenate(locale: 'de_DE', force: true)}