--- loncom/xml/londefdef.pm 2011/10/06 22:18:59 1.415.4.5 +++ loncom/xml/londefdef.pm 2011/11/15 17:34:19 1.415.4.6 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Tags Default Definition Module # -# $Id: londefdef.pm,v 1.415.4.5 2011/10/06 22:18:59 raeburn Exp $ +# $Id: londefdef.pm,v 1.415.4.6 2011/11/15 17:34:19 raeburn Exp $ # # # Copyright Michigan State University Board of Trustees @@ -3830,11 +3830,32 @@ sub end_col { #-- tag (end tag optional) sub start_colgroup { - my ($target,$token) = @_; + my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style) = @_; my $currentstring = ''; if ($target eq 'web' || $target eq 'webgrade') { $currentstring = $token->[4]; - } + } + if ($target eq 'tex') { + # TODO: Ensure this tag is in a table: + + # Fetch the attributes and build the hash for the + # call to define_colgroup. + + my $span = &Apache::lonxml::get_param('span', $parstack, $safeeval); + my $halign = &Apache::lonxml::get_param('halign', $parstack, $safeeval); + + my %colgroup_params; + if ($span ne '') { + $colgroup_params{'span'} = $span; + } + if ($halign ne '') { + $colgroup_params{'halign'} = $halign; + } + + my $table = $Apache::londefdef::table[-1]; + $table->define_colgroup(\%colgroup_params); + + } return $currentstring; } @@ -4320,6 +4341,12 @@ sub start_tbody { my $currentstring = ''; if ($target eq 'web' || $target eq 'webgrade') { $currentstring = $token->[4]; + } + if ($target eq 'tex') { + # TODO: Ensure this tag is within a table: + + my $table = $Apache::londefdef::table[-1]; + $table->start_body(); } return $currentstring; } @@ -4329,6 +4356,12 @@ sub end_tbody { my $currentstring = ''; if ($target eq 'web' || $target eq 'webgrade') { $currentstring = $token->[2]; + } + if($target eq 'tex') { + # TODO: Ensure this tag is within a table: + + my $table = $Apache::londefdef::table[-1]; + $table->end_body(); } return $currentstring; } @@ -4339,6 +4372,11 @@ sub start_tfoot { my $currentstring = ''; if ($target eq 'web' || $target eq 'webgrade') { $currentstring = $token->[4]; + } + if ($target eq 'tex') { + # TODO: ensure this is within a table tag. + my $table = $Apache::londefdef::table[-1]; + $table->start_foot(); } return $currentstring; } @@ -4348,6 +4386,11 @@ sub end_tfoot { my $currentstring = ''; if ($target eq 'web' || $target eq 'webgrade') { $currentstring = $token->[2]; + } + if ($target eq 'tex') { + # TODO: Ensure this is in side a table + my $table = $Apache::londefdef::table[-1]; + $table->end_foot(); } return $currentstring; } @@ -4358,6 +4401,11 @@ sub start_thead { my $currentstring = ''; if ($target eq 'web' || $target eq 'webgrade') { $currentstring = $token->[4]; + } + if ($target eq 'tex') { + # Assume we're in a table... TODO: Verify that and ignore tag if not. + my $table = $Apache::londefdef::table[-1]; + $table->start_head(); } return $currentstring; } @@ -4367,6 +4415,12 @@ sub end_thead { my $currentstring = ''; if ($target eq 'web' || $target eq 'webgrade') { $currentstring = $token->[2]; + } + if ($target eq 'tex') { + # TODO: Verify we are in a table and ignore tag if not. + + my $table = $Apache::londefdef::table[-1]; + $table->end_head(); } return $currentstring; }