--- loncom/homework/structuretags.pm 2007/10/12 18:45:47 1.403 +++ loncom/homework/structuretags.pm 2007/10/16 23:20:25 1.404 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # definition of tags that give a structure to a document # -# $Id: structuretags.pm,v 1.403 2007/10/12 18:45:47 albertel Exp $ +# $Id: structuretags.pm,v 1.404 2007/10/16 23:20:25 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1747,6 +1747,13 @@ sub start_startouttext { my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; my @result=(''.''); if ($target eq 'edit' || $target eq 'modified' ) { @result=('','no'); } + + my $nesting = + &Apache::lonxml::set_state('outtext', + &Apache::lonxml::get_state('outtext')+1); + if ($nesting > 1 && $env{'request.state'} eq 'construct') { + &Apache::lonxml::error("Nesting of <startouttext /> not allowed, on line ".$token->[5]); + } return (@result); } @@ -1786,6 +1793,14 @@ sub start_endouttext { $result=''. &Apache::edit::handle_insertafter('startouttext'); } + + my $nesting = + &Apache::lonxml::set_state('outtext', + &Apache::lonxml::get_state('outtext')-1); + if ($nesting < 0 && $env{'request.state'} eq 'construct') { + &Apache::lonxml::error(" Extraneous <endouttext /> not allowed on line ".$token->[5]); + &Apache::lonxml::set_state('outtext', 0); + } return $result; }