[LON-CAPA-cvs] cvs: loncom /xml lonxml.pm scripttag.pm
raeburn
raeburn at source.lon-capa.org
Mon Apr 6 12:27:12 EDT 2015
raeburn Mon Apr 6 16:27:12 2015 EDT
Modified files:
/loncom/xml lonxml.pm scripttag.pm
Log:
- Re-enable rendering and editing of physnet resources.
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.552 loncom/xml/lonxml.pm:1.553
--- loncom/xml/lonxml.pm:1.552 Sun Feb 22 18:40:18 2015
+++ loncom/xml/lonxml.pm Mon Apr 6 16:27:12 2015
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# XML Parser Module
#
-# $Id: lonxml.pm,v 1.552 2015/02/22 18:40:18 raeburn Exp $
+# $Id: lonxml.pm,v 1.553 2015/04/06 16:27:12 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -368,6 +368,8 @@
my $result;
my $token;
my $dontpop=0;
+ my $lastdontpop;
+ my $lastendtag;
my $startredirection = $Apache::lonxml::redirection;
while ( $#$pars > -1 ) {
while ($token = $$pars['-1']->get_token) {
@@ -463,17 +465,29 @@
}
$result = '';
- if ($token->[0] eq 'E' && !$dontpop) {
- &end_tag($stack,$parstack,$token);
+ if ($token->[0] eq 'E') {
+ if ($dontpop) {
+ $lastdontpop = $token;
+ } else {
+ $lastendtag = $token->[1];
+ &end_tag($stack,$parstack,$token);
+ }
}
$dontpop=0;
- }
+ }
if ($#$pars > -1) {
pop @$pars;
pop @Apache::lonxml::pwd;
}
}
+ if (($#$stack == 0) && ($stack->[0] eq 'physnet') && ($target eq 'web') &&
+ ($lastendtag eq 'LONCAPA_INTERNAL_TURN_STYLE_ON')) {
+ if ((ref($lastdontpop) eq 'ARRAY') && ($lastdontpop->[1] eq 'physnet')) {
+ &end_tag($stack,$parstack,$lastdontpop);
+ }
+ }
+
# if ($target eq 'meta') {
# $finaloutput.=&endredirection;
# }
@@ -1460,13 +1474,15 @@
sub verify_html {
my ($filecontents)=@_;
- my ($is_html,$is_xml);
+ my ($is_html,$is_xml,$is_physnet);
if ($filecontents =~/(?:\<|\<\;)\?xml[^\<]*\?(?:\>|\>\;)/is) {
$is_xml = 1;
} elsif ($filecontents =~/(?:\<|\<\;)html(?:\s+[^\<]+|\s*)(?:\>|\>\;)/is) {
$is_html = 1;
+ } elsif ($filecontents =~/(?:\<|\<\;)physnet[^\<]*(?:\>|\>\;)/is) {
+ $is_physnet = 1;
}
- unless ($is_xml || $is_html) {
+ unless ($is_xml || $is_html || $is_physnet) {
return &mt('File does not have [_1] or [_2] starting tag','<html>','<?xml ?>');
}
if ($is_html) {
Index: loncom/xml/scripttag.pm
diff -u loncom/xml/scripttag.pm:1.173 loncom/xml/scripttag.pm:1.174
--- loncom/xml/scripttag.pm:1.173 Mon Jan 19 15:36:16 2015
+++ loncom/xml/scripttag.pm Mon Apr 6 16:27:12 2015
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# <script> definiton
#
-# $Id: scripttag.pm,v 1.173 2015/01/19 15:36:16 goltermann Exp $
+# $Id: scripttag.pm,v 1.174 2015/04/06 16:27:12 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -679,12 +679,14 @@
sub start_physnet {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
- my $bodytext = '/adm/includes/physnet.sty';
+ my $bodytext = '/res/adm/includes/physnet.sty';
my $location=&Apache::lonnet::filelocation($Apache::lonxml::pwd['-1'],$bodytext);
my $cbistyletext=&Apache::lonnet::getfile($location);
%$style = (%$style,&Apache::style::styleparser($target,$cbistyletext));
- $$parser['-1']->unget_token($token);
+ if (keys(%$style) && (($target eq 'web') || ($target eq 'tex'))) {
+ $$parser['-1']->unget_token($token);
+ }
# if ( defined($$style{'physnet'}) ) {
# &Apache::lonxml::newparser($parser,\$$style{'physnet'});
# }
More information about the LON-CAPA-cvs
mailing list