X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=www%2Fplugins-dist%2Ftextwheel%2Ftypographie%2Fen.php;h=be0ad59e7811986186f3142d6fa62191d7f7909b;hb=4f443dce95ff6f8221c189880a70c74ce1c1f238;hp=1525ca6068b6a1d6503b91f7bf46fee029a58595;hpb=4a628e9b277d3617535f99d663ca79fa2e891177;p=lhc%2Fweb%2Fwww.git diff --git a/www/plugins-dist/textwheel/typographie/en.php b/www/plugins-dist/textwheel/typographie/en.php index 1525ca60..be0ad59e 100644 --- a/www/plugins-dist/textwheel/typographie/en.php +++ b/www/plugins-dist/textwheel/typographie/en.php @@ -10,7 +10,9 @@ * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * \***************************************************************************/ -if (!defined("_ECRIRE_INC_VERSION")) return; +if (!defined("_ECRIRE_INC_VERSION")) { + return; +} // Correction typographique anglaise @@ -19,10 +21,11 @@ function typographie_en($t) { if (!isset($trans)) { $trans = array( - " " => '~', - "'" => '’' + " " => '~', + "'" => '’' ); - switch ($GLOBALS['meta']['charset']) { + $charset = isset($GLOBALS['meta']['charset']) ? $GLOBALS['meta']['charset'] : ''; + switch ($charset) { case 'utf-8': $trans["\xc2\xa0"] = '~'; break; @@ -44,8 +47,13 @@ function typographie_en($t) { /* 4 */ $t = preg_replace('/Mr\.? /S', '$0~', $t); - if (strpos($t, '~') !== false) + if (strpos($t, '\~') !== false) { + $t = str_replace('\~', "\x1\x14", $t); + } + + if (strpos($t, '~') !== false) { $t = preg_replace("/ *~+ */S", "~", $t); + } $t = preg_replace("/--([^-]|$)/S", "$pro—$1", $t, -1, $c); if ($c) { @@ -55,5 +63,9 @@ function typographie_en($t) { $t = str_replace('~', ' ', $t); + if (strpos($t, "\x1") !== false) { + $t = str_replace("\x1\x14", '~', $t); + } + return $t; }