dépôts
/
velocampus
/
web
/
www.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[SPIP] ~2.1.12 -->2.1.25
[velocampus/web/www.git]
/
www
/
ecrire
/
typographie
/
fr.php
diff --git
a/www/ecrire/typographie/fr.php
b/www/ecrire/typographie/fr.php
index
7101c2d
..
3e05e19
100644
(file)
--- a/
www/ecrire/typographie/fr.php
+++ b/
www/ecrire/typographie/fr.php
@@
-3,7
+3,7
@@
/***************************************************************************\
* SPIP, Systeme de publication pour l'internet *
* *
/***************************************************************************\
* SPIP, Systeme de publication pour l'internet *
* *
- * Copyright (c) 2001-201
1
*
+ * Copyright (c) 2001-201
4
*
* Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James *
* *
* Ce programme est un logiciel libre distribue sous licence GNU/GPL. *
* Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James *
* *
* Ce programme est un logiciel libre distribue sous licence GNU/GPL. *
@@
-16,11
+16,10
@@
if (!defined('_ECRIRE_INC_VERSION')) return;
function typographie_fr_dist($letexte) {
function typographie_fr_dist($letexte) {
- static $trans;
-
+ static $trans, $cherche1, $remplace1, $cherche2, $remplace2;
// Nettoyer 160 = nbsp ; 187 = raquo ; 171 = laquo ; 176 = deg ;
// 147 = ldquo; 148 = rdquo; ' = zouli apostrophe
// Nettoyer 160 = nbsp ; 187 = raquo ; 171 = laquo ; 176 = deg ;
// 147 = ldquo; 148 = rdquo; ' = zouli apostrophe
- if (!
$trans
) {
+ if (!
isset($trans)
) {
$trans = array(
"'" => "’",
" " => "~",
$trans = array(
"'" => "’",
" " => "~",
@@
-38,36
+37,34
@@
function typographie_fr_dist($letexte) {
$chars_trans = explode(" ",$chars_trans);
foreach($chars as $k=>$r)
$trans[$chars_trans[$k]] = $r;
$chars_trans = explode(" ",$chars_trans);
foreach($chars as $k=>$r)
$trans[$chars_trans[$k]] = $r;
- }
- $letexte = strtr($letexte, $trans);
- $cherche1 = array(
+
$cherche1 = array(
/* 1 */ '/((?:^|[^\#0-9a-zA-Z\&])[\#0-9a-zA-Z]*)\;/S',
/* 2 */ '/»| --?,|(?::| %)(?:\W|$)/S',
/* 1 */ '/((?:^|[^\#0-9a-zA-Z\&])[\#0-9a-zA-Z]*)\;/S',
/* 2 */ '/»| --?,|(?::| %)(?:\W|$)/S',
- /* 3 */ '/([^[<(])([!?][!?\.]*)/iS',
+ /* 3 */ '/([^[<(
!?.
])([!?][!?\.]*)/iS',
/* 4 */ '/«|(?:M(?:M?\.|mes?|r\.?)|[MnN]°) /S'
/* 4 */ '/«|(?:M(?:M?\.|mes?|r\.?)|[MnN]°) /S'
- );
- $remplace1 = array(
+
);
+
$remplace1 = array(
/* 1 */ '\1~;',
/* 2 */ '~\0',
/* 3 */ '\1~\2',
/* 4 */ '\0~'
/* 1 */ '\1~;',
/* 2 */ '~\0',
/* 3 */ '\1~\2',
/* 4 */ '\0~'
- );
- $letexte = preg_replace($cherche1, $remplace1, $letexte);
- $letexte = preg_replace("/ *~+ */S", "~", $letexte);
-
- $cherche2 = array(
+ );
+ $cherche2 = array(
'/([^-\n]|^)--([^-]|$)/S',
'/([^-\n]|^)--([^-]|$)/S',
- ',(
http|https|ftp|mailto
)~((://[^"\'\s\[\]\}\)<>]+)~([?]))?,S',
+ ',(
' ._PROTOCOLES_STD . '
)~((://[^"\'\s\[\]\}\)<>]+)~([?]))?,S',
'/~/'
'/~/'
- );
- $remplace2 = array(
+
);
+
$remplace2 = array(
'\1—\2',
'\1\3\4',
' '
'\1—\2',
'\1\3\4',
' '
- );
+ );
+ }
+ $letexte = strtr($letexte, $trans);
+ $letexte = preg_replace($cherche1, $remplace1, $letexte);
+ $letexte = preg_replace("/ *~+ */S", "~", $letexte);
$letexte = preg_replace($cherche2, $remplace2, $letexte);
$letexte = preg_replace($cherche2, $remplace2, $letexte);
-
return $letexte;
}
return $letexte;
}