spipremix/typographer

用于SPIP CMS的字体校对工具。

dev-master 2021-11-22 09:40 UTC

This package is auto-updated.

Last update: 2024-09-22 15:49:15 UTC


README

SpipRemix Typographer 是一个为 SPIP 内容提供微字体校对的工具。

它依赖于 SpipRemix/Typography,该库本身又依赖于 JoliCode/JoliTypo 库。

安装

composer require spipremix/typographer

注意事项

此Typographer会从SPIP环境中确定要使用的默认区域设置。它还会调用SPIP管道(typography_rules)来修改或完善默认使用的规则。

使用方法

use SpipRemix/Typographer/Typographer;

// This will choose locale from globals or constant in usage in SPIP CMS,
// and rules to apply for that locale by calling `typography_rules` pipeline.
$typographer = new Typographer();

$htmlContent = $typographer->fix($htmlContent);
$stringContent = $typographer->fixString($stringContent);

您可以指定要使用的区域设置和规则

// Specify locale
$typographer = new Typographer('fr_FR');
// Or just a lang (a common mapping is done, see Typographer::MAP_LANG_TO_LOCALE)
$typographer = new Typographer('fr');
// Second parameter is for a specific rules list to use
$typographer = new Typographer('fr_FR', ['SmartQuotes', 'CurlyQuotes']);