3 /***************************************************************************\
4 * SPIP, Systeme de publication pour l'internet *
6 * Copyright (c) 2001-2013 *
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")) return;
15 // Correction typographique anglaise
17 function typographie_en($t) {
25 switch ($GLOBALS['meta']['charset']) {
27 $trans["\xc2\xa0"] = '~';
35 # cette chaine ne peut pas exister,
36 # cf. TYPO_PROTECTEUR dans inc/texte
39 $t = str_replace(array_keys($trans), array_values($trans), $t);
42 $t = preg_replace('/ --?,|(?: %)(?:\W|$)/S', '~$0', $t);
45 $t = preg_replace('/Mr\.? /S', '$0~', $t);
47 if (strpos($t, '~') !== false)
48 $t = preg_replace("/ *~+ */S", "~", $t);
50 $t = preg_replace("/--([^-]|$)/S", "$pro—$1", $t, -1, $c);
52 $t = preg_replace("/([-\n])$pro—/S", "$1--", $t);
53 $t = str_replace($pro, '', $t);
56 $t = str_replace('~', ' ', $t);