--- loncom/xml/londefdef.pm 2011/10/06 22:18:59 1.415.4.5
+++ loncom/xml/londefdef.pm 2012/03/05 14:41:15 1.415.4.6.2.1
@@ -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.2.1 2012/03/05 14:41:15 raeburn Exp $
#
#
# Copyright Michigan State University Board of Trustees
@@ -56,7 +56,7 @@ use LONCAPA();
BEGIN {
- &Apache::lonxml::register('Apache::londefdef',('a','abbr','acronym','accessrule','address','allow','applet','area','b','base','basefont','bgo','bgsound','big','blink','blockquote','blankspace','body','br','button','caption','center','cite','code','col','colgroup','dd','del','dfn','dir','div','dl','dt','em','embed','externallink','fieldset','font','form','frame','frameset','h1','h2','h3','h4','h5','h6','head','hr','html','i','iframe','img','input','ins','insert','isindex','kbd','keygen','label','layer','legend','li','link','m','map','marquee','menu','meta','multicol','nobr','noembed','noframes','nolayer','noscript','object','ol','optgroup','option','output','p','param','pre','q','s','samp','select','server','small','spacer','span','strike','strong','sub','sup','table','tbody','td','textarea','tfoot','th','thead','title','tr','tt','tthoption','u','ul','var','wbr','hideweboutput'));
+ &Apache::lonxml::register('Apache::londefdef',('a','abbr','acronym','accessrule','address','allow','applet','area','b','base','basefont','bgo','bgsound','big','blink','blockquote','blankspace','body','br','button','caption','center','cite','code','col','colgroup','dd','del','dfn','dir','div','dl','dt','em','embed','externallink','fieldset','font','form','frame','frameset','h1','h2','h3','h4','h5','h6','head','hr','html','i','iframe','img','input','ins','insert','isindex','kbd','keygen','label','layer','legend','li','link','m','map','marquee','menu','meta','multicol','nobr','noembed','noframes','nolayer','noscript','object','ol','optgroup','option','output','p','param','pre','q','s','samp','select','server','small','spacer','span','strike','strong','style','sub','sup','table','tbody','td','textarea','tfoot','th','thead','title','tr','tt','tthoption','u','ul','var','wbr','hideweboutput'));
}
@@ -456,6 +456,31 @@ sub insert_meta {
';
}
+#-- tag
+sub start_style {
+ my ($target, $token, $tagstack, $parstack, $parser, $safeeval, $style) = @_;
+ my $currentstring = '';
+
+ if ($target eq 'tex') {
+ Apache::lonxml::startredirection();
+ } else {
+ $currentstring = $token->[4];
+ }
+ return $currentstring;
+}
+
+sub end_style {
+ my ($target, $token, $tagstack, $parstack, $parser, $safeeval) = @_;
+ my $currentstring = '';
+
+ if ($target eq 'tex') {
+ Apache::lonxml::endredirection();
+ } else {
+ $currentstring = $token->[2];
+ }
+ return $currentstring;
+}
+
# accessrule
sub start_accessrule {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style) = @_;
@@ -3830,11 +3855,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 +4366,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 +4381,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 +4397,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 +4411,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 +4426,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 +4440,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;
}