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