Annotation of loncom/xml/lonxml.pm, revision 1.114
1.2 sakharuk 1: # The LearningOnline Network with CAPA
1.3 sakharuk 2: # XML Parser Module
1.2 sakharuk 3: #
1.3 sakharuk 4: # last modified 06/26/00 by Alexander Sakharuk
1.33 www 5: # 11/6 Gerd Kortemeyer
1.45 www 6: # 6/1/1 Gerd Kortemeyer
1.56 albertel 7: # 2/21,3/13 Guy
1.68 www 8: # 3/29,5/4 Gerd Kortemeyer
1.73 harris41 9: # 5/10 Scott Harrison
1.78 www 10: # 5/26 Gerd Kortemeyer
1.80 harris41 11: # 5/27 H. K. Ng
1.89 www 12: # 6/2,6/3,6/8,6/9 Gerd Kortemeyer
1.93 ng 13: # 6/12,6/13 H. K. Ng
1.95 www 14: # 6/16 Gerd Kortemeyer
1.104 ng 15: # 7/27 H. K. Ng
1.112 www 16: # 8/7,8/9,8/10,8/11,8/15 Gerd Kortemeyer
1.2 sakharuk 17:
1.4 albertel 18: package Apache::lonxml;
1.33 www 19: use vars
1.76 albertel 20: qw(@pwd @outputstack $redirection $import @extlinks $metamode $evaluate %insertlist @namespace);
1.1 sakharuk 21: use strict;
22: use HTML::TokeParser;
1.106 www 23: use HTML::TreeBuilder;
1.3 sakharuk 24: use Safe;
1.40 albertel 25: use Safe::Hole;
1.81 ng 26: use Math::Cephes qw(:trigs :hypers :bessels erf erfc);
1.91 ng 27: use Math::Random qw(:all);
1.13 albertel 28: use Opcode;
1.72 albertel 29:
30: sub register {
31: my $space;
32: my @taglist;
33: my $temptag;
34: ($space,@taglist) = @_;
35: foreach $temptag (@taglist) {
36: $Apache::lonxml::alltags{$temptag}=$space;
37: }
38: }
39:
1.46 www 40: use Apache::Constants qw(:common);
1.71 www 41: use Apache::lontexconvert;
1.72 albertel 42: use Apache::style;
43: use Apache::run;
44: use Apache::londefdef;
45: use Apache::scripttag;
46: use Apache::edit;
1.79 www 47: use Apache::lonnet;
48: use Apache::File;
49:
1.72 albertel 50: #================================================== Main subroutine: xmlparse
51: #debugging control, to turn on debugging modify the correct handler
52: $Apache::lonxml::debug=0;
53:
54: #path to the directory containing the file currently being processed
55: @pwd=();
56:
57: #these two are used for capturing a subset of the output for later processing,
58: #don't touch them directly use &startredirection and &endredirection
59: @outputstack = ();
60: $redirection = 0;
61:
62: #controls wheter the <import> tag actually does
63: $import = 1;
64: @extlinks=();
65:
66: # meta mode is a bit weird only some output is to be turned off
67: #<output> tag turns metamode off (defined in londefdef.pm)
68: $metamode = 0;
69:
70: # turns on and of run::evaluate actually derefencing var refs
71: $evaluate = 1;
1.7 albertel 72:
1.74 albertel 73: # data structure for eidt mode, determines what tags can go into what other tags
74: %insertlist=();
1.68 www 75:
1.99 albertel 76: # stores the list of active tag namespaces
1.76 albertel 77: @namespace=();
78:
1.99 albertel 79: # has the dynamic menu been updated to know about this resource
80: $Apache::lonxml::registered=0;
81:
1.68 www 82: sub xmlbegin {
83: my $output='';
84: if ($ENV{'browser.mathml'}) {
85: $output='<?xml version="1.0"?>'
86: .'<?xml-stylesheet type="text/css" href="/adm/MathML/mathml.css"?>'
87: .'<!DOCTYPE html SYSTEM "/adm/MathML/mathml.dtd" '
88: .'[<!ENTITY mathns "http://www.w3.org/1998/Math/MathML">]>'
89: .'<html xmlns:math="http://www.w3.org/1998/Math/MathML" '
90: .'xmlns="http://www.w3.org/TR/REC-html40">';
91: } else {
92: $output='<html>';
93: }
94: return $output;
95: }
96:
97: sub xmlend {
1.103 www 98: my $discussion='';
99: if ($ENV{'request.course.id'}) {
1.109 www 100: my $crs='/'.$ENV{'request.course.id'};
101: if ($ENV{'request.course.sec'}) {
102: $crs.='_'.$ENV{'request.course.sec'};
103: }
104: $crs=~s/\_/\//g;
105: my $seeid=&Apache::lonnet::allowed('rin',$crs);
1.103 www 106: my $symb=&Apache::lonnet::symbread();
107: if ($symb) {
108: my %contrib=&Apache::lonnet::restore($symb,$ENV{'request.course.id'},
109: $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
110: $ENV{'course.'.$ENV{'request.course.id'}.'.num'});
111: if ($contrib{'version'}) {
112: $discussion.=
113: '<address><hr /><h2>Course Discussion of Resource</h2>';
114: my $idx;
115: for ($idx=1;$idx<=$contrib{'version'};$idx++) {
1.110 www 116: my $hidden=($contrib{'hidden'}=~/\.$idx\./);
117: unless (($hidden) && (!$seeid)) {
118: my $message=$contrib{$idx.':message'};
119: $message=~s/\n/\<br \/\>/g;
120: if ($message) {
121: if ($hidden) {
122: $message='<font color="#888888">'.$message.'</font>';
123: }
1.109 www 124: my $sender='Anonymous';
125: if ((!$contrib{$idx.':anonymous'}) || ($seeid)) {
126: $sender=$contrib{$idx.':sendername'}.' at '.
127: $contrib{$idx.':senderdomain'};
128: if ($contrib{$idx.':anonymous'}) {
129: $sender.=' (anonymous)';
1.110 www 130: }
131: if ($seeid) {
132: if ($hidden) {
133: $sender.=' <a href="/adm/feedback?unhide='.
134: $symb.':::'.$idx.'">Make Visible</a>';
135: } else {
136: $sender.=' <a href="/adm/feedback?hide='.
137: $symb.':::'.$idx.'">Hide</a>';
138: }
1.109 www 139: }
140: }
141: $discussion.='<p><b>'.$sender.'</b> ('.
1.103 www 142: localtime($contrib{$idx.':timestamp'}).
143: '):<blockquote>'.$message.
1.110 www 144: '</blockquote></p>';
145: }
146: }
1.103 www 147: }
148: $discussion.='</address>';
149: }
150: }
151: }
152: return $discussion.'</html>';
1.112 www 153: }
154:
155: sub checkout {
156: my ($target,$symb,$tuname,$tudom,$tcrsid)=@_;
157: unless ($symb) {
158: $symb=&Apache::lonnet::symbread();
159: }
160: unless ($tuname) {
161: $tuname=$ENV{'user.name'};
162: $tudom=$ENV{'user.domain'};
163: $tcrsid=$ENV{'request.course.id'};
164: }
1.114 ! www 165: my $now=time;
1.112 www 166: my $lonhost = $Apache::lonnet::perlvar{'lonHostID'};
167: my $infostr=&Apache::lonnet::escape(
168: $tuname.'&'.
169: $tudom.'&'.
170: $tcrsid.'&'.
171: $symb.'&'.
1.114 ! www 172: $now.'&'.$ENV{'REMOTE_ADDR'});
1.112 www 173: my $token=Apache::lonnet::reply('tmpput:'.$infostr,$lonhost);
174: if ($token=~/^error\:/) { return ''; }
1.113 www 175: $token=~s/^(\d+)\_.*\_(\d+)$/$1\*$2\*$lonhost/;
176: $token=~tr/a-z/A-Z/;
1.114 ! www 177:
! 178: my %infohash=('token' => $token,
! 179: 'checktime' => $now,
! 180: 'remote' => $ENV{'REMOTE_ADDR'});
! 181:
! 182: unless (
! 183: &Apache::lonnet::cstore(\%infohash,$symb,$tcrsid,$tudom,$tuname) eq 'ok') {
! 184: return '';
! 185: }
! 186:
1.112 www 187: if (&Apache::lonnet::log($tudom,$tuname,
188: &Apache::lonnet::homeserver($tuname,$tudom),
189: &Apache::lonnet::escape('Checkout '.$infostr.' - '.
190: $token)) ne 'ok') {
191: return '';
192: }
1.114 ! www 193:
! 194: my %reply=&Apache::lonnet::get('environment',
! 195: ['firstname','middlename','lastname','generation'],
! 196: $tudom,$tuname);
! 197: my $plainname=$reply{'firstname'}.' '.
! 198: $reply{'middlename'}.' '.
! 199: $reply{'lastname'}.' '.
! 200: $reply{'generation'};
! 201:
1.112 www 202: if ($target eq 'web') {
1.114 ! www 203: return 'Checked out for '.$plainname.
! 204: '<br />User: '.$tuname.' at '.$tudom.
! 205: '<br />CourseID: '.$tcrsid.')'.
! 206: '<br />DocID: '.$token.
! 207: '<br />Time: '.localtime($now).
! 208: '<img align="right" src="/cgi-bin/barcode.gif?encode='.$token.'" /><hr />';
1.112 www 209: } else {
210: return $token;
211: }
1.68 www 212: }
213:
1.70 www 214: sub fontsettings() {
215: my $headerstring='';
216: if (($ENV{'browser.os'} eq 'mac') && (!$ENV{'browser.mathml'})) {
217: $headerstring.=
218: '<meta Content-Type="text/html; charset=x-mac-roman">';
219: }
220: return $headerstring;
221: }
222:
1.68 www 223: sub registerurl {
1.100 www 224: my $forcereg=shift;
1.99 albertel 225: if ($Apache::lonxml::registered) { return ''; }
1.105 albertel 226: $Apache::lonxml::registered=1;
1.100 www 227: if (($ENV{'REQUEST_URI'}!~/^\/(res\/)*adm\//) || ($forcereg)) {
1.87 www 228: my $hwkadd='';
229: if ($ENV{'REQUEST_URI'}=~/\.(problem|exam|quiz|assess|survey|form)$/) {
230: if (&Apache::lonnet::allowed('vgr',$ENV{'request.course.id'})) {
231: $hwkadd.=(<<ENDSUBM);
232: menu.switchbutton
233: (7,1,'subm.gif','view sub','missions',
1.88 www 234: 'gocmd("/adm/grades","submission")');
1.87 www 235: ENDSUBM
236: }
237: if (&Apache::lonnet::allowed('mgr',$ENV{'request.course.id'})) {
238: $hwkadd.=(<<ENDGRDS);
239: menu.switchbutton
240: (7,2,'pgrd.gif','problem','grades',
1.88 www 241: 'gocmd("/adm/grades","viewgrades")');
1.87 www 242: ENDGRDS
243: }
244: if (&Apache::lonnet::allowed('opa',$ENV{'request.course.id'})) {
245: $hwkadd.=(<<ENDPARM);
246: menu.switchbutton
247: (7,3,'pparm.gif','problem','parms',
1.88 www 248: 'gocmd("/adm/parmset","set")');
1.87 www 249: ENDPARM
250: }
251: }
1.86 www 252: return (<<ENDREGTHIS);
1.87 www 253:
1.68 www 254: <script language="JavaScript">
1.71 www 255: // BEGIN LON-CAPA Internal
1.86 www 256:
1.69 www 257: function LONCAPAreg() {
258: menu=window.open("","LONCAPAmenu");
1.86 www 259: menu.clearTimeout(menu.menucltim);
1.69 www 260: menu.currentURL=window.location.pathname;
261: menu.currentStale=0;
1.85 www 262: menu.clearbut(3,1);
263: menu.switchbutton
1.108 www 264: (6,3,'catalog.gif','catalog','info','catalog_info()');
265: menu.switchbutton
1.85 www 266: (8,1,'eval.gif','evaluate','this','gopost("/adm/evaluate",currentURL)');
267: menu.switchbutton
268: (8,2,'fdbk.gif','feedback','on this','gopost("/adm/feedback",currentURL)');
269: menu.switchbutton
270: (8,3,'prt.gif','prepare','printout','gopost("/adm/printout",currentURL)');
271: menu.switchbutton
272: (2,1,'back.gif','backward','','gopost("/adm/flip","back:"+currentURL)');
273: menu.switchbutton
274: (2,3,'forw.gif','forward','','gopost("/adm/flip","forward:"+currentURL)');
1.94 www 275: menu.switchbutton
276: (9,1,'sbkm.gif','set','bookmark','set_bookmark()');
277: menu.switchbutton
278: (9,2,'vbkm.gif','view','bookmark','edit_bookmarks()');
279: menu.switchbutton
1.95 www 280: (9,3,'anot.gif','anno-','tations','annotate()');
1.87 www 281: $hwkadd
1.69 www 282: }
1.86 www 283:
1.69 www 284: function LONCAPAstale() {
1.86 www 285: menu=window.open("","LONCAPAmenu");
286: menu.currentStale=1;
287: menu.switchbutton
288: (3,1,'reload.gif','return','location','go(currentURL)');
1.90 www 289: menu.clearbut(7,1);
290: menu.clearbut(7,2);
291: menu.clearbut(7,3);
1.86 www 292: menu.menucltim=menu.setTimeout(
1.94 www 293: 'clearbut(2,1);clearbut(2,3);clearbut(8,1);clearbut(8,2);clearbut(8,3);'+
1.108 www 294: 'clearbut(9,1);clearbut(9,2);clearbut(9,3);clearbut(6,3)',
1.86 www 295: 2000);
296:
1.87 www 297: }
1.86 www 298:
299: // END LON-CAPA Internal
300: </script>
301: ENDREGTHIS
302:
303: } else {
304: return (<<ENDDONOTREGTHIS);
305:
306: <script language="JavaScript">
307: // BEGIN LON-CAPA Internal
308:
309: function LONCAPAreg() {
1.69 www 310: menu=window.open("","LONCAPAmenu");
311: menu.currentStale=1;
1.85 www 312: menu.clearbut(2,1);
313: menu.clearbut(2,3);
314: menu.clearbut(8,1);
315: menu.clearbut(8,2);
316: menu.clearbut(8,3);
1.86 www 317: if (menu.currentURL) {
318: menu.switchbutton
319: (3,1,'reload.gif','return','location','go(currentURL)');
320: } else {
321: menu.clearbut(3,1);
322: }
323: }
324:
325: function LONCAPAstale() {
1.68 www 326: }
1.86 www 327:
1.71 www 328: // END LON-CAPA Internal
1.68 www 329: </script>
1.86 www 330: ENDDONOTREGTHIS
331:
332: }
1.69 www 333: }
334:
335: sub loadevents() {
336: return 'LONCAPAreg();';
337: }
338:
339: sub unloadevents() {
340: return 'LONCAPAstale();';
1.68 www 341: }
342:
1.48 albertel 343: sub printalltags {
344: my $temp;
345: foreach $temp (sort keys %Apache::lonxml::alltags) {
1.64 albertel 346: &Apache::lonxml::debug("$temp -- $Apache::lonxml::alltags{$temp}");
1.48 albertel 347: }
348: }
1.31 sakharuk 349:
1.3 sakharuk 350: sub xmlparse {
1.18 albertel 351: my ($target,$content_file_string,$safeinit,%style_for_target) = @_;
1.96 albertel 352:
353: &setup_globals($target);
1.48 albertel 354: #&printalltags();
1.16 albertel 355: my @pars = ();
1.23 albertel 356: my $pwd=$ENV{'request.filename'};
357: $pwd =~ s:/[^/]*$::;
358: &newparser(\@pars,\$content_file_string,$pwd);
1.24 sakharuk 359:
1.3 sakharuk 360: my $safeeval = new Safe;
1.40 albertel 361: my $safehole = new Safe::Hole;
1.82 ng 362: &init_safespace($target,$safeeval,$safehole,$safeinit);
1.3 sakharuk 363: #-------------------- Redefinition of the target in the case of compound target
364:
365: ($target, my @tenta) = split('&&',$target);
366:
367: my @stack = ();
368: my @parstack = ();
1.17 albertel 369: &initdepth;
1.67 www 370:
1.101 albertel 371: my $finaloutput = &inner_xmlparse($target,\@stack,\@parstack,\@pars,
372: $safeeval,\%style_for_target);
1.67 www 373:
1.3 sakharuk 374: return $finaloutput;
1.106 www 375: }
376:
377: sub htmlclean {
1.107 www 378: my ($raw,$full)=@_;
1.106 www 379:
380: my $tree = HTML::TreeBuilder->new;
381: $tree->ignore_unknown(0);
382:
383: $tree->parse($raw);
384:
1.107 www 385: my $output= $tree->as_HTML(undef,' ');
1.106 www 386:
1.111 www 387: $output=~s/\<(br|hr|img|meta|allow)([^\>\/]*)\>/\<$1$2 \/\>/gis;
388: $output=~s/\<\/(br|hr|img|meta|allow)\>//gis;
1.107 www 389: unless ($full) {
390: $output=~s/\<[\/]*(body|head|html)\>//gis;
391: }
1.106 www 392:
393: $tree = $tree->delete;
394:
395: return $output;
1.15 albertel 396: }
397:
1.101 albertel 398: sub inner_xmlparse {
399: my ($target,$stack,$parstack,$pars,$safeeval,$style_for_target)=@_;
400: &Apache::lonxml::debug('Reentrant parser starting, again?');
401: my $finaloutput = '';
402: my $result;
403: my $token;
404: while ( $#$pars > -1 ) {
405: while ($token = $$pars['-1']->get_token) {
406: if (($token->[0] eq 'T') || ($token->[0] eq 'C') || ($token->[0] eq 'D') ) {
407: if ($metamode<1) {
408: $result=$token->[1];
409: }
410: } elsif ($token->[0] eq 'PI') {
411: if ($metamode<1) {
412: $result=$token->[2];
413: }
414: } elsif ($token->[0] eq 'S') {
415: # add tag to stack
416: push (@$stack,$token->[1]);
417: # add parameters list to another stack
418: push (@$parstack,&parstring($token));
419: &increasedepth($token);
420: if (exists $$style_for_target{$token->[1]}) {
421: if ($Apache::lonxml::redirection) {
422: $Apache::lonxml::outputstack['-1'] .=
423: &recurse($$style_for_target{$token->[1]},$target,$safeeval,
424: $style_for_target,@$parstack);
425: } else {
426: $finaloutput .= &recurse($$style_for_target{$token->[1]},$target,
427: $safeeval,$style_for_target,@$parstack);
428: }
429: } else {
430: $result = &callsub("start_$token->[1]", $target, $token, $stack,
431: $parstack, $pars, $safeeval, $style_for_target);
432: }
433: } elsif ($token->[0] eq 'E') {
434: #clear out any tags that didn't end
435: while ($token->[1] ne $$stack['-1'] && ($#$stack > -1)) {
436: &Apache::lonxml::warning("Unbalanced tags in resource $$stack['-1']");
437: &end_tag($stack,$parstack,$token);
438: }
439:
440: if (exists $$style_for_target{'/'."$token->[1]"}) {
441: if ($Apache::lonxml::redirection) {
442: $Apache::lonxml::outputstack['-1'] .=
443: &recurse($$style_for_target{'/'."$token->[1]"},
444: $target,$safeeval,$style_for_target,@$parstack);
445: } else {
446: $finaloutput .= &recurse($$style_for_target{'/'."$token->[1]"},
447: $target,$safeeval,$style_for_target,
448: @$parstack);
449: }
450:
451: } else {
452: $result = &callsub("end_$token->[1]", $target, $token, $stack,
453: $parstack, $pars,$safeeval, $style_for_target);
454: }
455: } else {
456: &Apache::lonxml::error("Unknown token event :$token->[0]:$token->[1]:");
457: }
458: #evaluate variable refs in result
459: if ($result ne "") {
460: if ( $#$parstack > -1 ) {
461: if ($Apache::lonxml::redirection) {
462: $Apache::lonxml::outputstack['-1'] .=
463: &Apache::run::evaluate($result,$safeeval,$$parstack['-1']);
464: } else {
465: $finaloutput .= &Apache::run::evaluate($result,$safeeval,
466: $$parstack['-1']);
467: }
468: } else {
469: $finaloutput .= &Apache::run::evaluate($result,$safeeval,'');
470: }
471: $result = '';
472: }
473: if ($token->[0] eq 'E') {
474: &end_tag($stack,$parstack,$token);
475: }
476: }
477: pop @$pars;
478: pop @Apache::lonxml::pwd;
479: }
480:
481: # if ($target eq 'meta') {
482: # $finaloutput.=&endredirection;
483: # }
484:
485: if (($ENV{'QUERY_STRING'}) && ($target eq 'web')) {
486: $finaloutput=&afterburn($finaloutput);
487: }
488: return $finaloutput;
489: }
1.67 www 490:
1.15 albertel 491: sub recurse {
492: my @innerstack = ();
493: my @innerparstack = ();
494: my ($newarg,$target,$safeeval,$style_for_target,@parstack) = @_;
1.16 albertel 495: my @pat = ();
1.23 albertel 496: &newparser(\@pat,\$newarg);
1.15 albertel 497: my $tokenpat;
498: my $partstring = '';
499: my $output='';
1.16 albertel 500: my $decls='';
501: while ( $#pat > -1 ) {
502: while ($tokenpat = $pat[$#pat]->get_token) {
1.57 albertel 503: if (($tokenpat->[0] eq 'T') || ($tokenpat->[0] eq 'C') || ($tokenpat->[0] eq 'D') ) {
1.61 albertel 504: if ($metamode<1) { $partstring=$tokenpat->[1]; }
1.57 albertel 505: } elsif ($tokenpat->[0] eq 'PI') {
1.61 albertel 506: if ($metamode<1) { $partstring=$tokenpat->[2]; }
1.16 albertel 507: } elsif ($tokenpat->[0] eq 'S') {
508: push (@innerstack,$tokenpat->[1]);
509: push (@innerparstack,&parstring($tokenpat));
1.19 albertel 510: &increasedepth($tokenpat);
1.84 albertel 511: $partstring = &callsub("start_$tokenpat->[1]", $target, $tokenpat,
512: \@innerstack, \@innerparstack, \@pat,
513: $safeeval, $style_for_target);
1.16 albertel 514: } elsif ($tokenpat->[0] eq 'E') {
515: #clear out any tags that didn't end
516: while ($tokenpat->[1] ne $innerstack[$#innerstack]
1.43 albertel 517: && ($#innerstack > -1)) {
1.49 albertel 518: &Apache::lonxml::warning("Unbalanced tags in resource $innerstack['-1']");
1.97 albertel 519: &end_tag(\@innerstack,\@innerparstack,$tokenpat);
1.43 albertel 520: }
1.84 albertel 521: $partstring = &callsub("end_$tokenpat->[1]", $target, $tokenpat,
522: \@innerstack, \@innerparstack, \@pat,
523: $safeeval, $style_for_target);
1.57 albertel 524: } else {
525: &Apache::lonxml::error("Unknown token event :$tokenpat->[0]:$tokenpat->[1]:");
1.16 albertel 526: }
527: #pass both the variable to the style tag, and the tag we
528: #are processing inside the <definedtag>
529: if ( $partstring ne "" ) {
530: if ( $#parstack > -1 ) {
531: if ( $#innerparstack > -1 ) {
532: $decls= $parstack[$#parstack].$innerparstack[$#innerparstack];
533: } else {
534: $decls= $parstack[$#parstack];
535: }
536: } else {
537: if ( $#innerparstack > -1 ) {
538: $decls=$innerparstack[$#innerparstack];
539: } else {
540: $decls='';
541: }
542: }
543: $output .= &Apache::run::evaluate($partstring,$safeeval,$decls);
544: $partstring = '';
545: }
1.17 albertel 546: if ($tokenpat->[0] eq 'E') { pop @innerstack;pop @innerparstack;
1.19 albertel 547: &decreasedepth($tokenpat);}
1.15 albertel 548: }
1.16 albertel 549: pop @pat;
1.23 albertel 550: pop @Apache::lonxml::pwd;
1.15 albertel 551: }
552: return $output;
1.7 albertel 553: }
554:
555: sub callsub {
1.84 albertel 556: my ($sub,$target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
1.7 albertel 557: my $currentstring='';
1.72 albertel 558: my $nodefault;
1.7 albertel 559: {
1.59 albertel 560: my $sub1;
1.7 albertel 561: no strict 'refs';
1.68 www 562: my $tag=$token->[1];
563: my $space=$Apache::lonxml::alltags{$tag};
564: if (!$space) {
565: $tag=~tr/A-Z/a-z/;
566: $sub=~tr/A-Z/a-z/;
567: $space=$Apache::lonxml::alltags{$tag}
568: }
1.97 albertel 569:
570: my $deleted=0;
571: $Apache::lonxml::curdepth=join('_',@Apache::lonxml::depthcounter);
572: if (($token->[0] eq 'S') && ($target eq 'modified')) {
573: $deleted=&Apache::edit::handle_delete($space,$target,$token,$tagstack,
574: $parstack,$parser,$safeeval,
575: $style);
576: }
577: if (!$deleted) {
578: if ($space) {
579: #&Apache::lonxml::debug("Calling sub $sub in $space $metamode<br />\n");
580: $sub1="$space\:\:$sub";
581: ($currentstring,$nodefault) = &$sub1($target,$token,$tagstack,
582: $parstack,$parser,$safeeval,
583: $style);
584: } else {
585: #&Apache::lonxml::debug("NOT Calling sub $sub in $space $metamode<br />\n");
586: if ($metamode <1) {
587: if (defined($token->[4]) && ($metamode < 1)) {
588: $currentstring = $token->[4];
589: } else {
590: $currentstring = $token->[2];
591: }
1.62 sakharuk 592: }
1.7 albertel 593: }
1.97 albertel 594: # &Apache::lonxml::debug("nodefalt:$nodefault:");
595: if ($currentstring eq '' && $nodefault eq '') {
596: if ($target eq 'edit') {
597: &Apache::lonxml::debug("doing default edit for $token->[1]");
598: if ($token->[0] eq 'S') {
599: $currentstring = &Apache::edit::tag_start($target,$token);
600: } elsif ($token->[0] eq 'E') {
601: $currentstring = &Apache::edit::tag_end($target,$token);
602: }
603: } elsif ($target eq 'modified') {
604: if ($token->[0] eq 'S') {
605: $currentstring = $token->[4];
606: $currentstring.=&Apache::edit::handle_insert();
607: } else {
608: $currentstring = $token->[2];
609: }
1.72 albertel 610: }
611: }
1.7 albertel 612: }
613: use strict 'refs';
614: }
615: return $currentstring;
1.82 ng 616: }
617:
1.96 albertel 618: sub setup_globals {
619: my ($target)=@_;
1.99 albertel 620: $Apache::lonxml::registered = 0;
1.101 albertel 621: @Apache::lonxml::pwd=();
1.96 albertel 622: if ($target eq 'meta') {
623: $Apache::lonxml::redirection = 0;
624: $Apache::lonxml::metamode = 1;
625: $Apache::lonxml::evaluate = 1;
626: $Apache::lonxml::import = 0;
627: } elsif ($target eq 'grade') {
628: &startredirection;
629: $Apache::lonxml::metamode = 0;
630: $Apache::lonxml::evaluate = 1;
631: $Apache::lonxml::import = 1;
632: } elsif ($target eq 'modified') {
633: $Apache::lonxml::redirection = 0;
634: $Apache::lonxml::metamode = 0;
635: $Apache::lonxml::evaluate = 0;
636: $Apache::lonxml::import = 0;
637: } elsif ($target eq 'edit') {
638: $Apache::lonxml::redirection = 0;
639: $Apache::lonxml::metamode = 0;
640: $Apache::lonxml::evaluate = 0;
641: $Apache::lonxml::import = 0;
642: } else {
643: $Apache::lonxml::redirection = 0;
644: $Apache::lonxml::metamode = 0;
645: $Apache::lonxml::evaluate = 1;
646: $Apache::lonxml::import = 1;
647: }
648: }
649:
1.82 ng 650: sub init_safespace {
651: my ($target,$safeeval,$safehole,$safeinit) = @_;
652: $safeeval->permit("entereval");
653: $safeeval->permit(":base_math");
654: $safeeval->permit("sort");
655: $safeeval->deny(":base_io");
1.102 albertel 656: $safehole->wrap(\&Apache::scripttag::xmlparse,$safeeval,'&xmlparse');
1.82 ng 657: $safehole->wrap(\&Apache::lonnet::EXT,$safeeval,'&EXT');
658:
659: $safehole->wrap(\&Math::Cephes::asin,$safeeval,'&asin');
660: $safehole->wrap(\&Math::Cephes::acos,$safeeval,'&acos');
661: $safehole->wrap(\&Math::Cephes::atan,$safeeval,'&atan');
662: $safehole->wrap(\&Math::Cephes::sinh,$safeeval,'&sinh');
663: $safehole->wrap(\&Math::Cephes::cosh,$safeeval,'&cosh');
664: $safehole->wrap(\&Math::Cephes::tanh,$safeeval,'&tanh');
665: $safehole->wrap(\&Math::Cephes::asinh,$safeeval,'&asinh');
666: $safehole->wrap(\&Math::Cephes::acosh,$safeeval,'&acosh');
667: $safehole->wrap(\&Math::Cephes::atanh,$safeeval,'&atanh');
668: $safehole->wrap(\&Math::Cephes::erf,$safeeval,'&erf');
669: $safehole->wrap(\&Math::Cephes::erfc,$safeeval,'&erfc');
670: $safehole->wrap(\&Math::Cephes::j0,$safeeval,'&j0');
671: $safehole->wrap(\&Math::Cephes::j1,$safeeval,'&j1');
672: $safehole->wrap(\&Math::Cephes::jn,$safeeval,'&jn');
673: $safehole->wrap(\&Math::Cephes::jv,$safeeval,'&jv');
674: $safehole->wrap(\&Math::Cephes::y0,$safeeval,'&y0');
675: $safehole->wrap(\&Math::Cephes::y1,$safeeval,'&y1');
676: $safehole->wrap(\&Math::Cephes::yn,$safeeval,'&yn');
677: $safehole->wrap(\&Math::Cephes::yv,$safeeval,'&yv');
1.91 ng 678: $safehole->wrap(\&Math::Random::random_beta,$safeeval,'&math_random_beta');
679: $safehole->wrap(\&Math::Random::random_chi_square,$safeeval,'&math_random_chi_square');
680: $safehole->wrap(\&Math::Random::random_exponential,$safeeval,'&math_random_exponential');
681: $safehole->wrap(\&Math::Random::random_f,$safeeval,'&math_random_f');
682: $safehole->wrap(\&Math::Random::random_gamma,$safeeval,'&math_random_gamma');
683: $safehole->wrap(\&Math::Random::random_multivariate_normal,$safeeval,'&math_random_multivariate_normal');
684: $safehole->wrap(\&Math::Random::random_multinomial,$safeeval,'&math_random_multinomial');
685: $safehole->wrap(\&Math::Random::random_noncentral_chi_square,$safeeval,'&math_random_noncentral_chi_square');
686: $safehole->wrap(\&Math::Random::random_noncentral_f,$safeeval,'&math_random_noncentral_f');
687: $safehole->wrap(\&Math::Random::random_normal,$safeeval,'&math_random_normal');
688: $safehole->wrap(\&Math::Random::random_permutation,$safeeval,'&math_random_permutation');
1.93 ng 689: $safehole->wrap(\&Math::Random::random_permuted_index,$safeeval,'&math_random_permuted_index');
1.91 ng 690: $safehole->wrap(\&Math::Random::random_uniform,$safeeval,'&math_random_uniform');
691: $safehole->wrap(\&Math::Random::random_poisson,$safeeval,'&math_random_poisson');
692: $safehole->wrap(\&Math::Random::random_uniform_integer,$safeeval,'&math_random_uniform_integer');
693: $safehole->wrap(\&Math::Random::random_negative_binomial,$safeeval,'&math_random_negative_binomial');
694: $safehole->wrap(\&Math::Random::random_binomial,$safeeval,'&math_random_binomial');
695: $safehole->wrap(\&Math::Random::random_seed_from_phrase,$safeeval,'&random_seed_from_phrase');
696: $safehole->wrap(\&Math::Random::random_set_seed_from_phrase,$safeeval,'&random_set_seed_from_phrase');
697: $safehole->wrap(\&Math::Random::random_get_seed,$safeeval,'&random_get_seed');
698: $safehole->wrap(\&Math::Random::random_set_seed,$safeeval,'&random_set_seed');
699:
1.82 ng 700: #need to inspect this class of ops
701: # $safeeval->deny(":base_orig");
1.91 ng 702: $safeinit .= ';$external::target="'.$target.'";';
1.82 ng 703: $safeinit .= ';$external::randomseed='.&Apache::lonnet::rndseed().';';
704: &Apache::run::run($safeinit,$safeeval);
1.17 albertel 705: }
706:
1.55 albertel 707: sub startredirection {
708: $Apache::lonxml::redirection++;
709: push (@Apache::lonxml::outputstack, '');
710: }
711:
712: sub endredirection {
713: if (!$Apache::lonxml::redirection) {
1.72 albertel 714: &Apache::lonxml::error("Endredirection was called, before a startredirection, perhaps you have unbalanced tags. Some debuging information:".join ":",caller);
1.55 albertel 715: return '';
716: }
717: $Apache::lonxml::redirection--;
718: pop @Apache::lonxml::outputstack;
1.97 albertel 719: }
720:
721: sub end_tag {
722: my ($tagstack,$parstack,$token)=@_;
723: pop(@$tagstack);
724: pop(@$parstack);
725: &decreasedepth($token);
1.55 albertel 726: }
727:
1.17 albertel 728: sub initdepth {
729: @Apache::lonxml::depthcounter=();
730: $Apache::lonxml::depth=-1;
731: $Apache::lonxml::olddepth=-1;
732: }
733:
734: sub increasedepth {
1.19 albertel 735: my ($token) = @_;
1.17 albertel 736: $Apache::lonxml::depth++;
737: $Apache::lonxml::depthcounter[$Apache::lonxml::depth]++;
738: if ($Apache::lonxml::depthcounter[$Apache::lonxml::depth]==1) {
739: $Apache::lonxml::olddepth=$Apache::lonxml::depth;
740: }
1.42 albertel 741: my $curdepth=join('_',@Apache::lonxml::depthcounter);
1.64 albertel 742: &Apache::lonxml::debug("s $Apache::lonxml::depth : $Apache::lonxml::olddepth : $curdepth : $token->[1]\n");
1.54 albertel 743: #print "<br />s $Apache::lonxml::depth : $Apache::lonxml::olddepth : $curdepth : $token->[1]\n";
1.17 albertel 744: }
745:
746: sub decreasedepth {
1.19 albertel 747: my ($token) = @_;
1.17 albertel 748: $Apache::lonxml::depth--;
1.36 albertel 749: if ($Apache::lonxml::depth<$Apache::lonxml::olddepth-1) {
750: $#Apache::lonxml::depthcounter--;
751: $Apache::lonxml::olddepth=$Apache::lonxml::depth+1;
752: }
1.43 albertel 753: if ( $Apache::lonxml::depth < -1) {
1.49 albertel 754: &Apache::lonxml::warning("Unbalanced tags in resource");
1.43 albertel 755: $Apache::lonxml::depth='-1';
756: }
1.42 albertel 757: my $curdepth=join('_',@Apache::lonxml::depthcounter);
1.64 albertel 758: &Apache::lonxml::debug("e $Apache::lonxml::depth : $Apache::lonxml::olddepth : $token->[1] : $curdepth\n");
1.54 albertel 759: #print "<br />e $Apache::lonxml::depth : $Apache::lonxml::olddepth : $token->[1] : $curdepth\n";
1.1 sakharuk 760: }
1.19 albertel 761:
762: sub get_all_text {
763:
764: my($tag,$pars)= @_;
765: my $depth=0;
766: my $token;
767: my $result='';
1.57 albertel 768: if ( $tag =~ m:^/: ) {
769: my $tag=substr($tag,1);
770: # &Apache::lonxml::debug("have:$tag:");
771: while (($depth >=0) && ($token = $pars->get_token)) {
772: # &Apache::lonxml::debug("e token:$token->[0]:$depth:$token->[1]");
773: if (($token->[0] eq 'T')||($token->[0] eq 'C')||($token->[0] eq 'D')) {
774: $result.=$token->[1];
775: } elsif ($token->[0] eq 'PI') {
776: $result.=$token->[2];
777: } elsif ($token->[0] eq 'S') {
778: if ($token->[1] eq $tag) { $depth++; }
779: $result.=$token->[4];
780: } elsif ($token->[0] eq 'E') {
781: if ( $token->[1] eq $tag) { $depth--; }
782: #skip sending back the last end tag
783: if ($depth > -1) { $result.=$token->[2]; } else {
784: $pars->unget_token($token);
785: }
786: }
787: }
788: } else {
789: while ($token = $pars->get_token) {
790: # &Apache::lonxml::debug("s token:$token->[0]:$depth:$token->[1]");
791: if (($token->[0] eq 'T')||($token->[0] eq 'C')||($token->[0] eq 'D')) {
792: $result.=$token->[1];
793: } elsif ($token->[0] eq 'PI') {
794: $result.=$token->[2];
795: } elsif ($token->[0] eq 'S') {
796: if ( $token->[1] eq $tag) {
797: $pars->unget_token($token); last;
798: } else {
799: $result.=$token->[4];
800: }
801: } elsif ($token->[0] eq 'E') {
802: $result.=$token->[2];
1.36 albertel 803: }
1.19 albertel 804: }
805: }
1.49 albertel 806: # &Apache::lonxml::debug("Exit:$result:");
1.19 albertel 807: return $result
808: }
809:
1.23 albertel 810: sub newparser {
811: my ($parser,$contentref,$dir) = @_;
812: push (@$parser,HTML::TokeParser->new($contentref));
1.56 albertel 813: $$parser['-1']->xml_mode('1');
1.23 albertel 814: if ( $dir eq '' ) {
815: push (@Apache::lonxml::pwd, $Apache::lonxml::pwd[$#Apache::lonxml::pwd]);
816: } else {
817: push (@Apache::lonxml::pwd, $dir);
818: }
819: # &Apache::lonxml::debug("pwd:$#Apache::lonxml::pwd");
820: # &Apache::lonxml::debug("pwd:$Apache::lonxml::pwd[$#Apache::lonxml::pwd]");
821: }
1.1 sakharuk 822:
1.8 albertel 823: sub parstring {
824: my ($token) = @_;
825: my $temp='';
1.20 albertel 826: map {
1.35 www 827: unless ($_=~/\W/) {
1.42 albertel 828: my $val=$token->[2]->{$_};
1.53 albertel 829: $val =~ s/([\%\@\\])/\\$1/g;
1.51 albertel 830: #if ($val =~ m/^[\%\@]/) { $val="\\".$val; }
1.42 albertel 831: $temp .= "my \$$_=\"$val\";"
1.20 albertel 832: }
833: } @{$token->[3]};
1.8 albertel 834: return $temp;
835: }
1.22 albertel 836:
1.34 www 837: sub writeallows {
838: my $thisurl='/res/'.&Apache::lonnet::declutter(shift);
1.111 www 839: if ($ENV{'httpref.'.$thisurl}) {
840: $thisurl=$ENV{'httpref.'.$thisurl};
841: }
1.34 www 842: my $thisdir=$thisurl;
843: $thisdir=~s/\/[^\/]+$//;
844: my %httpref=();
845: map {
846: $httpref{'httpref.'.
847: &Apache::lonnet::hreflocation($thisdir,$_)}=$thisurl; } @extlinks;
848: &Apache::lonnet::appenv(%httpref);
849: }
850:
1.66 www 851: #
852: # Afterburner handles anchors, highlights and links
853: #
854: sub afterburn {
855: my $result=shift;
856: map {
857: my ($name, $value) = split(/=/,$_);
858: $value =~ tr/+/ /;
859: $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
860: if (($name eq 'highlight')||($name eq 'anchor')||($name eq 'link')) {
861: unless ($ENV{'form.'.$name}) {
862: $ENV{'form.'.$name}=$value;
863: }
864: }
865: } (split(/&/,$ENV{'QUERY_STRING'}));
866: if ($ENV{'form.highlight'}) {
867: map {
868: my $anchorname=$_;
869: my $matchthis=$anchorname;
870: $matchthis=~s/\_+/\\s\+/g;
871: $result=~s/($matchthis)/\<font color=\"red\"\>$1\<\/font\>/gs;
872: } split(/\,/,$ENV{'form.highlight'});
873: }
874: if ($ENV{'form.link'}) {
875: map {
876: my ($anchorname,$linkurl)=split(/\>/,$_);
877: my $matchthis=$anchorname;
878: $matchthis=~s/\_+/\\s\+/g;
879: $result=~s/($matchthis)/\<a href=\"$linkurl\"\>$1\<\/a\>/gs;
880: } split(/\,/,$ENV{'form.link'});
881: }
882: if ($ENV{'form.anchor'}) {
883: my $anchorname=$ENV{'form.anchor'};
884: my $matchthis=$anchorname;
885: $matchthis=~s/\_+/\\s\+/g;
886: $result=~s/($matchthis)/\<a name=\"$anchorname\"\>$1\<\/a\>/s;
887: $result.=(<<"ENDSCRIPT");
888: <script>
889: document.location.hash='$anchorname';
890: </script>
891: ENDSCRIPT
892: }
893: return $result;
894: }
895:
1.79 www 896: sub storefile {
897: my ($file,$contents)=@_;
898: if (my $fh=Apache::File->new('>'.$file)) {
899: print $fh $contents;
900: $fh->close();
901: }
902: }
903:
1.78 www 904: sub inserteditinfo {
905: my ($result,$filecontents)=@_;
906: unless ($filecontents) {
907: $filecontents=(<<SIMPLECONTENT);
908: <html>
909: <head>
910: <title>
911: Title of Document Goes Here
912: </title>
913: </head>
914: <body bgcolor="#FFFFFF">
915:
916: Body of Document Goes Here
917:
918: </body>
919: </html>
920: SIMPLECONTENT
921: }
922: my $editheader='<a href="#editsection">Edit below</a><hr />';
923: my $editfooter=(<<ENDFOOTER);
924: <hr />
925: <a name="editsection" />
926: <form method="post">
927: <textarea cols="80" rows="40" name="filecont">$filecontents</textarea>
928: <br />
1.107 www 929: <input type="submit" name="attemptclean"
930: value="Save and then attempt to clean HTML" />
931: <input type="submit" name="savethisfile" value="Save this" />
1.78 www 932: </form>
933: ENDFOOTER
934: $result=~s/(\<body[^\>]*\>)/$1$editheader/is;
935: $result=~s/(\<\/body\>)/$editfooter/is;
936: return $result;
937: }
938:
1.24 sakharuk 939: sub handler {
940: my $request=shift;
1.68 www 941:
1.64 albertel 942: my $target='web';
1.68 www 943:
1.65 albertel 944: $Apache::lonxml::debug=0;
1.68 www 945:
1.25 sakharuk 946: if ($ENV{'browser.mathml'}) {
1.27 albertel 947: $request->content_type('text/xml');
948: } else {
949: $request->content_type('text/html');
1.25 sakharuk 950: }
1.64 albertel 951:
1.27 albertel 952: $request->send_http_header;
1.64 albertel 953:
1.45 www 954: return OK if $request->header_only;
1.27 albertel 955:
1.79 www 956:
957: my $file=&Apache::lonnet::filelocation("",$request->uri);
1.78 www 958: #
959: # Edit action? Save file.
960: #
961: unless ($ENV{'request.state'} eq 'published') {
1.107 www 962: if (($ENV{'form.savethisfile'}) || ($ENV{'form.attemptclean'})) {
1.79 www 963: &storefile($file,$ENV{'form.filecont'});
1.78 www 964: }
965: }
1.24 sakharuk 966: my %mystyle;
1.50 albertel 967: my $result = '';
968: my $filecontents=&Apache::lonnet::getfile($file);
969: if ($filecontents == -1) {
1.78 www 970: $result=(<<ENDNOTFOUND);
971: <html>
972: <head>
973: <title>File not found</title>
974: </head>
975: <body bgcolor="#FFFFFF">
976: <b>File not found: $file</b>
977: </body>
978: </html>
979: ENDNOTFOUND
1.50 albertel 980: $filecontents='';
981: } else {
1.107 www 982: unless ($ENV{'request.state'} eq 'published') {
983: if ($ENV{'form.attemptclean'}) {
984: $filecontents=&htmlclean($filecontents,1);
985: }
986: }
1.50 albertel 987: $result = &Apache::lonxml::xmlparse($target,$filecontents,'',%mystyle);
1.78 www 988: }
989:
990: #
991: # Edit action? Insert editing commands
992: #
993: unless ($ENV{'request.state'} eq 'published') {
994: $result=&inserteditinfo($result,$filecontents);
1.66 www 995: }
1.50 albertel 996:
1.67 www 997: $request->print($result);
1.64 albertel 998:
1.34 www 999: writeallows($request->uri);
1.45 www 1000: return OK;
1.24 sakharuk 1001: }
1002:
1.22 albertel 1003: sub debug {
1004: if ($Apache::lonxml::debug eq 1) {
1.96 albertel 1005: print("DEBUG:".$_[0]."<br />\n");
1.22 albertel 1006: }
1007: }
1.49 albertel 1008:
1.22 albertel 1009: sub error {
1.74 albertel 1010: if (($Apache::lonxml::debug eq 1) || ($ENV{'request.state'} eq 'construct') ) {
1.55 albertel 1011: print "<b>ERROR:</b>".$_[0]."<br />\n";
1.52 albertel 1012: } else {
1013: print "<b>An Error occured while processing this resource. The instructor has been notified.</b> <br />";
1014: #notify author
1015: &Apache::lonmsg::author_res_msg($ENV{'request.filename'},$_[0]);
1016: #notify course
1017: if ( $ENV{'request.course.id'} ) {
1018: my $users=$ENV{'course.'.$ENV{'request.course.id'}.'.comment.email'};
1019: foreach my $user (split /\,/, $users) {
1020: ($user,my $domain) = split /:/, $user;
1.54 albertel 1021: &Apache::lonmsg::user_normal_msg($user,$domain,"Error in $ENV{'request.filename'}",$_[0]);
1.52 albertel 1022: }
1023: }
1.74 albertel 1024:
1.52 albertel 1025: #FIXME probably shouldn't have me get everything forever.
1.54 albertel 1026: &Apache::lonmsg::user_normal_msg('albertel','msu',"Error in $ENV{'request.filename'}",$_[0]);
1.74 albertel 1027: #&Apache::lonmsg::user_normal_msg('albertel','103',"Error in $ENV{'request.filename'}",$_[0]);
1.52 albertel 1028: }
1.22 albertel 1029: }
1.49 albertel 1030:
1.22 albertel 1031: sub warning {
1.73 harris41 1032: if ($ENV{'request.state'} eq 'construct') {
1.55 albertel 1033: print "<b>W</b>ARNING<b>:</b>".$_[0]."<br />\n";
1.73 harris41 1034: }
1.83 albertel 1035: }
1036:
1037: sub get_param {
1038: my ($param,$parstack,$safeeval,$context) = @_;
1039: if ( ! $context ) { $context = -1; }
1040: my $args ='';
1041: if ( $#$parstack > (-2-$context) ) { $args=$$parstack[$context]; }
1042: return &Apache::run::run("{$args;".'return $'.$param.'}',$safeeval); #'
1.22 albertel 1043: }
1044:
1.74 albertel 1045: sub register_insert {
1.75 albertel 1046: my @data = split /\n/, &Apache::lonnet::getfile('/home/httpd/lonTabs/insertlist.tab');
1.74 albertel 1047: my $i;
1.76 albertel 1048: my $tagnum=0;
1.74 albertel 1049: my @order;
1050: for ($i=0;$i < $#data; $i++) {
1051: my $line = $data[$i];
1052: if ( $line =~ /^\#/ || $line =~ /^\s*\n/) { next; }
1053: if ( $line =~ /TABLE/ ) { last; }
1.92 albertel 1054: my ($tag,$descrip,$color,$function,$show) = split(/,/, $line);
1.76 albertel 1055: $insertlist{"$tagnum.tag"} = $tag;
1056: $insertlist{"$tagnum.description"} = $descrip;
1.92 albertel 1057: $insertlist{"$tagnum.color"} = $color;
1.76 albertel 1058: $insertlist{"$tagnum.function"} = $function;
1059: $insertlist{"$tagnum.show"}= $show;
1.92 albertel 1060: $insertlist{"$tag.num"}=$tagnum;
1.76 albertel 1061: $tagnum++;
1.74 albertel 1062: }
1.76 albertel 1063: $i++; #skipping TABLE line
1064: $tagnum = 0;
1.74 albertel 1065: for (;$i < $#data;$i++) {
1066: my $line = $data[$i];
1.76 albertel 1067: my ($mnemonic,@which) = split(/ +/,$line);
1068: my $tag = $insertlist{"$tagnum.tag"};
1.74 albertel 1069: for (my $j=0;$j <$#which;$j++) {
1070: if ( $which[$j] eq 'Y' ) {
1.76 albertel 1071: if ($insertlist{"$j.show"} ne 'no') {
1072: push(@{ $insertlist{"$tag.which"} },$j);
1073: }
1.74 albertel 1074: }
1075: }
1.76 albertel 1076: $tagnum++;
1.74 albertel 1077: }
1078: }
1.98 albertel 1079:
1080: sub description {
1081: my ($token)=@_;
1082: return $insertlist{$insertlist{"$token->[1].num"}.'.description'};
1083: }
1.1 sakharuk 1084: 1;
1085: __END__
1.68 www 1086:
1087:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>