[LON-CAPA-cvs] cvs: loncom /xml lonxml.pm

sakharuk lon-capa-cvs@mail.lon-capa.org
Thu, 03 Oct 2002 13:34:10 -0000


sakharuk		Thu Oct  3 09:34:10 2002 EDT

  Modified files:              
    /loncom/xml	lonxml.pm 
  Log:
   Correction for printing #. 
  
  
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.196 loncom/xml/lonxml.pm:1.197
--- loncom/xml/lonxml.pm:1.196	Fri Sep 13 16:46:09 2002
+++ loncom/xml/lonxml.pm	Thu Oct  3 09:34:10 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.196 2002/09/13 20:46:09 www Exp $
+# $Id: lonxml.pm,v 1.197 2002/10/03 13:34:10 sakharuk Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -363,6 +363,7 @@
     my $forcereg=shift;
     my $target = shift;
     my $result = '';
+    
     if ($target eq 'edit') {
         $result .="<script>\n".
             "if (typeof menu != 'undefined') {menu.currentURL=null;}\n".
@@ -575,8 +576,12 @@
     $current_token=~s/\\/\\char92 /g;
     $current_token=~s/\^/\\char94 /g;
     $current_token=~s/\~/\\char126 /g;
-    $current_token=~s/(&[^a-z#])/\\$1/g;
-    $current_token=~s/([^&]\#)/\\$1/g;
+    $current_token=~s/(&[^a-z\#])/\\$1/g;
+    if ($current_token=~/ \#\w/) {
+	$current_token=~s/ \#(\w)/ \\#$1/;
+    } else {
+	$current_token=~s/([^&]\#)/\\$1/g;
+    }
     $current_token=~s/(\$|_|{|})/\\$1/g;
     $current_token=~s/\\char92 /\\texttt{\\char92}/g;
     $current_token=~s/>/\$>\$/g; #more