[SPIP Zone] r4837 - /_plugins_/_typo_/barre_typo_enrichie/inc/texte.php

Author: real3t@gmail.com
Date: Thu Aug 24 00:06:42 2006
New Revision: 4837

Log:
Suivre la SVN (http://trac.rezo.net/trac/spip/changeset/7156)

Modified:
    _plugins_/_typo_/barre_typo_enrichie/inc/texte.php

Modified: _plugins_/_typo_/barre_typo_enrichie/inc/texte.php

--- _plugins_/_typo_/barre_typo_enrichie/inc/texte.php (original)
+++ _plugins_/_typo_/barre_typo_enrichie/inc/texte.php Thu Aug 24 00:06:42 2006
@@ -942,18 +942,24 @@
// http://doc.spip.org/@traiter_modeles
function traiter_modeles($texte, $doublons=false) {
   // detecter les modeles (rapide)
- if (preg_match_all('/<[a-z_-]{3,}[0-9|]+/iS',
+ if (preg_match_all('/<[a-z_-]{3,}\s*[0-9|]+/iS',
   $texte, $matches, PREG_SET_ORDER)) {
     include_spip('public/assembler');
     foreach ($matches as $match) {
       // Recuperer l'appel complet (y compris un eventuel lien)
- // $regs : 1 => modele, 2 => type, 3 => id, 5 => params, 6 => a
+ // $regs : 1 => modele, 2 => type, 3 => id, 4 => params, 5 => a
       $a = strpos($texte,$match[0]);
       preg_match(
- '/^(<([a-z_-]{3,})([0-9]*)([|](.*?))?'.'>)\s*(<\/a>)?/isS',
+ '/^' #debut
+ .'(<([a-z_-]{3,})' # <modele
+ .'\s*([0-9]*)\s*' # id
+ .'([|](?:<[^<>]*>|[^>])*)?' # |arguments (y compris des tags <...>)
+ .'>)' # fin du modele >
+ .'\s*(<\/a>)?' # eventuel </a>
+ .'/isS',
       substr($texte, $a), $regs);

- if ($regs[6] AND preg_match(
+ if ($regs[5] AND preg_match(
       ',<a\s.*>\s*$,Uis', substr($texte, 0, $a), $r)) {
         $lien = array(
           extraire_attribut($r[0],'href'),
@@ -968,7 +974,7 @@

       // calculer le modele
       if ($doublons) $modele = ''; else # hack articles_edit, breves_edit
- $modele = inclure_modele($regs[2], $regs[3], $regs[5], $lien);
+ $modele = inclure_modele($regs[2], $regs[3], $regs[4], $lien);

       // le remplacer dans le texte
       if ($modele !== false) {