Skip to content
Extraits de code Groupes Projets
Valider bbec8fff rédigé par Fil's avatar Fil
Parcourir les fichiers

les diff dans les notes (paolo, #1239)

parent 852346bd
Branches
Étiquettes
Aucune requête de fusion associée trouvée
...@@ -323,7 +323,18 @@ class DiffPhrase { ...@@ -323,7 +323,18 @@ class DiffPhrase {
$punct = $regs[1] ? $regs[1] : $regs[6]; $punct = $regs[1] ? $regs[1] : $regs[6];
$milieu = ""; $milieu = "";
if ($punct) { if ($punct) {
// notes
if ($punct == '[[') {
$avant = substr($texte, 0, $p) . $regs[5] . $punct;
$texte = $regs[4] . substr($texte, $p + $l);
}
else
if ($punct == ']]') {
$avant = substr($texte, 0, $p) . $regs[5] . $punct;
$texte = substr($texte, $p + $l);
}
// Attacher les raccourcis fermants au mot precedent // Attacher les raccourcis fermants au mot precedent
else
if (preg_match(',^[\]}]+$,', $punct)) { if (preg_match(',^[\]}]+$,', $punct)) {
$avant = substr($texte, 0, $p) . $regs[5] . $punct; $avant = substr($texte, 0, $p) . $regs[5] . $punct;
$texte = $regs[4] . substr($texte, $p + $l); $texte = $regs[4] . substr($texte, $p + $l);
......
...@@ -573,8 +573,10 @@ function propre_diff($texte) { ...@@ -573,8 +573,10 @@ function propre_diff($texte) {
foreach ($regs as $c => $reg) { foreach ($regs as $c => $reg) {
$bal = (!$reg[1]) ? $reg[0] : "</$reg[2]>"; $bal = (!$reg[1]) ? $reg[0] : "</$reg[2]>";
$texte = str_replace('@@@SPIP_DIFF'.$c.'@@@', $bal, $texte); $texte = str_replace('@@@SPIP_DIFF'.$c.'@@@', $bal, $texte);
$GLOBALS['les_notes'] = str_replace('@@@SPIP_DIFF'.$c.'@@@', $$bal, $GLOBALS['les_notes']); $GLOBALS['les_notes'] = str_replace('@@@SPIP_DIFF'.$c.'@@@', $bal, $GLOBALS['les_notes']);
} }
// quand le dernier tag est ouvrant le refermer ... // quand le dernier tag est ouvrant le refermer ...
$reg = end($regs); $reg = end($regs);
if (!$reg[1] AND $reg[2]) $texte.="</$reg[2]>"; if (!$reg[1] AND $reg[2]) $texte.="</$reg[2]>";
......
...@@ -257,7 +257,7 @@ function revision_comparee($id_article, $id_version, $format='diff', $id_diff=NU ...@@ -257,7 +257,7 @@ function revision_comparee($id_article, $id_version, $format='diff', $id_diff=NU
AND isset($old[$champ])) { AND isset($old[$champ])) {
// cas particulier : id_rubrique // cas particulier : id_rubrique
if (in_array($champ, array('id_rubrique'))) { if (in_array($champ, array('id_rubrique'))) {
$textes[$champ] = _T('version_deplace_rubrique', $textes[$champ] = _T('version_deplace_rubrique',
array('from'=> titre_rubrique($old[$champ]) array('from'=> titre_rubrique($old[$champ])
,'to'=>titre_rubrique($new[$champ])) ,'to'=>titre_rubrique($new[$champ]))
); );
...@@ -269,7 +269,6 @@ function revision_comparee($id_article, $id_version, $format='diff', $id_diff=NU ...@@ -269,7 +269,6 @@ function revision_comparee($id_article, $id_version, $format='diff', $id_diff=NU
$n = preparer_diff($new[$champ]); $n = preparer_diff($new[$champ]);
$o = preparer_diff($old[$champ]); $o = preparer_diff($old[$champ]);
$textes[$champ] = afficher_diff($diff->comparer($n,$o)); $textes[$champ] = afficher_diff($diff->comparer($n,$o));
if ($format == 'diff' OR $format == 'apercu') if ($format == 'diff' OR $format == 'apercu')
$textes[$champ] = afficher_para_modifies($textes[$champ], ($format == 'apercu')); $textes[$champ] = afficher_para_modifies($textes[$champ], ($format == 'apercu'));
} }
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter