Browse Source

* Better TeX escape character checking

git-svn-id: trunk@12321 -
michael 16 years ago
parent
commit
73c40daa30
1 changed files with 14 additions and 8 deletions
  1. 14 8
      compiler/utils/msg2inc.pp

+ 14 - 8
compiler/utils/msg2inc.pp

@@ -612,15 +612,21 @@ Var
 begin
 begin
   hs:='';
   hs:='';
   for i:=1 to length(s) do
   for i:=1 to length(s) do
-    if (S[i]='$') then
-     begin
-       if (s[i+1] in ['0'..'9']) then
-        hs:=hs+'arg'
-       else
-        hs:=hs+'\$';
-     end
+    case S[i] of
+      '$' :
+        if (s[i+1] in ['0'..'9']) then
+          hs:=hs+'arg'
+        else
+          hs:=hs+'\$';
+      '&','{','}','#','_','%':            // Escape these characters
+        hs := hs + '\' + S[i];
+      '~','^':
+        hs := hs + '\'+S[i]+' ';
+      '\':
+        hs:=hs+'$\backslash$'
     else
     else
-      hs:=hs+s[i];
+      hs := hs + S[i];
+    end;  
   EscapeString:=hs;
   EscapeString:=hs;
 end;
 end;