]> matita.cs.unibo.it Git - helm.git/blobdiff - matitaB/matita/matitaweb.js
Matitaweb: TeX-like macro handling.
[helm.git] / matitaB / matita / matitaweb.js
index 8b607e21adcb897cebea009b3bdcc98075bb2d69..0805e0b9adc297d1e1b5e144388691def7aa4785 100644 (file)
@@ -133,6 +133,12 @@ function restoreSelection() {
                 }
     }
 }
+
+function lookup_tex(texmacro)
+{
+  texmacro = texmacro.substring(1);
+  return unescape(macro2utf8[texmacro]);
+}
  
 function keypress(e)
 {
@@ -146,8 +152,10 @@ function keypress(e)
          match = unlocked.innerHTML.substring(i,j);
          pre = unlocked.innerHTML.substring(0,i);
          post = unlocked.innerHTML.substring(j);
-         if (match == '\\to') {
-             unlocked.innerHTML = pre + "-> " + post;
+         
+         sym = lookup_tex(match);
+         if (typeof sym != "undefined") {
+             unlocked.innerHTML = pre + sym + " " + post;
              restoreSelection(); 
             return suppressdefault(e,true);
          }