be0ad59e7811986186f3142d6fa62191d7f7909b
3 /***************************************************************************\
4 * SPIP, Systeme de publication pour l'internet *
6 * Copyright (c) 2001-2016 *
7 * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James *
9 * Ce programme est un logiciel libre distribue sous licence GNU/GPL. *
10 * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. *
11 \***************************************************************************/
13 if (!defined("_ECRIRE_INC_VERSION")) {
17 // Correction typographique anglaise
19 function typographie_en($t) {
27 $charset = isset($GLOBALS['meta']['charset']) ?
$GLOBALS['meta']['charset'] : '';
30 $trans["\xc2\xa0"] = '~';
38 # cette chaine ne peut pas exister,
39 # cf. TYPO_PROTECTEUR dans inc/texte
42 $t = str_replace(array_keys($trans), array_values($trans), $t);
45 $t = preg_replace('/ --?,|(?: %)(?:\W|$)/S', '~$0', $t);
48 $t = preg_replace('/Mr\.? /S', '$0~', $t);
50 if (strpos($t, '\~') !== false) {
51 $t = str_replace('\~', "\x1\x14", $t);
54 if (strpos($t, '~') !== false) {
55 $t = preg_replace("/ *~+ */S", "~", $t);
58 $t = preg_replace("/--([^-]|$)/S", "$pro—$1", $t, -1, $c);
60 $t = preg_replace("/([-\n])$pro—/S", "$1--", $t);
61 $t = str_replace($pro, '', $t);
64 $t = str_replace('~', ' ', $t);
66 if (strpos($t, "\x1") !== false) {
67 $t = str_replace("\x1\x14", '~', $t);