[LON-CAPA-cvs] cvs: loncom /imspackages imsprocessor.pm

raeburn lon-capa-cvs@mail.lon-capa.org
Wed, 20 Jul 2005 05:13:52 -0000


raeburn		Wed Jul 20 01:13:52 2005 EDT

  Modified files:              
    /loncom/imspackages	imsprocessor.pm 
  Log:
  Do not need to decode entities in Web CT4 quiz DB import (already done by HTMLParser). Correct &nbsp as &nbsp; etc. Make img src tags xhtml compliant, while avoiding converting <img src /> to <img src / />.
  
  
Index: loncom/imspackages/imsprocessor.pm
diff -u loncom/imspackages/imsprocessor.pm:1.26 loncom/imspackages/imsprocessor.pm:1.27
--- loncom/imspackages/imsprocessor.pm:1.26	Wed Jul 13 17:21:01 2005
+++ loncom/imspackages/imsprocessor.pm	Wed Jul 20 01:13:46 2005
@@ -2864,13 +2864,10 @@
             $allfeedback .= $feedback;
         }
         if ($$settings{$id}{texttype} eq 'text/html') {
-            $$settings{$id}{text} = &HTML::Entities::decode($$settings{$id}{text});
+            $$settings{$id}{text} =~ s/(\&)(nbsp|gt|lt)(?!;)/$1$2;$3/gi;
             $$settings{$id}{text} = &Apache::loncleanup::htmlclean($$settings{$id}{text});
-            $$settings{$id}{text} =~ s#(<img src=["']?)([^>]+)(/?>)#$1../../resfiles/$2 />#gi;
+            $$settings{$id}{text} =~ s#(<img src=["']?)([^>]+?)(/?>)#$1../../resfiles/$2 />#gi;
             $$settings{$id}{text} =~ s#<([bh])r>#<$1r />#g;
-#            $$settings{$id}{text} =~ s#<p>#</p><p>#g;
-#            $$settings{$id}{text} =~ s#</p></p>#</p>#;
-#            $$settings{$id}{text} =~ s#<p></p>##g;
             $$settings{$id}{text} =~ s#<p>#<br /><br />#g;
             $$settings{$id}{text} =~ s#</p>##g;
         }