[LON-CAPA-cvs] cvs: loncom /homework insertlist.xml randomlabel.pm

albertel lon-capa-cvs-allow@mail.lon-capa.org
Wed, 17 Oct 2007 22:11:55 -0000


albertel		Wed Oct 17 18:11:55 2007 EDT

  Modified files:              
    /loncom/homework	randomlabel.pm insertlist.xml 
  Log:
  - BUG#5484, don't inster extra WS inside <label>
  
  
Index: loncom/homework/randomlabel.pm
diff -u loncom/homework/randomlabel.pm:1.89 loncom/homework/randomlabel.pm:1.90
--- loncom/homework/randomlabel.pm:1.89	Wed Jun 20 13:33:33 2007
+++ loncom/homework/randomlabel.pm	Wed Oct 17 18:11:55 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # random labelling tool
 #
-# $Id: randomlabel.pm,v 1.89 2007/06/20 17:33:33 banghart Exp $
+# $Id: randomlabel.pm,v 1.90 2007/10/17 22:11:55 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -61,7 +61,6 @@
 use Apache::Constants qw(:common :http);
 use Image::Magick;
 use Apache::lonplot;
-use lib '/home/httpd/lib/perl/';
 use LONCAPA;
  
 
@@ -553,6 +552,14 @@
 }
 
 # <label>$var_abc</label>
+sub insert_label {
+    my ($after) = @_;
+    my $depth = scalar(@Apache::lonxml::depthcounter);
+    $depth-- if ($after);
+    my $inset = "\t"x$depth;
+    return "\n$inset<label></label>";
+}
+
 sub start_label {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
     my $result='';
Index: loncom/homework/insertlist.xml
diff -u loncom/homework/insertlist.xml:1.11 loncom/homework/insertlist.xml:1.12
--- loncom/homework/insertlist.xml:1.11	Tue Sep 25 16:16:27 2007
+++ loncom/homework/insertlist.xml	Wed Oct 17 18:11:55 2007
@@ -496,7 +496,7 @@
 	<tag name="randomlabel::label">
 		<description>Label Text</description>
 		<color>#3333FF</color>
-		<insert_sub>default</insert_sub>
+		<insert_sub>Apache::randomlabel::insert_label</insert_sub>
 		<allow>block,display,import,notsolved,parserlib,postanswerdate,preduedate,problemtype,randomlist,script,scriptlib,solved,startouttext,tex,web,while</allow>
 	</tag>
 	<tag name="randomlist">