inc_presentation.php3 inc_texte.php3 1.402 1.213 1.403 1.214

Update of /home/spip-cvs/spip/ecrire
In directory alan:/tmp/cvs-serv3767/ecrire

Modified Files:
  inc_presentation.php3 inc_texte.php3
Log Message:
Fusion <latex> -> <math>

Index: inc_texte.php3

RCS file: /home/spip-cvs/spip/ecrire/inc_texte.php3,v
retrieving revision 1.213
retrieving revision 1.214
diff -u -d -r1.213 -r1.214
--- inc_texte.php3 12 Jul 2004 01:10:21 -0000 1.213
+++ inc_texte.php3 12 Jul 2004 13:29:10 -0000 1.214
@@ -135,16 +135,14 @@
     $regexp_echap_code = "<code>((.*?))<\/code>";
     $regexp_echap_cadre = "<(cadre|frame)>((.*?))<\/(cadre|frame)>";
     $regexp_echap_poesie = "<(poesie|poetry)>((.*?))<\/(poesie|poetry)>";
- $regexp_echap_math = "<math>((.*?))<\/math>";
- $regexp_echap = "/($regexp_echap_html)|($regexp_echap_code)|($regexp_echap_cadre)|($regexp_echap_poesie)|($regexp_echap_math)/si";
+ $regexp_echap = "/($regexp_echap_html)|($regexp_echap_code)|($regexp_echap_cadre)|($regexp_echap_poesie)/si";
   } else {
     //echo creer_echappe_sans_pcre("cadre");
     $regexp_echap_html = "<html>(([^<]|<[^/]|</[^h]|</h[^t]|</ht[^m]|</htm[^l]|<\/html[^>])*)<\/html>";
     $regexp_echap_code = "<code>(([^<]|<[^/]|</[^c]|</c[^o]|</co[^d]|</cod[^e]|<\/code[^>])*)<\/code>";
     $regexp_echap_cadre = "(<[cf][ar][da][rm]e>(([^<]|<[^/]|</[^cf]|</[cf][^ar]|</[cf][ar][^da]|</[cf][ar][da][^rm]|</[cf][ar][da][rm][^e]|<\/[cf][ar][da][rm]e[^>])*)<\/[cf][ar][da][rm]e>)()"; // parentheses finales pour obtenir meme nombre de regs que pcre
     $regexp_echap_poesie = "(<poe[st][ir][ey]>(([^<]|<[^/]|</[^p]|</p[^o]|</po[^e]|</poe[^st]|</poe[st][^ir]|</poe[st][ir][^[ey]]|<\/poe[st][ir][ey][^>])*)<\/poe[st][ir][ey]>)()";
- $regexp_echap_math = "<math>(([^<]|<[^/]|</[^m]|</m[^a]|</ma[^t]|</mat[^h]|<\/math[^>])*)<\/math>";
- $regexp_echap = "($regexp_echap_html)|($regexp_echap_code)|($regexp_echap_cadre)|($regexp_echap_poesie)|($regexp_echap_math)";
+ $regexp_echap = "($regexp_echap_html)|($regexp_echap_code)|($regexp_echap_cadre)|($regexp_echap_poesie)";
   }

   while (($flag_pcre && preg_match($regexp_echap, $letexte, $regs))
@@ -193,11 +191,13 @@
       $lecode = "<div class=\"spip_poesie\"><div>".ereg_replace("\n+", "</div>\n<div>", $lecode)."</div></div>";
       
       $les_echap[$num_echap] = "</p>".propre($lecode)."<p class=\"spip\">";
- } else
+ }
+ /*else
     if ($regs[17]) {
       $lecode = $regs[19];
       $les_echap[$num_echap] = image_math($lecode);
     }
+ */

     $pos = strpos($letexte, $regs[0]);
     $letexte = substr($letexte,0,$pos)."@@SPIP_$source$num_echap@@"
@@ -205,6 +205,57 @@
   }

+ $texte_a_voir = $letexte;
+ while (ereg("<math>", $texte_a_voir)) {
+ include_ecrire ("inc_filtres_wem.php");
+ $debut =strpos($texte_a_voir, "<math>");
+ $fin = strpos($texte_a_voir,"</math>") + strlen("</math>");
+
+ $texte_debut = substr($texte_a_voir, 0, $debut);
+
+ $texte_milieu = substr($texte_a_voir, $debut+strlen("<math>"), $fin-$debut-strlen("<math></math>"));
+ $texte_fin = substr($texte_a_voir, $fin, strlen($texte_a_voir));
+
+ //$traiter_math = "image";
+
+ if ($traiter_math == "image") {
+ while((ereg("(\\$){2}([^$]+)(\\$){2}",$texte_milieu, $regs))) {
+ $num_echap++;
+ $les_echap[$num_echap] = "\n<p class=\"spip\" style=\"text-align: center;\">".image_math($regs[2])."</p>\n";
+ $pos = strpos($texte_milieu, $regs[0]);
+ $texte_milieu = substr($texte_milieu,0,$pos)."@@SPIP_$source$num_echap@@"
+ .substr($texte_milieu,$pos+strlen($regs[0]));
+
+ //$texte_milieu = preg_replace("/(\\$){2}([^$]+)(\\$){2}/e","'\n<p class=\"spip\" style=\"text-align: center;\">'.image_math(\"$2\").'</p>\n'",$texte_milieu);
+ // $texte_milieu = preg_replace("/(\\$){1}([^$]+)(\\$){1}/e","image_math(\"$2\")",$texte_milieu);
+ }
+ while((ereg("(\\$){1}([^$]+)(\\$){1}",$texte_milieu, $regs))) {
+ $num_echap++;
+ $les_echap[$num_echap] = image_math($regs[2]);
+ $pos = strpos($texte_milieu, $regs[0]);
+ $texte_milieu = substr($texte_milieu,0,$pos)."@@SPIP_$source$num_echap@@"
+ .substr($texte_milieu,$pos+strlen($regs[0]));
+ }
+ } else {
+
+ $texte_milieu = ereg_replace(">", "&#gt;", $texte_milieu);
+ $texte_milieu = ereg_replace("<", "&#lt;", $texte_milieu);
+ $fflag = 0;
+ while((ereg("$",$texte_milieu)) && ($fflag<5)) {
+ $texte_milieu = preg_replace("/(\\$){2}([^$]+)(\\$){2}/e","'\n\n<p class=\"spip\" style=\"text-align: center;\"><html><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><mstyle displaystyle=\"true\">'.(mathml2unicode(editermaths(\"$2\"))).'</mstyle></math></p></html>\n\n'",$texte_milieu);
+ $texte_milieu = preg_replace("/(\\$){1}([^$]+)(\\$){1}/e","'<html><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><mstyle displaystyle=\"true\">'.(mathml2unicode(editermaths(\"$2\"))).'</mstyle></math></html>'",$texte_milieu);
+
+ $fflag++;
+ }
+ }
+
+ $texte_a_voir = $texte_debut.$texte_milieu.$texte_fin;
+
+ }
+ $letexte = $texte_a_voir;
+
+
+
   //
   // Insertion d'images et de documents utilisateur
   //

Index: inc_presentation.php3

RCS file: /home/spip-cvs/spip/ecrire/inc_presentation.php3,v
retrieving revision 1.402
retrieving revision 1.403
diff -u -d -r1.402 -r1.403
--- inc_presentation.php3 12 Jul 2004 00:07:51 -0000 1.402
+++ inc_presentation.php3 12 Jul 2004 13:29:10 -0000 1.403
@@ -1232,6 +1232,7 @@
   global $spip_lang_rtl, $spip_lang_left;
   global $mode;
   global $connect_statut, $connect_toutes_rubriques;
+ global $browser_name, $browser_version, $browser_rev;
   
   $nom_site_spip = entites_html(lire_meta(« nom_site »));
   $titre = textebrut(typo($titre));
@@ -1245,8 +1246,11 @@
   @Header(« Content-Type: text/html; charset=$charset »);
   echo « <!DOCTYPE HTML PUBLIC ‹ -//W3C//DTD HTML 4.01 Transitional//EN › ‹ http://www.w3.org/TR/html4/loose.dtd ›>\n »;
   echo ‹ <html xmlns:m=« http://www.w3.org/1998/Math/MathML">’."\n".’<head>’."\n »;
- echo ‹ <object id=« mathplayer » classid=« clsid:32F66A20-7614-11D4-BD11-00104BD3F987 »> ›."\n". ›</object>’."\n";
- echo ‹ < ›.’?import namespace=« m » implementation="#mathplayer"?’.’>’."\n";
+
+ if (eregi(« msie », $browser_name)) {
+ echo ‹ <object id=« mathplayer » classid=« clsid:32F66A20-7614-11D4-BD11-00104BD3F987 »> ›."\n".’</object>’."\n";
+ echo ‹ < ›.’?import namespace=« m » implementation="#mathplayer"?’.’>’."\n";
+ }
   echo « <title>[$nom_site_spip] $titre</title>\n »;
   echo ‹ <meta http-equiv=« Content-Type » content="text/html; charset= ›.$charset.’">’;

@@ -1448,8 +1452,6 @@
   <?php
     // Hack pour forcer largeur des formo/forml sous Mozilla >= 1.7
     // meme principe que le behavior win_width.htc pour MSIE
-
- global $browser_name, $browser_version, $browser_rev;
     if (eregi("mozilla", $browser_name) AND $browser_rev >= 1.7) {
   ?>