heimrichhannot/contao-hyphenator-bundle

contao内容管理系统中的单词连字符。

1.11.4 2023-09-06 14:00 UTC

README

这是一个contao插件,它提供了服务器端的连字符功能(感谢 vanderlee/phpSyllable)。它默认支持标题和段落。

此模块还处理行中断异常,以保持公司名称等单词在一起,并防止行中断(请参阅 tl_page 后端实体)。

选项

为了扩展功能,可以在您的本地配置中调整所有选项。

跳过连字符

如果您想跳过几个标签的连字符,只需将 hyphen-none 作为css类添加到相应的元素或使用 tl_page.hyphenation 字段。

您还可以将需要跳过的标签添加到项目配置中。请参阅以下配置参考

配置参考

# Default configuration for extension with alias: "huh_hyphenator"
huh_hyphenator:
  
  # Add tags you want to be skipped from hyphenating, to array (string without <>)
  skip_tags: []

行中断异常

Hyphenator附带行中断异常处理。只需在 tl_page 上添加 lineBreakExceptions 以防止连接的单词组如

  • 公司名称(搜索:Heimrich & Hannot(?:\sGmbH)|Heimrich & Hannot(?:s)?,将替换为:<span class="text-nowrap">Heimrich&nbsp;&amp;&nbsp;Hannot&nbsp;GmbH</span>
  • 价格和其他单位(搜索:(\d|€)(\s)(\w),替换:$1[nbsp]$3,示例:160.000 m² -> 160.00<span class="text-nowrap">0 m</span>²167 Mio. € -> 16<span class="text-nowrap">7 M</span>io. €

如您所见,如果您提供了替换模式,则正则表达式将处理替换,否则如果只提供了搜索模式,则使用 &nbsp; 保护空格。

要求