--- loncom/xml/londefdef.pm 2005/07/11 09:49:59 1.279
+++ loncom/xml/londefdef.pm 2005/07/11 10:27:58 1.280
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Tags Default Definition Module
#
-# $Id: londefdef.pm,v 1.279 2005/07/11 09:49:59 foxr Exp $
+# $Id: londefdef.pm,v 1.280 2005/07/11 10:27:58 foxr Exp $
#
#
# Copyright Michigan State University Board of Trustees
@@ -1475,12 +1475,44 @@ sub end_hr {
}
#--
tag (end tag required)
+{
+
+# Since div can be nested, the stack below is used
+# in 'tex' mode to store the ending strings
+# for the div stack.
+
+ my @div_end_stack;
+
sub start_div {
- my ($target,$token) = @_;
+ my ($target,$token, $tagstack, $parstack, $parser, $safeeval) = @_;
my $currentstring = &end_p(); # Close enclosing para.
if ($target eq 'web') {
$currentstring .= $token->[4];
}
+ if ($target eq 'tex') {
+ # 4 possible alignments: left, right, center, and -missing-.
+
+ my $endstring = '';
+
+ my $align = lc(&Apache::lonxml::get_param('align', $parstack,
+ $safeeval, undef, 1));
+ if ($align eq 'center') {
+ $currentstring .= '\begin{center}';
+ $endstring = '\end{center}';
+ }
+ elsif ($align eq 'right') {
+ $currentstring .= '\begin{flushright}';
+ $endstring .= '\end{flushright}';
+ } elsif ($align eq 'left') {
+ $currentstring .= '\begin{flushleft}';
+ $endstring = '\end{flushleft}';
+ } else {
+
+ }
+ $currentstring .= "\n"; # For human readability.
+ $endstring = "\n$endstring\n"; # For human readability
+ push(@div_end_stack, $endstring);
+ }
return $currentstring;
}
@@ -1489,9 +1521,14 @@ sub end_div {
my $currentstring = '';
if ($target eq 'web') {
$currentstring .= $token->[2];
- }
+ }
+ if ($target eq 'tex') {
+ my $endstring = pop @div_end_stack;
+ $currentstring .= $endstring;
+ }
return $currentstring;
}
+}
#--
tag (end tag required)
sub start_a {