fix(content): fix nbsp twig filter
This commit is contained in:
parent
9747dec1f9
commit
943ae7b63e
|
@ -17,12 +17,14 @@ class TypoExtension extends AbstractExtension
|
||||||
|
|
||||||
public function nbsp(string $value)
|
public function nbsp(string $value)
|
||||||
{
|
{
|
||||||
return preg_replace_callback(
|
foreach (['!', '?', ':'] as $char) {
|
||||||
'/(.+)(\.+|,+|;+|:+|!+|\?+)/isU',
|
$value = str_replace(
|
||||||
function($d) {
|
sprintf(' %s', $char),
|
||||||
return sprintf('%s %s', trim($d[1]), $d[2]);
|
sprintf(' %s', $char),
|
||||||
},
|
$value
|
||||||
$value
|
);
|
||||||
);
|
}
|
||||||
|
|
||||||
|
return $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue