Browse Source

Correction des guillemets conforme à celle du plugin typo_guillemets :

- passer les guillemets français de premier niveau des titre de lien automatique en guillemets de second niveau.
- ne pas toucher aux guillemets quand le texte contient deja des guillemets élaborés
svn/root/tags/v1.5.2
cedric@yterium.com 10 years ago
parent
commit
67e0a2eea8
  1. 1
      .gitattributes
  2. 37
      orthotypo_fonctions.php
  3. 35
      orthotypo_options.php
  4. 2
      paquet.xml

1
.gitattributes vendored

@ -4,6 +4,7 @@ formulaires/configurer_orthotypo.html -text
lang/orthotypo_fr.php -text
lang/paquet-orthotypo_fr.php -text
/orthotypo_fonctions.php -text
/orthotypo_options.php -text
/paquet.xml -text
prive/squelettes/contenu/configurer_orthotypo.html -text
prive/themes/spip/images/orthotypo-32.png -text

37
orthotypo_fonctions.php

@ -161,27 +161,27 @@ Version optimisee par Patrice Vanneufville (2007) cf http://www.spip-contrib.net
// definitions des chaines de remplacement
define('_GUILLEMETS_defaut', '“$1”');
define('_GUILLEMETS_fr', '« $1 »'); //LRTEUIN
define('_GUILLEMETS_fr', '« $1 »'); //LRTEUIN
//define('_GUILLEMETS_ar', '');
define('_GUILLEMETS_bg', '„$1“');
//define('_GUILLEMETS_br', '');
//define('_GUILLEMETS_bs', '');
define('_GUILLEMETS_ca', '«$1»');
define('_GUILLEMETS_cpf', '« $1 »');
define('_GUILLEMETS_ca', '«$1»');
define('_GUILLEMETS_cpf', '« $1 »');
//define('_GUILLEMETS_cpf_hat', '');
define('_GUILLEMETS_cs', '„$1“');
define('_GUILLEMETS_da', '»$1«');
define('_GUILLEMETS_de', '„$1“'); //ou "»$1«" // LRTEUIN
define('_GUILLEMETS_da', '»$1«');
define('_GUILLEMETS_de', '„$1“'); //ou "»$1«" // LRTEUIN
define('_GUILLEMETS_en', '“$1”'); //LRTEUIN
define('_GUILLEMETS_eo', '«$1»');
define('_GUILLEMETS_es', '«$1»');
define('_GUILLEMETS_eo', '«$1»');
define('_GUILLEMETS_es', '«$1»');
//define('_GUILLEMETS_eu', '');
//define('_GUILLEMETS_fa', '');
//define('_GUILLEMETS_fon', '');
//define('_GUILLEMETS_gl', '');
define('_GUILLEMETS_hu', '„$1”');
define('_GUILLEMETS_it', '«$1»');
define('_GUILLEMETS_it_fem', '«$1»');
define('_GUILLEMETS_it', '«$1»');
define('_GUILLEMETS_it_fem', '«$1»');
define('_GUILLEMETS_ja', '「$1」');
//define('_GUILLEMETS_lb', '');
define('_GUILLEMETS_nl', '„$1”');
@ -194,11 +194,11 @@ define('_GUILLEMETS_nl', '„$1”');
//define('_GUILLEMETS_oc_prv', '');
//define('_GUILLEMETS_oc_va', '');
define('_GUILLEMETS_pl', '„$1”');
define('_GUILLEMETS_pt', '«$1»');
define('_GUILLEMETS_pt_br', '«$1»');
define('_GUILLEMETS_pt', '«$1»');
define('_GUILLEMETS_pt_br', '«$1»');
define('_GUILLEMETS_ro', '„$1”');
define('_GUILLEMETS_ru', '«$1»');
define('_GUILLEMETS_tr', '«$1»');
define('_GUILLEMETS_ru', '«$1»');
define('_GUILLEMETS_tr', '«$1»');
//define('_GUILLEMETS_vi', '');
define('_GUILLEMETS_zh', '「$1」'); // ou "“$1”" en chinois simplifie
@ -215,7 +215,16 @@ function orthotypo_guillemets_rempl($texte){
if (strpos($texte, '<')!==false){
$texte = preg_replace_callback('/(<[^>]+"[^>]*>)/Ums', 'orthotypo_guillemets_echappe_balises_callback', $texte);
}
if (strpos($texte, '"')!==false){
// si le texte ne contient pas de guill droit
// ou s'il contient deja des guillemets élaborés
// on ne touche pas
if (strpos($texte, '"')!==false
AND (strpos($texte, '&#171;') === false)
AND (strpos($texte, '&#187;') === false)
AND (strpos($texte, '&#8220;') === false)
AND (strpos($texte, '&#8221;') === false)
){
// choix de la langue, de la constante et de la chaine de remplacement
$lang = isset($GLOBALS['lang_objet'])?$GLOBALS['lang_objet']:$GLOBALS['spip_lang'];
$constante = '_GUILLEMETS_'.$lang;

35
orthotypo_options.php

@ -0,0 +1,35 @@
<?php
/**
* Plugin Ortho-Typographie
* (c) 2013 cedric
* Licence GNU/GPL
*/
if (!defined("_ECRIRE_INC_VERSION")) return;
/**
* pour les liens, on transforme les guill francais &laquo; &raquo; des titres en guill de second niveau
*
* @return mixed
*/
function inc_lien() {
static $config;
if (is_null($config))
$config = lire_config("orthotypo/");
if (!function_exists('inc_lien_dist')){
include_spip('inc/lien');
}
// recuperer le resultat normal
$args = func_get_args();
$typo = call_user_func_array('inc_lien_dist', $args);
if (!isset($config['guillemets']) OR $config['guillemets']){
// si on n'avait pas precise de titre, changer les guill du titre auto
if ($args[1] === '' AND strpos($typo,"&#171;")!==false)
$typo = preg_replace(',&#171;(&nbsp;)?(.*?)(&nbsp;)?&#187;,S', '&#8220;\2&#8221;', $typo);
}
// et hop
return $typo;
}

2
paquet.xml

@ -1,7 +1,7 @@
<paquet
prefix="orthotypo"
categorie="edition"
version="1.2.3"
version="1.3.0"
etat="test"
compatibilite="[3.0.0;3.0.*]"
logo="prive/themes/spip/images/orthotypo-32.png"

Loading…
Cancel
Save