Annotation of loncom/xml/londefdef.pm, revision 1.38
1.1 sakharuk 1: # The LearningOnline Network with CAPA
2: # Tags Default Definition Module
3: #
1.38 ! harris41 4: # $Id: londefdef.pm,v 1.37 2001/12/28 20:41:01 albertel Exp $
1.34 www 5: #
6: # Copyright Michigan State University Board of Trustees
7: #
8: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
9: #
10: # LON-CAPA is free software; you can redistribute it and/or modify
11: # it under the terms of the GNU General Public License as published by
12: # the Free Software Foundation; either version 2 of the License, or
13: # (at your option) any later version.
14: #
15: # LON-CAPA is distributed in the hope that it will be useful,
16: # but WITHOUT ANY WARRANTY; without even the implied warranty of
17: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18: # GNU General Public License for more details.
19: #
20: # You should have received a copy of the GNU General Public License
21: # along with LON-CAPA; if not, write to the Free Software
22: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23: #
24: # /home/httpd/html/adm/gpl.txt
25: #
26: # http://www.lon-capa.org/
27: #
28: # Copyright for TtHfunc and TtMfunc by Ian Hutchinson.
29: # TtHfunc and TtMfunc (the "Code") may be compiled and linked into
30: # binary executable programs or libraries distributed by the
31: # Michigan State University (the "Licensee"), but any binaries so
32: # distributed are hereby licensed only for use in the context
33: # of a program or computational system for which the Licensee is the
34: # primary author or distributor, and which performs substantial
35: # additional tasks beyond the translation of (La)TeX into HTML.
36: # The C source of the Code may not be distributed by the Licensee
37: # to any other parties under any circumstances.
38: #
39: #
1.1 sakharuk 40: # last modified 06/26/00 by Alexander Sakharuk
1.28 www 41: # 11/6,11/30,02/01/01,5/4 Gerd Kortemeyer
1.1 sakharuk 42:
1.2 albertel 43: package Apache::londefdef;
1.1 sakharuk 44:
45: use strict;
1.3 sakharuk 46: use Apache::lonxml;
1.1 sakharuk 47:
1.38 ! harris41 48: BEGIN {
1.15 sakharuk 49:
1.31 albertel 50: &Apache::lonxml::register('Apache::londefdef',('m','html','head','map','select','option','input','textarea','form','meta','title','body','center','b','strong','table','dt','h1','h2','h3','h4','h5','h6','cite','i','address','dd','dl','dir','ol','ul','menu','dfn','kbd','tt','code','em','q','p','br','big','small','basefont','font','s','sub','strike','sup','hr','a','li','u','output','param','applet','img','embed','tr','td','allow','frameset'));
1.15 sakharuk 51:
1.3 sakharuk 52: }
1.1 sakharuk 53:
1.35 sakharuk 54: #======================= TAG SUBROUTINES =====================
1.8 sakharuk 55: #-- <output>
1.21 albertel 56: sub start_output {
57: my ($target) = @_;
1.22 albertel 58: if ($target eq 'meta') { $Apache::lonxml::metamode--; }
1.21 albertel 59: return '';
60: }
61: sub end_output {
62: my ($target) = @_;
1.22 albertel 63: if ($target eq 'meta') { $Apache::lonxml::metamode++; }
1.21 albertel 64: return '';
65: }
1.4 sakharuk 66: #-- <m> tag
1.33 albertel 67: sub start_m {
68: my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
69: my $currentstring = '';
70: if ($target eq 'web') {
71: my $inside = &Apache::lonxml::get_all_text("/m",$$parser[-1]);
72: $inside ='\\documentstyle{article}'.$inside;
1.37 albertel 73: &Apache::lonxml::debug("M is starting with:$inside:");
1.33 albertel 74: my $eval=&Apache::lonxml::get_param('eval',$parstack,$safeeval);
75: if ($eval eq 'on') {
76: $inside=&Apache::run::evaluate($inside,$safeeval,$$parstack[-1]);
77: #&Apache::lonxml::debug("M is evaulated to:$inside:");
78: }
79: $currentstring = &Apache::lontexconvert::converted(\$inside);
1.37 albertel 80: if ($Apache::lontexconvert::errorstring) {
81: &Apache::lonxml::warning("tth error: ".
82: $Apache::lontexconvert::errorstring);
83: $Apache::lontexconvert::errorstring='';
84: }
1.33 albertel 85: #&Apache::lonxml::debug("M is ends with:$currentstring:");
86: } elsif ($target eq 'tex') {
87: $currentstring = "";
88: }
89: return $currentstring;
90: }
91: sub end_m {
92: my ($target,$token) = @_;
93: my $currentstring = '';
94: if ($target eq 'web') {
95: } elsif ($target eq 'tex') {
96: $currentstring = "";
97: } elsif ($target eq 'meta') {
98: }
99: return $currentstring;
100: }
1.35 sakharuk 101: #-- <html> tag
1.1 sakharuk 102: sub start_html {
103: my ($target,$token) = @_;
104: my $currentstring = '';
105: if ($target eq 'web') {
1.29 www 106: $currentstring = &Apache::lonxml::xmlbegin().
107: &Apache::lonxml::fontsettings();
1.35 sakharuk 108: } elsif ($target eq 'tex') {
109: $currentstring .= '\documentclass[letterpaper]{article}
110: \setlength{\oddsidemargin}{-40pt}
111: \setlength{\evensidemargin}{-60pt}
112: \setlength{\topmargin}{200pt}
113: \setlength{\textwidth}{4.4in}
114: \setlength{\textheight}{6.8in}
115: \setlength{\parindent}{20pt}
116: \setlength{\marginparwidth}{90pt}
117: \setlength{\textfloatsep}{8pt plus 2.0pt minus 4.0pt}
118: \newcommand{\keephidden}[1]{}';
119: }
1.1 sakharuk 120: return $currentstring;
121: }
122: sub end_html {
123: my ($target,$token) = @_;
124: my $currentstring = '';
125: if ($target eq 'web') {
1.28 www 126: $currentstring = &Apache::lonxml::xmlend();
1.35 sakharuk 127: }
1.1 sakharuk 128: return $currentstring;
129: }
1.35 sakharuk 130: #-- <head> tag
1.1 sakharuk 131: sub start_head {
132: my ($target,$token) = @_;
133: my $currentstring = '';
134: if ($target eq 'web') {
135: $currentstring = $token->[4];
136: }
137: return $currentstring;
138: }
139: sub end_head {
140: my ($target,$token) = @_;
141: my $currentstring = '';
142: if ($target eq 'web') {
1.29 www 143: $currentstring = &Apache::lonxml::registerurl().
144: $token->[2];
1.1 sakharuk 145: }
146: return $currentstring;
147: }
1.35 sakharuk 148: #-- <map> tag
1.1 sakharuk 149: sub start_map {
150: my ($target,$token) = @_;
151: my $currentstring = '';
152: if ($target eq 'web') {
153: $currentstring = $token->[4];
154: }
155: return $currentstring;
156: }
157: sub end_map {
158: my ($target,$token) = @_;
159: my $currentstring = '';
160: if ($target eq 'web') {
161: $currentstring = $token->[2];
162: }
163: return $currentstring;
164: }
1.35 sakharuk 165: #-- <select> tag
1.1 sakharuk 166: sub start_select {
167: my ($target,$token) = @_;
168: my $currentstring = '';
169: if ($target eq 'web') {
170: $currentstring = $token->[4];
171: }
172: return $currentstring;
173: }
174: sub end_select {
175: my ($target,$token) = @_;
176: my $currentstring = '';
177: if ($target eq 'web') {
178: $currentstring = $token->[2];
179: }
180: return $currentstring;
181: }
1.35 sakharuk 182: #-- <option> tag
1.1 sakharuk 183: sub start_option {
184: my ($target,$token) = @_;
185: my $currentstring = '';
186: if ($target eq 'web') {
187: $currentstring = $token->[4];
188: }
189: return $currentstring;
190: }
191: sub end_option {
192: my ($target,$token) = @_;
193: my $currentstring = '';
194: if ($target eq 'web') {
195: $currentstring = $token->[2];
196: }
197: return $currentstring;
198: }
1.35 sakharuk 199: #-- <input> tag
1.1 sakharuk 200: sub start_input {
201: my ($target,$token) = @_;
202: my $currentstring = '';
203: if ($target eq 'web') {
204: $currentstring = $token->[4];
205: }
206: return $currentstring;
207: }
208: sub end_input {
209: my ($target,$token) = @_;
210: my $currentstring = '';
211: if ($target eq 'web') {
212: $currentstring = $token->[2];
213: }
214: return $currentstring;
215: }
1.35 sakharuk 216: #-- <textarea> tag
1.1 sakharuk 217: sub start_textarea {
218: my ($target,$token) = @_;
219: my $currentstring = '';
220: if ($target eq 'web') {
221: $currentstring = $token->[4];
222: }
223: return $currentstring;
224: }
225: sub end_textarea {
226: my ($target,$token) = @_;
227: my $currentstring = '';
228: if ($target eq 'web') {
229: $currentstring = $token->[2];
230: }
231: return $currentstring;
232: }
1.35 sakharuk 233: #-- <form> tag
1.1 sakharuk 234: sub start_form {
235: my ($target,$token) = @_;
236: my $currentstring = '';
237: if ($target eq 'web') {
238: $currentstring = $token->[4];
239: }
240: return $currentstring;
241: }
242: sub end_form {
243: my ($target,$token) = @_;
244: my $currentstring = '';
245: if ($target eq 'web') {
246: $currentstring = $token->[2];
247: }
248: return $currentstring;
249: }
1.35 sakharuk 250: #-- <title> tag
1.1 sakharuk 251: sub start_title {
252: my ($target,$token) = @_;
253: my $currentstring = '';
254: if ($target eq 'web') {
255: $currentstring = $token->[4];
1.35 sakharuk 256: } elsif ($target eq 'tex') {
257: $currentstring .= '\keephidden{'
1.1 sakharuk 258: }
1.13 www 259: if ($target eq 'meta') {
260: $currentstring='<title>';
261: &start_output();
262: }
1.1 sakharuk 263: return $currentstring;
264: }
265: sub end_title {
266: my ($target,$token) = @_;
267: my $currentstring = '';
268: if ($target eq 'web') {
269: $currentstring = $token->[2];
1.35 sakharuk 270: } elsif ($target eq 'tex') {
271: $currentstring .= '}';
272: }
1.13 www 273: if ($target eq 'meta') {
274: &end_output();
275: $currentstring='</title>';
1.1 sakharuk 276: }
277: return $currentstring;
278: }
1.35 sakharuk 279: #-- <meta> tag
1.1 sakharuk 280: sub start_meta {
1.30 albertel 281: my ($target,$token,$tagstack,$parstack,$parser) = @_;
1.1 sakharuk 282: my $currentstring = '';
283: if ($target eq 'web') {
1.25 albertel 284: my $args='';
285: if ( $#$parstack > -1 ) { $args=$$parstack[$#$parstack]; }
286: if ($args eq '') {
287: &Apache::lonxml::get_all_text("/meta",$$parser[$#$parser]);
288: } else {
289: $currentstring = $token->[4];
290: }
1.12 www 291: }
292: if ($target eq 'meta') {
293: unless ($token->[2]->{'http-equiv'}) {
294: my $name=$token->[2]->{'name'};
295: $name=~tr/A-Z/a-z/;
296: $name=~s/\s/\_/g;
297: if ($name) {
298: $currentstring='<'.$name.'>'.
299: $token->[2]->{'content'}.
300: '</'.$name.'>';
301: }
302: }
1.1 sakharuk 303: }
304: return $currentstring;
305: }
1.26 albertel 306: sub end_meta {
1.30 albertel 307: my ($target,$token,$tagstack,$parstack,$parser) = @_;
1.26 albertel 308: my $currentstring = '';
309: if ($target eq 'web') {
310: my $args='';
311: if ( $#$parstack > -1 ) { $args=$$parstack[$#$parstack]; }
312: if ($args ne '') {
313: $currentstring = $token->[4];
314: }
315: }
316: return $currentstring;
317: }
1.35 sakharuk 318: #-- <body> tag
1.1 sakharuk 319: sub start_body {
320: my ($target,$token) = @_;
321: my $currentstring = '';
322: if ($target eq 'web') {
1.31 albertel 323: if (!$Apache::lonxml::registered) {
324: $currentstring.='<head>'.&Apache::lonxml::registerurl().'</head>';
325: }
1.32 albertel 326: my $onLoad='';
327: foreach my $key (keys(%{$token->[2]})) {
328: if ($key =~ /^onload$/i) {
329: $onLoad.=$token->[2]->{$key}.';';
330: delete($token->[2]->{$key});
331: }
332: }
333: $token->[2]->{'onLoad'}=$onLoad.&Apache::lonxml::loadevents();
334: my $onUnload='';
335: foreach my $key (keys(%{$token->[2]})) {
336: if ($key =~ /^onunload$/i) {
337: $onUnload.=$token->[2]->{$key}.';';
338: delete($token->[2]->{$key});
339: }
340: }
341: $token->[2]->{'onUnload'}=$onUnload.
342: &Apache::lonxml::unloadevents();
1.31 albertel 343:
344: $currentstring .= '<'.$token->[1];
1.37 albertel 345: foreach (keys %{$token->[2]}) {
346: $currentstring.=' '.$_.'="'.$token->[2]->{$_}.'"';
347: }
1.31 albertel 348: $currentstring.='>';
1.28 www 349: } elsif ($target eq 'tex') {
1.35 sakharuk 350: $currentstring = '\begin{document}';
1.1 sakharuk 351: }
352: return $currentstring;
353: }
354: sub end_body {
355: my ($target,$token) = @_;
356: my $currentstring = '';
357: if ($target eq 'web') {
358: $currentstring = $token->[2];
359: } elsif ($target eq 'tex') {
1.35 sakharuk 360: $currentstring = '\end{document}';
1.1 sakharuk 361: }
362: return $currentstring;
363: }
1.35 sakharuk 364: #-- <center> tag
1.1 sakharuk 365: sub start_center {
366: my ($target,$token) = @_;
367: my $currentstring = '';
368: if ($target eq 'web') {
369: $currentstring = $token->[4];
370: } elsif ($target eq 'tex') {
1.35 sakharuk 371: $currentstring = '\begin{center}';
1.18 sakharuk 372: } elsif ($target eq 'latexsource') {
1.35 sakharuk 373: $currentstring = '\begin{center}';
1.1 sakharuk 374: }
375: return $currentstring;
376: }
377: sub end_center {
378: my ($target,$token) = @_;
379: my $currentstring = '';
380: if ($target eq 'web') {
381: $currentstring = $token->[2];
382: } elsif ($target eq 'tex') {
1.35 sakharuk 383: $currentstring = '\end{center}';
1.18 sakharuk 384: } elsif ($target eq 'latexsource') {
1.35 sakharuk 385: $currentstring = '\end{center}';
1.1 sakharuk 386: }
387: return $currentstring;
388: }
1.35 sakharuk 389: #-- <b> tag
1.1 sakharuk 390: sub start_b {
391: my ($target,$token) = @_;
392: my $currentstring = '';
393: if ($target eq 'web') {
394: $currentstring = $token->[4];
395: } elsif ($target eq 'tex') {
1.35 sakharuk 396: $currentstring = '\textbf{';
1.18 sakharuk 397: } elsif ($target eq 'latexsource') {
1.35 sakharuk 398: $currentstring = '\textbf{';
1.1 sakharuk 399: }
400: return $currentstring;
401: }
402: sub end_b {
403: my ($target,$token) = @_;
404: my $currentstring = '';
405: if ($target eq 'web') {
406: $currentstring = $token->[2];
407: } elsif ($target eq 'tex') {
1.35 sakharuk 408: $currentstring = '}';
409:
1.18 sakharuk 410: } elsif ($target eq 'latexsource') {
1.35 sakharuk 411: $currentstring = '}';
1.1 sakharuk 412: }
413: return $currentstring;
414: }
1.35 sakharuk 415: #-- <strong> tag
1.1 sakharuk 416: sub start_strong {
417: my ($target,$token) = @_;
418: my $currentstring = '';
419: if ($target eq 'web') {
420: $currentstring = $token->[4];
421: } elsif ($target eq 'tex') {
1.35 sakharuk 422: $currentstring = '\textbf{';
1.18 sakharuk 423: } elsif ($target eq 'latexsource') {
1.35 sakharuk 424: $currentstring = '\textbf{';
1.1 sakharuk 425: }
426: return $currentstring;
427: }
428: sub end_strong {
429: my ($target,$token) = @_;
430: my $currentstring = '';
431: if ($target eq 'web') {
432:
433: $currentstring = $token->[2];
434: } elsif ($target eq 'tex') {
1.35 sakharuk 435: $currentstring = '}';
1.18 sakharuk 436: } elsif ($target eq 'latexsource') {
1.35 sakharuk 437: $currentstring = '}';
1.1 sakharuk 438: }
439: return $currentstring;
440: }
1.35 sakharuk 441: #-- <h1> tag
1.1 sakharuk 442: sub start_h1 {
443: my ($target,$token) = @_;
444: my $currentstring = '';
445: if ($target eq 'web') {
446: $currentstring .= $token->[4];
447: } elsif ($target eq 'tex') {
1.35 sakharuk 448: $currentstring .= '\large{\textbf{';
1.13 www 449: } elsif ($target eq 'meta') {
450: $currentstring='<subject>';
451: &start_output();
452: }
1.1 sakharuk 453: return $currentstring;
454: }
455: sub end_h1 {
456: my ($target,$token) = @_;
457: my $currentstring = '';
458: if ($target eq 'web') {
459: $currentstring .= $token->[2];
460: } elsif ($target eq 'tex') {
1.35 sakharuk 461: $currentstring .= '}}';
1.13 www 462: } elsif ($target eq 'meta') {
463: &end_output();
464: $currentstring='</subject>';
465: }
1.1 sakharuk 466: return $currentstring;
467: }
1.35 sakharuk 468: #-- <h2> tag
1.1 sakharuk 469: sub start_h2 {
470: my ($target,$token) = @_;
471: my $currentstring = '';
472: if ($target eq 'web') {
473: $currentstring .= $token->[4];
474: } elsif ($target eq 'tex') {
1.35 sakharuk 475: $currentstring .= '\large{\textbf{';
1.1 sakharuk 476: }
477: return $currentstring;
478: }
479: sub end_h2 {
480: my ($target,$token) = @_;
481: my $currentstring = '';
482: if ($target eq 'web') {
483: $currentstring .= $token->[2];
484: } elsif ($target eq 'tex') {
1.35 sakharuk 485: $currentstring .= '}}';
1.1 sakharuk 486: }
487: return $currentstring;
488: }
1.35 sakharuk 489: #-- <h3> tag
1.1 sakharuk 490: sub start_h3 {
491: my ($target,$token) = @_;
492: my $currentstring = '';
493: if ($target eq 'web') {
494: $currentstring .= $token->[4];
495: } elsif ($target eq 'tex') {
1.35 sakharuk 496: $currentstring .= '\large{\textbf{';
1.1 sakharuk 497: }
498: return $currentstring;
499: }
500: sub end_h3 {
501: my ($target,$token) = @_;
502: my $currentstring = '';
503: if ($target eq 'web') {
504: $currentstring .= $token->[2];
505: } elsif ($target eq 'tex') {
1.35 sakharuk 506: $currentstring .= '}}';
1.1 sakharuk 507: }
508: return $currentstring;
509: }
1.35 sakharuk 510: #-- <h4> tag
1.1 sakharuk 511: sub start_h4 {
512: my ($target,$token) = @_;
513: my $currentstring = '';
514: if ($target eq 'web') {
515: $currentstring .= $token->[4];
516: } elsif ($target eq 'tex') {
1.35 sakharuk 517: $currentstring .= '\large{\textbf';
1.1 sakharuk 518: }
519: return $currentstring;
520: }
521: sub end_h4 {
522: my ($target,$token) = @_;
523: my $currentstring = '';
524: if ($target eq 'web') {
525: $currentstring .= $token->[2];
526: } elsif ($target eq 'tex') {
1.35 sakharuk 527: $currentstring .= '}}';
1.1 sakharuk 528: }
529: return $currentstring;
530: }
1.35 sakharuk 531: #-- <h5> tag
1.1 sakharuk 532: sub start_h5 {
533: my ($target,$token) = @_;
534: my $currentstring = '';
535: if ($target eq 'web') {
536: $currentstring .= $token->[4];
537: } elsif ($target eq 'tex') {
1.35 sakharuk 538: $currentstring .= '\large{\textbf{';
1.1 sakharuk 539: }
540: return $currentstring;
541: }
542: sub end_h5 {
543: my ($target,$token) = @_;
544: my $currentstring = '';
545: if ($target eq 'web') {
546: $currentstring .= $token->[2];
547: } elsif ($target eq 'tex') {
1.35 sakharuk 548: $currentstring .= '}}';
1.1 sakharuk 549: }
550: return $currentstring;
551: }
1.35 sakharuk 552: #-- <h6> tag
1.1 sakharuk 553: sub start_h6 {
554: my ($target,$token) = @_;
555: my $currentstring = '';
556: if ($target eq 'web') {
557: $currentstring .= $token->[4];
558: } elsif ($target eq 'tex') {
1.35 sakharuk 559: $currentstring .= '\large{\textbf{';
1.1 sakharuk 560: }
561: return $currentstring;
562: }
563: sub end_h6 {
564: my ($target,$token) = @_;
565: my $currentstring = '';
566: if ($target eq 'web') {
567: $currentstring .= $token->[2];
568: } elsif ($target eq 'tex') {
1.35 sakharuk 569: $currentstring .= '}}';
1.1 sakharuk 570: }
571: return $currentstring;
572: }
1.35 sakharuk 573: #--- <cite> tag
1.1 sakharuk 574: sub start_cite {
575: my ($target,$token) = @_;
576: my $currentstring = '';
577: if ($target eq 'web') {
578: $currentstring .= $token->[4];
579: } elsif ($target eq 'tex') {
1.18 sakharuk 580: $currentstring .= "\\textit{";
581: } elsif ($target eq 'latexsource') {
582: $currentstring .= "\\textit{";
1.1 sakharuk 583: }
584: return $currentstring;
585: }
586: sub end_cite {
587: my ($target,$token) = @_;
588: my $currentstring = '';
589: if ($target eq 'web') {
590: $currentstring .= $token->[2];
591: } elsif ($target eq 'tex') {
592: $currentstring .= "}";
1.18 sakharuk 593: } elsif ($target eq 'latexsource') {
594: $currentstring .= "}";
1.1 sakharuk 595: }
596: return $currentstring;
597: }
1.35 sakharuk 598: #-- <i> tag
1.1 sakharuk 599: sub start_i {
600: my ($target,$token) = @_;
601: my $currentstring = '';
602: if ($target eq 'web') {
603: $currentstring .= $token->[4];
604: } elsif ($target eq 'tex') {
1.35 sakharuk 605: $currentstring .= '\textit{';
1.18 sakharuk 606: } elsif ($target eq 'latexsource') {
1.35 sakharuk 607: $currentstring .= '\textit{';
1.1 sakharuk 608: }
609: return $currentstring;
610: }
611: sub end_i {
612: my ($target,$token) = @_;
613: my $currentstring = '';
614: if ($target eq 'web') {
615: $currentstring .= $token->[2];
616: } elsif ($target eq 'tex') {
1.35 sakharuk 617: $currentstring .= '}';
1.18 sakharuk 618: } elsif ($target eq 'latexsource') {
1.35 sakharuk 619: $currentstring .= '}';
1.1 sakharuk 620: }
621: return $currentstring;
622: }
1.35 sakharuk 623: #-- <address> tag
1.1 sakharuk 624: sub start_address {
625: my ($target,$token) = @_;
626: my $currentstring = '';
627: if ($target eq 'web') {
628: $currentstring .= $token->[4];
629: } elsif ($target eq 'tex') {
1.18 sakharuk 630: $currentstring .= "\\textit{";
631: } elsif ($target eq 'latexsource') {
632: $currentstring .= "\\textit{";
1.1 sakharuk 633: }
634: return $currentstring;
635: }
636: sub end_address {
637: my ($target,$token) = @_;
638: my $currentstring = '';
639: if ($target eq 'web') {
640: $currentstring .= $token->[2];
641: } elsif ($target eq 'tex') {
642: $currentstring .= "}";
1.18 sakharuk 643: } elsif ($target eq 'latexsource') {
644: $currentstring .= "}";
1.1 sakharuk 645: }
646: return $currentstring;
647: }
1.35 sakharuk 648: #-- <dfn> tag
1.1 sakharuk 649: sub start_dfn {
650: my ($target,$token) = @_;
651: my $currentstring = '';
652: if ($target eq 'web') {
653: $currentstring .= $token->[4];
654: } elsif ($target eq 'tex') {
1.18 sakharuk 655: $currentstring .= "\\textit{";
656: } elsif ($target eq 'latexsource') {
657: $currentstring .= "\\textit{";
1.1 sakharuk 658: }
659: return $currentstring;
660: }
661: sub end_dfn {
662: my ($target,$token) = @_;
663: my $currentstring = '';
664: if ($target eq 'web') {
665: $currentstring .= $token->[2];
666: } elsif ($target eq 'tex') {
667: $currentstring .= "}";
1.18 sakharuk 668: } elsif ($target eq 'latexsource') {
669: $currentstring .= "}";
1.1 sakharuk 670: }
671: return $currentstring;
672: }
1.35 sakharuk 673: #-- <tt> tag
1.1 sakharuk 674: sub start_tt {
675: my ($target,$token) = @_;
676: my $currentstring = '';
677: if ($target eq 'web') {
678: $currentstring .= $token->[4];
679: } elsif ($target eq 'tex') {
1.35 sakharuk 680: $currentstring .= '\texttt{';
1.18 sakharuk 681: } elsif ($target eq 'latexsource') {
1.35 sakharuk 682: $currentstring .= '\texttt{';
1.1 sakharuk 683: }
684: return $currentstring;
685: }
686: sub end_tt {
687: my ($target,$token) = @_;
688: my $currentstring = '';
689: if ($target eq 'web') {
690: $currentstring .= $token->[2];
691: } elsif ($target eq 'tex') {
1.35 sakharuk 692: $currentstring .= '}';
1.18 sakharuk 693: } elsif ($target eq 'latexsource') {
1.35 sakharuk 694: $currentstring .= '}';
1.18 sakharuk 695: }
1.1 sakharuk 696: return $currentstring;
697: }
1.35 sakharuk 698: #-- <kbd> tag
1.1 sakharuk 699: sub start_kbd {
700: my ($target,$token) = @_;
701: my $currentstring = '';
702: if ($target eq 'web') {
703: $currentstring .= $token->[4];
704: } elsif ($target eq 'tex') {
1.18 sakharuk 705: $currentstring .= "\\texttt";
706: } elsif ($target eq 'latexsource') {
707: $currentstring .= "\\texttt{";
1.1 sakharuk 708: }
709: return $currentstring;
710: }
711: sub end_kbd {
712: my ($target,$token) = @_;
713: my $currentstring = '';
714: if ($target eq 'web') {
715: $currentstring .= $token->[2];
716: } elsif ($target eq 'tex') {
717: $currentstring .= "}";
1.18 sakharuk 718: } elsif ($target eq 'latexsource') {
719: $currentstring .= "}";
1.1 sakharuk 720: }
721: return $currentstring;
722: }
1.35 sakharuk 723: #-- <code> tag
1.1 sakharuk 724: sub start_code {
725: my ($target,$token) = @_;
726: my $currentstring = '';
727: if ($target eq 'web') {
728: $currentstring .= $token->[4];
729: } elsif ($target eq 'tex') {
1.35 sakharuk 730: $currentstring .= '\texttt{';
1.1 sakharuk 731: }
732: return $currentstring;
733: }
734: sub end_code {
735: my ($target,$token) = @_;
736: my $currentstring = '';
737: if ($target eq 'web') {
738: $currentstring .= $token->[2];
739: } elsif ($target eq 'tex') {
1.35 sakharuk 740: $currentstring .= '}';
1.1 sakharuk 741: }
742: return $currentstring;
743: }
1.35 sakharuk 744: #-- <em> tag
1.1 sakharuk 745: sub start_em {
746: my ($target,$token) = @_;
747: my $currentstring = '';
748: if ($target eq 'web') {
749: $currentstring .= $token->[4];
750: } elsif ($target eq 'tex') {
1.35 sakharuk 751: $currentstring .= '\emph{';
1.18 sakharuk 752: } elsif ($target eq 'latexsource') {
1.35 sakharuk 753: $currentstring .= '\emph{';
1.1 sakharuk 754: }
755: return $currentstring;
756: }
757: sub end_em {
758: my ($target,$token) = @_;
759: my $currentstring = '';
760: if ($target eq 'web') {
761: $currentstring .= $token->[2];
762: } elsif ($target eq 'tex') {
1.35 sakharuk 763: $currentstring .= '}';
1.18 sakharuk 764: } elsif ($target eq 'latexsource') {
1.35 sakharuk 765: $currentstring .= '}';
1.18 sakharuk 766: }
1.1 sakharuk 767: return $currentstring;
768: }
1.35 sakharuk 769: #-- <q> tag
1.1 sakharuk 770: sub start_q {
771: my ($target,$token) = @_;
772: my $currentstring = '';
773: if ($target eq 'web') {
774: $currentstring .= $token->[4];
775: } elsif ($target eq 'tex') {
1.18 sakharuk 776: $currentstring .= "\\emph{";
777: } elsif ($target eq 'latexsource') {
778: $currentstring .= "\\emph{";
779: }
1.1 sakharuk 780: return $currentstring;
781: }
782: sub end_q {
783: my ($target,$token) = @_;
784: my $currentstring = '';
785: if ($target eq 'web') {
786: $currentstring .= $token->[2];
787: } elsif ($target eq 'tex') {
788: $currentstring .= "}";
1.18 sakharuk 789: } elsif ($target eq 'latexsource') {
790: $currentstring .= "}";
791: }
1.1 sakharuk 792: return $currentstring;
793: }
1.35 sakharuk 794: #-- <p> tag
1.1 sakharuk 795: sub start_p {
796: my ($target,$token) = @_;
797: my $currentstring = '';
798: if ($target eq 'web') {
799: $currentstring .= $token->[4];
800: } elsif ($target eq 'tex') {
1.35 sakharuk 801: $currentstring .= '{\par ';
1.18 sakharuk 802: } elsif ($target eq 'latexsource') {
1.35 sakharuk 803: $currentstring .= '{\par ';
1.1 sakharuk 804: }
805: return $currentstring;
806: }
807: sub end_p {
808: my ($target,$token) = @_;
809: my $currentstring = '';
810: if ($target eq 'web') {
811: $currentstring .= $token->[2];
812: } elsif ($target eq 'tex') {
1.35 sakharuk 813: $currentstring .= '}';
1.18 sakharuk 814: } elsif ($target eq 'latexsource') {
1.35 sakharuk 815: $currentstring .= '}';
1.1 sakharuk 816: }
817: return $currentstring;
818: }
1.35 sakharuk 819: #-- <br> tag
1.1 sakharuk 820: sub start_br {
821: my ($target,$token) = @_;
822: my $currentstring = '';
823: if ($target eq 'web') {
824: $currentstring .= $token->[4];
825: } elsif ($target eq 'tex') {
1.35 sakharuk 826: $currentstring .= '\\';
1.18 sakharuk 827: } elsif ($target eq 'latexsource') {
1.35 sakharuk 828: $currentstring .= '\\';
1.1 sakharuk 829: }
830: return $currentstring;
831: }
832: sub end_br {
833: my ($target,$token) = @_;
834: my $currentstring = '';
835: if ($target eq 'web') {
836: $currentstring .= $token->[2];
837: }
838: return $currentstring;
839: }
1.35 sakharuk 840: #-- <big> tag
1.1 sakharuk 841: sub start_big {
842: my ($target,$token) = @_;
843: my $currentstring = '';
844: if ($target eq 'web') {
845: $currentstring .= $token->[4];
846: } elsif ($target eq 'tex') {
1.36 albertel 847: $currentstring .= '\large{';
1.18 sakharuk 848: } elsif ($target eq 'latexsource') {
1.35 sakharuk 849: $currentstring .= '\large{';
1.18 sakharuk 850: }
1.1 sakharuk 851: return $currentstring;
852: }
853: sub end_big {
854: my ($target,$token) = @_;
855: my $currentstring = '';
856: if ($target eq 'web') {
857: $currentstring .= $token->[2];
858: } elsif ($target eq 'tex') {
1.35 sakharuk 859: $currentstring .= '}';
1.18 sakharuk 860: } elsif ($target eq 'latexsource') {
1.35 sakharuk 861: $currentstring .= '}';
1.1 sakharuk 862: }
863: return $currentstring;
864: }
1.35 sakharuk 865: #-- <small> tag
1.1 sakharuk 866: sub start_small {
867: my ($target,$token) = @_;
868: my $currentstring = '';
869: if ($target eq 'web') {
870: $currentstring .= $token->[4];
871: } elsif ($target eq 'tex') {
1.35 sakharuk 872: $currentstring .= '\footnotesize{';
1.18 sakharuk 873: } elsif ($target eq 'latexsource') {
1.35 sakharuk 874: $currentstring .= '\footnotesize{';
1.1 sakharuk 875: }
876: return $currentstring;
877: }
878: sub end_small {
879: my ($target,$token) = @_;
880: my $currentstring = '';
881: if ($target eq 'web') {
882: $currentstring .= $token->[2];
883: } elsif ($target eq 'tex') {
1.35 sakharuk 884: $currentstring .= '}';
1.18 sakharuk 885: } elsif ($target eq 'latexsource') {
1.35 sakharuk 886: $currentstring .= '}';
1.1 sakharuk 887: }
888: return $currentstring;
889: }
1.35 sakharuk 890: #-- <basefont> tag
1.1 sakharuk 891: sub start_basefont {
1.14 albertel 892: my ($target,$token) = @_;
893: my $currentstring = '';
894: if ($target eq 'web') {
895: $currentstring = $token->[4];
896: }
897: return $currentstring;
898: }
899: sub end_basefont {
900: my ($target,$token) = @_;
901: my $currentstring = '';
902: if ($target eq 'web') {
903: $currentstring = $token->[4];
904: }
905: return $currentstring;
906: }
1.35 sakharuk 907: #-- <font> tag
1.1 sakharuk 908: sub start_font {
909: my ($target,$token) = @_;
910: my $currentstring = '';
911: if ($target eq 'web') {
912: $currentstring = $token->[4];
913: }
914: return $currentstring;
915: }
916: sub end_font {
917: my ($target,$token) = @_;
918: my $currentstring = '';
919: if ($target eq 'web') {
920: $currentstring = $token->[2];
921: }
922: return $currentstring;
923: }
1.35 sakharuk 924: #-- <strike> tag
1.1 sakharuk 925: sub start_strike {
926: my ($target,$token) = @_;
927: my $currentstring = '';
928: if ($target eq 'web') {
929: $currentstring .= $token->[4];
930: } elsif ($target eq 'tex') {
931: $currentstring .= "{\\underline ";
932: }
933: return $currentstring;
934: }
935: sub end_strike {
936: my ($target,$token) = @_;
937: my $currentstring = '';
938: if ($target eq 'web') {
939: $currentstring .= $token->[2];
940: } elsif ($target eq 'tex') {
941: $currentstring .= " }";
942: }
943: return $currentstring;
944: }
1.35 sakharuk 945: #-- <s> tag
1.1 sakharuk 946: sub start_s {
947: my ($target,$token) = @_;
948: my $currentstring = '';
949: if ($target eq 'web') {
950: $currentstring .= $token->[4];
951: } elsif ($target eq 'tex') {
952: $currentstring .= "{\\underline ";
953: }
954: return $currentstring;
955: }
956: sub end_s {
957: my ($target,$token) = @_;
958: my $currentstring = '';
959: if ($target eq 'web') {
960: $currentstring .= $token->[2];
961: } elsif ($target eq 'tex') {
962: $currentstring .= " }";
963: }
964: return $currentstring;
965: }
1.35 sakharuk 966: #-- <sub> tag
1.1 sakharuk 967: sub start_sub {
968: my ($target,$token) = @_;
969: my $currentstring = '';
970: if ($target eq 'web') {
971: $currentstring .= $token->[4];
972: } elsif ($target eq 'tex') {
973: $currentstring .= "\$_{ ";
974: }
975: return $currentstring;
976: }
977: sub end_sub {
978: my ($target,$token) = @_;
979: my $currentstring = '';
980: if ($target eq 'web') {
981: $currentstring .= $token->[2];
982: } elsif ($target eq 'tex') {
983: $currentstring .= " }\$";
984: }
985: return $currentstring;
986: }
1.35 sakharuk 987: #-- <sup> tag
1.1 sakharuk 988: sub start_sup {
989: my ($target,$token) = @_;
990: my $currentstring = '';
991: if ($target eq 'web') {
992: $currentstring .= $token->[4];
993: } elsif ($target eq 'tex') {
994: $currentstring .= "\$^{ ";
995: }
996: return $currentstring;
997: }
998: sub end_sup {
999: my ($target,$token) = @_;
1000: my $currentstring = '';
1001: if ($target eq 'web') {
1002: $currentstring .= $token->[2];
1003: } elsif ($target eq 'tex') {
1004: $currentstring .= " }\$";
1005: }
1006: return $currentstring;
1007: }
1.35 sakharuk 1008: #-- <hr> tag
1.1 sakharuk 1009: sub start_hr {
1010: my ($target,$token) = @_;
1011: my $currentstring = '';
1012: if ($target eq 'web') {
1013: $currentstring .= $token->[4];
1014: } elsif ($target eq 'tex') {
1015: $currentstring .= "\\hline ";
1.6 sakharuk 1016: }
1017: return $currentstring;
1018: }
1019: sub end_hr {
1020: my ($target,$token) = @_;
1021: my $currentstring = '';
1022: if ($target eq 'web') {
1023: $currentstring .= $token->[2];
1024: } elsif ($target eq 'tex') {
1.1 sakharuk 1025: }
1026: return $currentstring;
1027: }
1.35 sakharuk 1028: #-- <a> tag
1.1 sakharuk 1029: sub start_a {
1030: my ($target,$token) = @_;
1031: my $currentstring = '';
1032: if ($target eq 'web') {
1033: $currentstring .= $token->[4];
1034: } elsif ($target eq 'tex') {
1035: }
1036: return $currentstring;
1037: }
1038: sub end_a {
1.30 albertel 1039: my ($target,$token,$tagstack,$stackref) = @_;
1.1 sakharuk 1040: my $currentstring = '';
1041: if ($target eq 'web') {
1042: $currentstring .= $token->[2];
1043: } elsif ($target eq 'tex') {
1044: my $tempor_var = $stackref->[$#$stackref];
1045: if (index($tempor_var,'name') != -1 ) {
1046: $tempor_var =~ s/name=([^,]*),/$1/g;
1.15 sakharuk 1047: # $currentstring .= " \\label{$tempor_var}";
1.1 sakharuk 1048: } elsif (index($tempor_var,'href') != -1 ) {
1049: $tempor_var =~ s/href=([^,]*),/$1/g;
1050: $currentstring .= " \\ref{$tempor_var}";
1051: }
1052: }
1053: return $currentstring;
1054: }
1.35 sakharuk 1055: #-- <li> tag
1.1 sakharuk 1056: sub start_li {
1.30 albertel 1057: my ($target,$token,$tagstack,$stackref) = @_;
1.1 sakharuk 1058: my $currentstring = '';
1059: if ($target eq 'web') {
1060: $currentstring = $token->[4];
1061: } elsif ($target eq 'tex') {
1.15 sakharuk 1062: my $tempor_var = $stackref->[$#$stackref];
1.1 sakharuk 1063: if (index($tempor_var,'circle') != -1 ) {
1064: $currentstring .= " \\item[o] ";
1065: } elsif (index($tempor_var,'square') != -1 ) {
1066: $currentstring .= " \\item[$\Box$] ";
1.15 sakharuk 1067: } elsif ($tempor_var ne '') {
1068: $_ = $tempor_var;
1069: m/my\s*([^=]*)=/;
1070: $currentstring .= " \\item[$1] ";
1071: } else {
1.1 sakharuk 1072: $currentstring .= " \\item ";
1073: }
1074: }
1075: return $currentstring;
1076: }
1077: sub end_li {
1078: my ($target,$token) = @_;
1079: my $currentstring = '';
1080: if ($target eq 'web') {
1081: $currentstring = $token->[2];
1082: }
1083: return $currentstring;
1084: }
1.35 sakharuk 1085: #-- <u> tag
1.1 sakharuk 1086: sub start_u {
1087: my ($target,$token) = @_;
1088: my $currentstring = '';
1089: if ($target eq 'web') {
1090: $currentstring .= $token->[4];
1091: } elsif ($target eq 'tex') {
1092: $currentstring .= "{\\underline ";
1093: }
1094: return $currentstring;
1095: }
1096: sub end_u {
1097: my ($target,$token) = @_;
1098: my $currentstring = '';
1099: if ($target eq 'web') {
1100: $currentstring .= $token->[2];
1101: } elsif ($target eq 'tex') {
1102: $currentstring .= " }";
1103: }
1104: return $currentstring;
1105: }
1.35 sakharuk 1106: #-- <ul> tag
1.1 sakharuk 1107: sub start_ul {
1108: my ($target,$token) = @_;
1109: my $currentstring = '';
1110: if ($target eq 'web') {
1111: $currentstring = $token->[4];
1112: } elsif ($target eq 'tex') {
1113: $currentstring = " \\begin{itemize} ";
1114: }
1115: return $currentstring;
1116: }
1117: sub end_ul {
1118: my ($target,$token) = @_;
1119: my $currentstring = '';
1120: if ($target eq 'web') {
1121: $currentstring = $token->[2];
1122: } elsif ($target eq 'tex') {
1123: $currentstring = " \\end{itemize}";
1124: }
1125: return $currentstring;
1126: }
1.35 sakharuk 1127: #-- <menu> tag
1.1 sakharuk 1128: sub start_menu {
1129: my ($target,$token) = @_;
1130: my $currentstring = '';
1131: if ($target eq 'web') {
1132: $currentstring = $token->[4];
1133: } elsif ($target eq 'tex') {
1134: $currentstring = " \\begin{itemize} ";
1135: }
1136: return $currentstring;
1137: }
1138: sub end_menu {
1139: my ($target,$token) = @_;
1140: my $currentstring = '';
1141: if ($target eq 'web') {
1142: $currentstring = $token->[2];
1143: } elsif ($target eq 'tex') {
1144: $currentstring = " \\end{itemize}";
1145: }
1146: return $currentstring;
1147: }
1.35 sakharuk 1148: #-- <dir> tag
1.1 sakharuk 1149: sub start_dir {
1150: my ($target,$token) = @_;
1151: my $currentstring = '';
1152: if ($target eq 'web') {
1153: $currentstring = $token->[4];
1154: } elsif ($target eq 'tex') {
1155: $currentstring = " \\begin{itemize} ";
1156: }
1157: return $currentstring;
1158: }
1159: sub end_dir {
1160: my ($target,$token) = @_;
1161: my $currentstring = '';
1162: if ($target eq 'web') {
1163: $currentstring = $token->[2];
1164: } elsif ($target eq 'tex') {
1165: $currentstring = " \\end{itemize}";
1166: }
1167: return $currentstring;
1168: }
1.35 sakharuk 1169: #-- <ol> tag
1.1 sakharuk 1170: sub start_ol {
1171: my ($target,$token) = @_;
1172: my $currentstring = '';
1173: if ($target eq 'web') {
1174: $currentstring = $token->[4];
1175: } elsif ($target eq 'tex') {
1176: $currentstring = " \\begin{enumerate} ";
1177: }
1178: return $currentstring;
1179: }
1180: sub end_ol {
1181: my ($target,$token) = @_;
1182: my $currentstring = '';
1183: if ($target eq 'web') {
1184: $currentstring = $token->[2];
1185: } elsif ($target eq 'tex') {
1186: $currentstring = " \\end{enumerate}";
1187: }
1188: return $currentstring;
1189: }
1.35 sakharuk 1190: #-- <dl> tag
1.1 sakharuk 1191: sub start_dl {
1192: my ($target,$token) = @_;
1193: my $currentstring = '';
1194: if ($target eq 'web') {
1195: $currentstring = $token->[4];
1196: } elsif ($target eq 'tex') {
1197: $currentstring = " \\begin{description} ";
1198: }
1199: return $currentstring;
1200: }
1201: sub end_dl {
1202: my ($target,$token) = @_;
1203: my $currentstring = '';
1204: if ($target eq 'web') {
1205: $currentstring = $token->[2];
1206: } elsif ($target eq 'tex') {
1207: $currentstring = " \\end{description}";
1208: }
1209: return $currentstring;
1210: }
1.35 sakharuk 1211: #-- <dt> tag
1.1 sakharuk 1212: sub start_dt {
1213: my ($target,$token) = @_;
1214: my $currentstring = '';
1215: if ($target eq 'web') {
1216: $currentstring = $token->[4];
1217: } elsif ($target eq 'tex') {
1218: $currentstring = "\\item[ ";
1219: }
1220: return $currentstring;
1221: }
1222: sub end_dt {
1223: my ($target,$token) = @_;
1224: my $currentstring = '';
1225: if ($target eq 'web') {
1226: $currentstring = $token->[2];
1227: } elsif ($target eq 'tex') {
1228: $currentstring = "]";
1229: }
1230: return $currentstring;
1231: }
1.35 sakharuk 1232: #-- <dd> tag
1.1 sakharuk 1233: sub start_dd {
1234: my ($target,$token) = @_;
1235: my $currentstring = '';
1236: if ($target eq 'web') {
1237: $currentstring = $token->[4];
1238: }
1239: return $currentstring;
1240: }
1241: sub end_dd {
1242: my ($target,$token) = @_;
1243: my $currentstring = '';
1244: if ($target eq 'web') {
1245: $currentstring = $token->[2];
1246: }
1247: return $currentstring;
1248: }
1.35 sakharuk 1249: #-- <table> tag
1.1 sakharuk 1250: sub start_table {
1251: my ($target,$token) = @_;
1252: my $currentstring = '';
1253: if ($target eq 'web') {
1254: $currentstring = $token->[4];
1255: } elsif ($target eq 'tex') {
1.15 sakharuk 1256: $currentstring = "";
1.1 sakharuk 1257: }
1258: return $currentstring;
1259: }
1260: sub end_table {
1261: my ($target,$token) = @_;
1262: my $currentstring = '';
1263: if ($target eq 'web') {
1264: $currentstring = $token->[2];
1265: } elsif ($target eq 'tex') {
1.15 sakharuk 1266: $currentstring = "";
1267: }
1268: return $currentstring;
1269: }
1.35 sakharuk 1270: #-- <tr> tag
1.15 sakharuk 1271: sub start_tr {
1272: my ($target,$token) = @_;
1273: my $currentstring = '';
1274: if ($target eq 'web') {
1275: $currentstring = $token->[4];
1276: } elsif ($target eq 'tex') {
1277: $currentstring = '';
1278: }
1279: return $currentstring;
1280: }
1281: sub end_tr {
1282: my ($target,$token) = @_;
1283: my $currentstring = '';
1284: if ($target eq 'web') {
1285: $currentstring = $token->[2];
1286: } elsif ($target eq 'tex') {
1287: $currentstring = "";
1288: }
1289: return $currentstring;
1290: }
1.35 sakharuk 1291: #-- <td> tag
1.15 sakharuk 1292: sub start_td {
1293: my ($target,$token) = @_;
1294: my $currentstring = '';
1295: if ($target eq 'web') {
1296: $currentstring = $token->[4];
1297: } elsif ($target eq 'tex') {
1298: $currentstring = '';
1299: }
1300: return $currentstring;
1301: }
1302: sub end_td {
1303: my ($target,$token) = @_;
1304: my $currentstring = '';
1305: if ($target eq 'web') {
1306: $currentstring = $token->[2];
1307: } elsif ($target eq 'tex') {
1308: $currentstring = "";
1.1 sakharuk 1309: }
1310: return $currentstring;
1311: }
1.35 sakharuk 1312: #-- <img> tag
1.10 www 1313:
1314: sub start_img {
1315: my ($target,$token) = @_;
1316: $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=
1317: $token->[2]->{'src'};
1318: my $currentstring = '';
1319: if ($target eq 'web') {
1320: $currentstring = $token->[4];
1321: } elsif ($target eq 'tex') {
1322: $currentstring = " \\begin{figure} ";
1323: }
1324: return $currentstring;
1325: }
1326: sub end_img {
1327: my ($target,$token) = @_;
1328: my $currentstring = '';
1329: if ($target eq 'web') {
1330: $currentstring = $token->[2];
1331: } elsif ($target eq 'tex') {
1332: $currentstring = " \\end{figure}";
1333: }
1334: return $currentstring;
1335: }
1.35 sakharuk 1336: #-- <applet> tag
1.10 www 1337:
1338: sub start_applet {
1339: my ($target,$token) = @_;
1340: $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=
1341: $token->[2]->{'code'};
1342: $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=
1343: $token->[2]->{'archive'};
1344: my $currentstring = '';
1345: if ($target eq 'web') {
1346: $currentstring = $token->[4];
1347: } elsif ($target eq 'tex') {
1348: $currentstring = " \\begin{figure} ";
1349: }
1350: return $currentstring;
1351: }
1352: sub end_applet {
1353: my ($target,$token) = @_;
1354: my $currentstring = '';
1355: if ($target eq 'web') {
1356: $currentstring = $token->[2];
1357: } elsif ($target eq 'tex') {
1358: $currentstring = " \\end{figure}";
1359: }
1360: return $currentstring;
1361: }
1362:
1.35 sakharuk 1363: #-- <embed> tag
1.10 www 1364:
1365: sub start_embed {
1366: my ($target,$token) = @_;
1367: $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=
1368: $token->[2]->{'src'};
1369: my $currentstring = '';
1370: if ($target eq 'web') {
1371: $currentstring = $token->[4];
1372: } elsif ($target eq 'tex') {
1373: $currentstring = " \\begin{figure} ";
1374: }
1375: return $currentstring;
1376: }
1377: sub end_embed {
1378: my ($target,$token) = @_;
1379: my $currentstring = '';
1380: if ($target eq 'web') {
1381: $currentstring = $token->[2];
1382: } elsif ($target eq 'tex') {
1383: $currentstring = " \\end{figure}";
1384: }
1385: return $currentstring;
1386: }
1387:
1.35 sakharuk 1388: #-- <param> tag
1.10 www 1389:
1.11 www 1390: sub start_param {
1.10 www 1391: my ($target,$token) = @_;
1392: if ($token->[2]->{'name'} eq 'cabbase') {
1393: $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=
1394: $token->[2]->{'value'};
1395: }
1.20 www 1396: $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=
1.10 www 1397: $token->[2]->{'src'};
1398: my $currentstring = '';
1399: if ($target eq 'web') {
1400: $currentstring = $token->[4];
1401: } elsif ($target eq 'tex') {
1402: $currentstring = " \\begin{figure} ";
1403: }
1404: return $currentstring;
1405: }
1.11 www 1406: sub end_param {
1.10 www 1407: my ($target,$token) = @_;
1408: my $currentstring = '';
1409: if ($target eq 'web') {
1410: $currentstring = $token->[2];
1411: } elsif ($target eq 'tex') {
1412: $currentstring = " \\end{figure}";
1413: }
1414: return $currentstring;
1415: }
1416:
1.35 sakharuk 1417: #-- <allow> tag
1.10 www 1418:
1419: sub start_allow {
1420: my ($target,$token) = @_;
1421:
1.20 www 1422: $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=
1.10 www 1423: $token->[2]->{'src'};
1424:
1425: return '';
1426: }
1427: sub end_allow {
1428: return '';
1429: }
1.35 sakharuk 1430: #-- Frames
1.31 albertel 1431: sub start_frameset {
1432: my ($target,$token) = @_;
1433: my $currentstring = '';
1434: if ($target eq 'web') {
1435: if (!$Apache::lonxml::registered) {
1436: $currentstring.='<head>'.&Apache::lonxml::registerurl().'</head>';
1437: }
1438: $currentstring .= $token->[4];
1439: }
1440: return $currentstring;
1441: }
1442: sub end_frameset {
1443: my ($target,$token) = @_;
1444: my $currentstring = '';
1445: if ($target eq 'web') {
1446: $currentstring = $token->[2];
1447: }
1448: return $currentstring;
1449: }
1.1 sakharuk 1450: 1;
1451: __END__
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>