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