';
return $result;
}
@@ -1081,7 +1098,7 @@ sub start_block {
if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' ||
$target eq 'tex' || $target eq 'analyze' || $target eq 'webgrade') {
my $code = $token->[2]->{'condition'};
- if (defined($code)) {
+ if (defined($code) && $code ne '') {
if (!$Apache::lonxml::default_homework_loaded) {
&Apache::lonxml::default_homework_load($safeeval);
}
@@ -1126,17 +1143,25 @@ sub start_languageblock {
$target eq 'tex' || $target eq 'analyze' || $target eq 'webgrade') {
my $include = $token->[2]->{'include'};
my $exclude = $token->[2]->{'exclude'};
- my %languages=&Apache::loncommon::display_languages();
+ my $preferred_language=(&Apache::loncommon::preferred_languages)[0];
+# This should not even happen, since we should at least have the server language
+ if (!$preferred_language) { $preferred_language='en'; }
+# If the languageblock has no arguments, show the contents
$result='1';
+# Do we have an include argument?
if ($include) {
+# If include is specified, by default, don't render the block
$result='';
- foreach (split(/\,/,$include)) {
- if ($languages{$_}) { $result='1'; }
+ foreach my $included_language (split(/\,/,$include)) {
+# ... but if my preferred language is included, render it
+ if ($included_language eq $preferred_language) { $result='1'; }
}
}
+# Do we have an exclude argument?
if ($exclude) {
- foreach (split(/\,/,$exclude)) {
- if ($languages{$_}) { $result='0'; }
+ $result='1';
+ foreach my $excluded_language (split(/\,/,$exclude)) {
+ if ($excluded_language eq $preferred_language) { $result='0'; }
}
}
if ( ! $result ) {
@@ -1375,8 +1400,7 @@ sub start_part {
# duedates.
}
my $result='';
- my $id= &Apache::lonxml::get_param('id',$parstack,$safeeval);
- if ($id =~ /^\s*$/) { $id = $Apache::lonxml::curdepth; }
+ my $id= &Apache::lonxml::get_id($parstack,$safeeval);
$Apache::inputtags::part=$id;
push(@Apache::inputtags::partlist,$id);
@Apache::inputtags::response=();
@@ -1429,7 +1453,7 @@ sub start_part {
if ($target eq 'tex') {
if (not $env{'form.problem_split'}=~/yes/) {
if ($$tagstack[-2] eq 'td') {
- $result.='\vskip 0 mm \noindent \begin{minipage}{\textwidth}\noindent';
+ $result.='\noindent \begin{minipage}{\textwidth}\noindent';
} else {
$result.='\noindent \end{minipage}\vskip 0 mm \noindent \begin{minipage}{\textwidth}\noindent';
}