Annotation of loncom/xml/londefdef.pm, revision 1.14
1.1 sakharuk 1: # The LearningOnline Network with CAPA
2: # Tags Default Definition Module
3: #
4: # last modified 06/26/00 by Alexander Sakharuk
1.12 www 5: # 11/6,11/30 Gerd Kortemeyer
1.1 sakharuk 6:
1.2 albertel 7: package Apache::londefdef;
1.1 sakharuk 8:
9: use strict;
1.3 sakharuk 10: use Apache::lonxml;
1.1 sakharuk 11:
1.3 sakharuk 12: sub BEGIN {
1.10 www 13: &Apache::lonxml::register('Apache::londefdef',('m','html','head','map','applet','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'));
1.3 sakharuk 14: }
1.1 sakharuk 15:
16: #===================================================================== TAG SUBROUTINES
1.8 sakharuk 17: #-- <output>
18: sub start_output {
1.13 www 19: my ($target,$token) = @_;
1.8 sakharuk 20: $Apache::lonxml::textredirection = 1;
21: my $result = '';
22: return $result;
23: }
24: sub end_output {
1.13 www 25: my ($target,$token) = @_;
1.8 sakharuk 26: $Apache::lonxml::textredirection = 0;
27: my $result = '';
28: return $result;
29: }
1.4 sakharuk 30: #-- <m> tag
1.1 sakharuk 31: sub start_m {
1.4 sakharuk 32: my ($target,$token,$parstack,$parser) = @_;
1.1 sakharuk 33: my $currentstring = '';
34: if ($target eq 'web') {
1.5 sakharuk 35: my $inside = &Apache::lonxml::get_all_text("/m",$$parser[$#$parser]);
36: $inside ='\\documentstyle{article}'.$inside;
37: # &Apache::lonxml::debug($inside);
38: $currentstring = &Apache::lontexconvert::converted(\$inside);
39: # &Apache::lonxml::debug($currentstring);
40:
1.1 sakharuk 41: } elsif ($target eq 'tex') {
1.7 sakharuk 42: $currentstring = "";
1.1 sakharuk 43: }
44: return $currentstring;
45: }
46: sub end_m {
47: my ($target,$token) = @_;
48: my $currentstring = '';
49: if ($target eq 'web') {
50: } elsif ($target eq 'tex') {
1.7 sakharuk 51: $currentstring = "";
1.6 sakharuk 52: } elsif ($target eq 'meta') {
1.1 sakharuk 53: }
54: return $currentstring;
55: }
56: #-------------------------------------------------------------------------- <html> tag
57: sub start_html {
58: my ($target,$token) = @_;
59: my $currentstring = '';
60: if ($target eq 'web') {
61: $currentstring = $token->[4];
62: }
63: return $currentstring;
64: }
65: sub end_html {
66: my ($target,$token) = @_;
67: my $currentstring = '';
68: if ($target eq 'web') {
69: $currentstring = $token->[2];
70: }
71: return $currentstring;
72: }
73: #-------------------------------------------------------------------------- <head> tag
74: sub start_head {
75: my ($target,$token) = @_;
76: my $currentstring = '';
77: if ($target eq 'web') {
78: $currentstring = $token->[4];
79: }
80: return $currentstring;
81: }
82: sub end_head {
83: my ($target,$token) = @_;
84: my $currentstring = '';
85: if ($target eq 'web') {
86: $currentstring = $token->[2];
87: }
88: return $currentstring;
89: }
90: #--------------------------------------------------------------------------- <map> tag
91: sub start_map {
92: my ($target,$token) = @_;
93: my $currentstring = '';
94: if ($target eq 'web') {
95: $currentstring = $token->[4];
96: }
97: return $currentstring;
98: }
99: sub end_map {
100: my ($target,$token) = @_;
101: my $currentstring = '';
102: if ($target eq 'web') {
103: $currentstring = $token->[2];
104: }
105: return $currentstring;
106: }
107: #------------------------------------------------------------------------ <applet> tag
108: sub start_applet {
109: my ($target,$token) = @_;
110: my $currentstring = '';
111: if ($target eq 'web') {
112: $currentstring = $token->[4];
113: }
114: return $currentstring;
115: }
116: sub end_applet {
117: my ($target,$token) = @_;
118: my $currentstring = '';
119: if ($target eq 'web') {
120: $currentstring = $token->[2];
121: }
122: return $currentstring;
123: }
124: #------------------------------------------------------------------------ <select> tag
125: sub start_select {
126: my ($target,$token) = @_;
127: my $currentstring = '';
128: if ($target eq 'web') {
129: $currentstring = $token->[4];
130: }
131: return $currentstring;
132: }
133: sub end_select {
134: my ($target,$token) = @_;
135: my $currentstring = '';
136: if ($target eq 'web') {
137: $currentstring = $token->[2];
138: }
139: return $currentstring;
140: }
141: #------------------------------------------------------------------------ <option> tag
142: sub start_option {
143: my ($target,$token) = @_;
144: my $currentstring = '';
145: if ($target eq 'web') {
146: $currentstring = $token->[4];
147: }
148: return $currentstring;
149: }
150: sub end_option {
151: my ($target,$token) = @_;
152: my $currentstring = '';
153: if ($target eq 'web') {
154: $currentstring = $token->[2];
155: }
156: return $currentstring;
157: }
158: #------------------------------------------------------------------------- <input> tag
159: sub start_input {
160: my ($target,$token) = @_;
161: my $currentstring = '';
162: if ($target eq 'web') {
163: $currentstring = $token->[4];
164: }
165: return $currentstring;
166: }
167: sub end_input {
168: my ($target,$token) = @_;
169: my $currentstring = '';
170: if ($target eq 'web') {
171: $currentstring = $token->[2];
172: }
173: return $currentstring;
174: }
175: #---------------------------------------------------------------------- <textarea> tag
176: sub start_textarea {
177: my ($target,$token) = @_;
178: my $currentstring = '';
179: if ($target eq 'web') {
180: $currentstring = $token->[4];
181: }
182: return $currentstring;
183: }
184: sub end_textarea {
185: my ($target,$token) = @_;
186: my $currentstring = '';
187: if ($target eq 'web') {
188: $currentstring = $token->[2];
189: }
190: return $currentstring;
191: }
192: #-------------------------------------------------------------------------- <form> tag
193: sub start_form {
194: my ($target,$token) = @_;
195: my $currentstring = '';
196: if ($target eq 'web') {
197: $currentstring = $token->[4];
198: }
199: return $currentstring;
200: }
201: sub end_form {
202: my ($target,$token) = @_;
203: my $currentstring = '';
204: if ($target eq 'web') {
205: $currentstring = $token->[2];
206: }
207: return $currentstring;
208: }
209: #------------------------------------------------------------------------- <title> tag
210: sub start_title {
211: my ($target,$token) = @_;
212: my $currentstring = '';
213: if ($target eq 'web') {
214: $currentstring = $token->[4];
215: }
1.13 www 216: if ($target eq 'meta') {
217: $currentstring='<title>';
218: &start_output();
219: }
1.1 sakharuk 220: return $currentstring;
221: }
222: sub end_title {
223: my ($target,$token) = @_;
224: my $currentstring = '';
225: if ($target eq 'web') {
226: $currentstring = $token->[2];
1.13 www 227: }
228: if ($target eq 'meta') {
229: &end_output();
230: $currentstring='</title>';
1.1 sakharuk 231: }
232: return $currentstring;
233: }
234: #-------------------------------------------------------------------------- <meta> tag
235: sub start_meta {
236: my ($target,$token) = @_;
237: my $currentstring = '';
238: if ($target eq 'web') {
239: $currentstring = $token->[4];
1.12 www 240: }
241: if ($target eq 'meta') {
242: unless ($token->[2]->{'http-equiv'}) {
243: my $name=$token->[2]->{'name'};
244: $name=~tr/A-Z/a-z/;
245: $name=~s/\s/\_/g;
246: if ($name) {
247: $currentstring='<'.$name.'>'.
248: $token->[2]->{'content'}.
249: '</'.$name.'>';
250: }
251: }
1.1 sakharuk 252: }
253: return $currentstring;
254: }
255: sub end_meta {
256: my ($target,$token) = @_;
257: my $currentstring = '';
258: if ($target eq 'web') {
259: $currentstring = $token->[2];
260: }
261: return $currentstring;
262: }
263: #-------------------------------------------------------------------------- <body> tag
264: sub start_body {
265: my ($target,$token) = @_;
266: my $currentstring = '';
267: if ($target eq 'web') {
268: $currentstring = $token->[4];
269: } elsif ($target eq 'tex') {
270: $currentstring = " \\begin{document} ";
271: }
272: return $currentstring;
273: }
274: sub end_body {
275: my ($target,$token) = @_;
276: my $currentstring = '';
277: if ($target eq 'web') {
278: $currentstring = $token->[2];
279: } elsif ($target eq 'tex') {
280: $currentstring = " \\end{document}";
281: }
282: return $currentstring;
283: }
284: #------------------------------------------------------------------------ <center> tag
285: sub start_center {
286: my ($target,$token) = @_;
287: my $currentstring = '';
288: if ($target eq 'web') {
289: $currentstring = $token->[4];
290: } elsif ($target eq 'tex') {
291: $currentstring = " \\begin{center} ";
292: }
293: return $currentstring;
294: }
295: sub end_center {
296: my ($target,$token) = @_;
297: my $currentstring = '';
298: if ($target eq 'web') {
299: $currentstring = $token->[2];
300: } elsif ($target eq 'tex') {
301: $currentstring = " \\end{center}";
302: }
303: return $currentstring;
304: }
305: #----------------------------------------------------------------------------- <b> tag
306: sub start_b {
307: my ($target,$token) = @_;
308: my $currentstring = '';
309: if ($target eq 'web') {
310: $currentstring = $token->[4];
311: } elsif ($target eq 'tex') {
312: $currentstring = " {\\bf ";
313: }
314: return $currentstring;
315: }
316: sub end_b {
317: my ($target,$token) = @_;
318: my $currentstring = '';
319: if ($target eq 'web') {
320: $currentstring = $token->[2];
321: } elsif ($target eq 'tex') {
322: $currentstring = "}";
323: }
324: return $currentstring;
325: }
326: #------------------------------------------------------------------------ <strong> tag
327: sub start_strong {
328: my ($target,$token) = @_;
329: my $currentstring = '';
330: if ($target eq 'web') {
331: $currentstring = $token->[4];
332: } elsif ($target eq 'tex') {
333: $currentstring = " {\\bf ";
334: }
335: return $currentstring;
336: }
337: sub end_strong {
338: my ($target,$token) = @_;
339: my $currentstring = '';
340: if ($target eq 'web') {
341:
342: $currentstring = $token->[2];
343: } elsif ($target eq 'tex') {
344: $currentstring = "}";
345: }
346: return $currentstring;
347: }
348: #---------------------------------------------------------------------------- <h1> tag
349: sub start_h1 {
350: my ($target,$token) = @_;
351: my $currentstring = '';
352: if ($target eq 'web') {
353: $currentstring .= $token->[4];
354: } elsif ($target eq 'tex') {
355: $currentstring .= "\\chapter{ ";
1.13 www 356: } elsif ($target eq 'meta') {
357: $currentstring='<subject>';
358: &start_output();
359: }
1.1 sakharuk 360: return $currentstring;
361: }
362: sub end_h1 {
363: my ($target,$token) = @_;
364: my $currentstring = '';
365: if ($target eq 'web') {
366: $currentstring .= $token->[2];
367: } elsif ($target eq 'tex') {
368: $currentstring .= "}";
1.13 www 369: } elsif ($target eq 'meta') {
370: &end_output();
371: $currentstring='</subject>';
372: }
1.1 sakharuk 373: return $currentstring;
374: }
375: #---------------------------------------------------------------------------- <h2> tag
376: sub start_h2 {
377: my ($target,$token) = @_;
378: my $currentstring = '';
379: if ($target eq 'web') {
380: $currentstring .= $token->[4];
381: } elsif ($target eq 'tex') {
382: $currentstring .= "\\section{ ";
383: }
384: return $currentstring;
385: }
386: sub end_h2 {
387: my ($target,$token) = @_;
388: my $currentstring = '';
389: if ($target eq 'web') {
390: $currentstring .= $token->[2];
391: } elsif ($target eq 'tex') {
392: $currentstring .= "}";
393: }
394: return $currentstring;
395: }
396: #---------------------------------------------------------------------------- <h3> tag
397: sub start_h3 {
398: my ($target,$token) = @_;
399: my $currentstring = '';
400: if ($target eq 'web') {
401: $currentstring .= $token->[4];
402: } elsif ($target eq 'tex') {
403: $currentstring .= "\\subsection{ ";
404: }
405: return $currentstring;
406: }
407: sub end_h3 {
408: my ($target,$token) = @_;
409: my $currentstring = '';
410: if ($target eq 'web') {
411: $currentstring .= $token->[2];
412: } elsif ($target eq 'tex') {
413: $currentstring .= "}";
414: }
415: return $currentstring;
416: }
417: #---------------------------------------------------------------------------- <h4> tag
418: sub start_h4 {
419: my ($target,$token) = @_;
420: my $currentstring = '';
421: if ($target eq 'web') {
422: $currentstring .= $token->[4];
423: } elsif ($target eq 'tex') {
424: $currentstring .= "\\subsubsection{ ";
425: }
426: return $currentstring;
427: }
428: sub end_h4 {
429: my ($target,$token) = @_;
430: my $currentstring = '';
431: if ($target eq 'web') {
432: $currentstring .= $token->[2];
433: } elsif ($target eq 'tex') {
434: $currentstring .= "}";
435: }
436: return $currentstring;
437: }
438: #---------------------------------------------------------------------------- <h5> tag
439: sub start_h5 {
440: my ($target,$token) = @_;
441: my $currentstring = '';
442: if ($target eq 'web') {
443: $currentstring .= $token->[4];
444: } elsif ($target eq 'tex') {
445: $currentstring .= "\\paragraph{ ";
446: }
447: return $currentstring;
448: }
449: sub end_h5 {
450: my ($target,$token) = @_;
451: my $currentstring = '';
452: if ($target eq 'web') {
453: $currentstring .= $token->[2];
454: } elsif ($target eq 'tex') {
455: $currentstring .= "}";
456: }
457: return $currentstring;
458: }
459: #---------------------------------------------------------------------------- <h6> tag
460: sub start_h6 {
461: my ($target,$token) = @_;
462: my $currentstring = '';
463: if ($target eq 'web') {
464: $currentstring .= $token->[4];
465: } elsif ($target eq 'tex') {
466: $currentstring .= "\\subparagraph{ ";
467: }
468: return $currentstring;
469: }
470: sub end_h6 {
471: my ($target,$token) = @_;
472: my $currentstring = '';
473: if ($target eq 'web') {
474: $currentstring .= $token->[2];
475: } elsif ($target eq 'tex') {
476: $currentstring .= "}";
477: }
478: return $currentstring;
479: }
480: #-------------------------------------------------------------------------- <cite> tag
481: sub start_cite {
482: my ($target,$token) = @_;
483: my $currentstring = '';
484: if ($target eq 'web') {
485: $currentstring .= $token->[4];
486: } elsif ($target eq 'tex') {
487: $currentstring .= "{ \\it ";
488: }
489: return $currentstring;
490: }
491: sub end_cite {
492: my ($target,$token) = @_;
493: my $currentstring = '';
494: if ($target eq 'web') {
495: $currentstring .= $token->[2];
496: } elsif ($target eq 'tex') {
497: $currentstring .= "}";
498: }
499: return $currentstring;
500: }
501: #----------------------------------------------------------------------------- <i> tag
502: sub start_i {
503: my ($target,$token) = @_;
504: my $currentstring = '';
505: if ($target eq 'web') {
506: $currentstring .= $token->[4];
507: } elsif ($target eq 'tex') {
508: $currentstring .= "{ \\it ";
509: }
510: return $currentstring;
511: }
512: sub end_i {
513: my ($target,$token) = @_;
514: my $currentstring = '';
515: if ($target eq 'web') {
516: $currentstring .= $token->[2];
517: } elsif ($target eq 'tex') {
518: $currentstring .= "}";
519: }
520: return $currentstring;
521: }
522: #----------------------------------------------------------------------- <address> tag
523: sub start_address {
524: my ($target,$token) = @_;
525: my $currentstring = '';
526: if ($target eq 'web') {
527: $currentstring .= $token->[4];
528: } elsif ($target eq 'tex') {
529: $currentstring .= "{ \\it ";
530: }
531: return $currentstring;
532: }
533: sub end_address {
534: my ($target,$token) = @_;
535: my $currentstring = '';
536: if ($target eq 'web') {
537: $currentstring .= $token->[2];
538: } elsif ($target eq 'tex') {
539: $currentstring .= "}";
540: }
541: return $currentstring;
542: }
543: #--------------------------------------------------------------------------- <dfn> tag
544: sub start_dfn {
545: my ($target,$token) = @_;
546: my $currentstring = '';
547: if ($target eq 'web') {
548: $currentstring .= $token->[4];
549: } elsif ($target eq 'tex') {
550: $currentstring .= "{ \\it ";
551: }
552: return $currentstring;
553: }
554: sub end_dfn {
555: my ($target,$token) = @_;
556: my $currentstring = '';
557: if ($target eq 'web') {
558: $currentstring .= $token->[2];
559: } elsif ($target eq 'tex') {
560: $currentstring .= "}";
561: }
562: return $currentstring;
563: }
564: #---------------------------------------------------------------------------- <tt> tag
565: sub start_tt {
566: my ($target,$token) = @_;
567: my $currentstring = '';
568: if ($target eq 'web') {
569: $currentstring .= $token->[4];
570: } elsif ($target eq 'tex') {
571: $currentstring .= "{ \\tt ";
572: }
573: return $currentstring;
574: }
575: sub end_tt {
576: my ($target,$token) = @_;
577: my $currentstring = '';
578: if ($target eq 'web') {
579: $currentstring .= $token->[2];
580: } elsif ($target eq 'tex') {
581: $currentstring .= "}";
582: }
583: return $currentstring;
584: }
585: #---------------------------------------------------------------------------- <kbd> tag
586: sub start_kbd {
587: my ($target,$token) = @_;
588: my $currentstring = '';
589: if ($target eq 'web') {
590: $currentstring .= $token->[4];
591: } elsif ($target eq 'tex') {
592: $currentstring .= "{ \\tt ";
593: }
594: return $currentstring;
595: }
596: sub end_kbd {
597: my ($target,$token) = @_;
598: my $currentstring = '';
599: if ($target eq 'web') {
600: $currentstring .= $token->[2];
601: } elsif ($target eq 'tex') {
602: $currentstring .= "}";
603: }
604: return $currentstring;
605: }
606: #-------------------------------------------------------------------------- <code> tag
607: sub start_code {
608: my ($target,$token) = @_;
609: my $currentstring = '';
610: if ($target eq 'web') {
611: $currentstring .= $token->[4];
612: } elsif ($target eq 'tex') {
613: $currentstring .= "{ \\tt ";
614: }
615: return $currentstring;
616: }
617: sub end_code {
618: my ($target,$token) = @_;
619: my $currentstring = '';
620: if ($target eq 'web') {
621: $currentstring .= $token->[2];
622: } elsif ($target eq 'tex') {
623: $currentstring .= "}";
624: }
625: return $currentstring;
626: }
627: #---------------------------------------------------------------------------- <em> tag
628: sub start_em {
629: my ($target,$token) = @_;
630: my $currentstring = '';
631: if ($target eq 'web') {
632: $currentstring .= $token->[4];
633: } elsif ($target eq 'tex') {
634: $currentstring .= "{ \\emph ";
635: }
636: return $currentstring;
637: }
638: sub end_em {
639: my ($target,$token) = @_;
640: my $currentstring = '';
641: if ($target eq 'web') {
642: $currentstring .= $token->[2];
643: } elsif ($target eq 'tex') {
644: $currentstring .= "}";
645: }
646: return $currentstring;
647: }
648: #----------------------------------------------------------------------------- <q> tag
649: sub start_q {
650: my ($target,$token) = @_;
651: my $currentstring = '';
652: if ($target eq 'web') {
653: $currentstring .= $token->[4];
654: } elsif ($target eq 'tex') {
655: $currentstring .= "{ \\emph ";
656: }
657: return $currentstring;
658: }
659: sub end_q {
660: my ($target,$token) = @_;
661: my $currentstring = '';
662: if ($target eq 'web') {
663: $currentstring .= $token->[2];
664: } elsif ($target eq 'tex') {
665: $currentstring .= "}";
666: }
667: return $currentstring;
668: }
669: #----------------------------------------------------------------------------- <p> tag
670: sub start_p {
671: my ($target,$token) = @_;
672: my $currentstring = '';
673: if ($target eq 'web') {
674: $currentstring .= $token->[4];
675: } elsif ($target eq 'tex') {
676: $currentstring .= "{\\par ";
677: }
678: return $currentstring;
679: }
680: sub end_p {
681: my ($target,$token) = @_;
682: my $currentstring = '';
683: if ($target eq 'web') {
684: $currentstring .= $token->[2];
685: } elsif ($target eq 'tex') {
686: $currentstring .= " }";
687: }
688: return $currentstring;
689: }
690: #---------------------------------------------------------------------------- <br> tag
691: sub start_br {
692: my ($target,$token) = @_;
693: my $currentstring = '';
694: if ($target eq 'web') {
695: $currentstring .= $token->[4];
696: } elsif ($target eq 'tex') {
697: $currentstring .= "\\\\";
698: }
699: return $currentstring;
700: }
701: sub end_br {
702: my ($target,$token) = @_;
703: my $currentstring = '';
704: if ($target eq 'web') {
705: $currentstring .= $token->[2];
706: }
707: return $currentstring;
708: }
709: #--------------------------------------------------------------------------- <big> tag
710: sub start_big {
711: my ($target,$token) = @_;
712: my $currentstring = '';
713: if ($target eq 'web') {
714: $currentstring .= $token->[4];
715: } elsif ($target eq 'tex') {
716: $currentstring .= "{\\large ";
717: }
718: return $currentstring;
719: }
720: sub end_big {
721: my ($target,$token) = @_;
722: my $currentstring = '';
723: if ($target eq 'web') {
724: $currentstring .= $token->[2];
725: } elsif ($target eq 'tex') {
726: $currentstring .= " }";
727: }
728: return $currentstring;
729: }
730: #------------------------------------------------------------------------- <small> tag
731: sub start_small {
732: my ($target,$token) = @_;
733: my $currentstring = '';
734: if ($target eq 'web') {
735: $currentstring .= $token->[4];
736: } elsif ($target eq 'tex') {
737: $currentstring .= "{\\footnotesize ";
738: }
739: return $currentstring;
740: }
741: sub end_small {
742: my ($target,$token) = @_;
743: my $currentstring = '';
744: if ($target eq 'web') {
745: $currentstring .= $token->[2];
746: } elsif ($target eq 'tex') {
747: $currentstring .= " }";
748: }
749: return $currentstring;
750: }
751: #---------------------------------------------------------------------- <basefont> tag
752: sub start_basefont {
1.14 ! albertel 753: my ($target,$token) = @_;
! 754: my $currentstring = '';
! 755: if ($target eq 'web') {
! 756: $currentstring = $token->[4];
! 757: }
! 758: return $currentstring;
! 759: }
! 760: sub end_basefont {
! 761: my ($target,$token) = @_;
! 762: my $currentstring = '';
! 763: if ($target eq 'web') {
! 764: $currentstring = $token->[4];
! 765: }
! 766: return $currentstring;
! 767: }
1.1 sakharuk 768: #-------------------------------------------------------------------------- <font> tag
769: sub start_font {
770: my ($target,$token) = @_;
771: my $currentstring = '';
772: if ($target eq 'web') {
773: $currentstring = $token->[4];
774: }
775: return $currentstring;
776: }
777: sub end_font {
778: my ($target,$token) = @_;
779: my $currentstring = '';
780: if ($target eq 'web') {
781: $currentstring = $token->[2];
782: }
783: return $currentstring;
784: }
785: #------------------------------------------------------------------------ <strike> tag
786: sub start_strike {
787: my ($target,$token) = @_;
788: my $currentstring = '';
789: if ($target eq 'web') {
790: $currentstring .= $token->[4];
791: } elsif ($target eq 'tex') {
792: $currentstring .= "{\\underline ";
793: }
794: return $currentstring;
795: }
796: sub end_strike {
797: my ($target,$token) = @_;
798: my $currentstring = '';
799: if ($target eq 'web') {
800: $currentstring .= $token->[2];
801: } elsif ($target eq 'tex') {
802: $currentstring .= " }";
803: }
804: return $currentstring;
805: }
806: #----------------------------------------------------------------------------- <s> tag
807: sub start_s {
808: my ($target,$token) = @_;
809: my $currentstring = '';
810: if ($target eq 'web') {
811: $currentstring .= $token->[4];
812: } elsif ($target eq 'tex') {
813: $currentstring .= "{\\underline ";
814: }
815: return $currentstring;
816: }
817: sub end_s {
818: my ($target,$token) = @_;
819: my $currentstring = '';
820: if ($target eq 'web') {
821: $currentstring .= $token->[2];
822: } elsif ($target eq 'tex') {
823: $currentstring .= " }";
824: }
825: return $currentstring;
826: }
827: #--------------------------------------------------------------------------- <sub> tag
828: sub start_sub {
829: my ($target,$token) = @_;
830: my $currentstring = '';
831: if ($target eq 'web') {
832: $currentstring .= $token->[4];
833: } elsif ($target eq 'tex') {
834: $currentstring .= "\$_{ ";
835: }
836: return $currentstring;
837: }
838: sub end_sub {
839: my ($target,$token) = @_;
840: my $currentstring = '';
841: if ($target eq 'web') {
842: $currentstring .= $token->[2];
843: } elsif ($target eq 'tex') {
844: $currentstring .= " }\$";
845: }
846: return $currentstring;
847: }
848: #--------------------------------------------------------------------------- <sup> tag
849: sub start_sup {
850: my ($target,$token) = @_;
851: my $currentstring = '';
852: if ($target eq 'web') {
853: $currentstring .= $token->[4];
854: } elsif ($target eq 'tex') {
855: $currentstring .= "\$^{ ";
856: }
857: return $currentstring;
858: }
859: sub end_sup {
860: my ($target,$token) = @_;
861: my $currentstring = '';
862: if ($target eq 'web') {
863: $currentstring .= $token->[2];
864: } elsif ($target eq 'tex') {
865: $currentstring .= " }\$";
866: }
867: return $currentstring;
868: }
869: #---------------------------------------------------------------------------- <hr> tag
870: sub start_hr {
871: my ($target,$token) = @_;
872: my $currentstring = '';
873: if ($target eq 'web') {
874: $currentstring .= $token->[4];
875: } elsif ($target eq 'tex') {
876: $currentstring .= "\\hline ";
1.6 sakharuk 877: }
878: return $currentstring;
879: }
880: sub end_hr {
881: my ($target,$token) = @_;
882: my $currentstring = '';
883: if ($target eq 'web') {
884: $currentstring .= $token->[2];
885: } elsif ($target eq 'tex') {
1.1 sakharuk 886: }
887: return $currentstring;
888: }
889: #----------------------------------------------------------------------------- <a> tag
890: sub start_a {
891: my ($target,$token) = @_;
892: my $currentstring = '';
893: if ($target eq 'web') {
894: $currentstring .= $token->[4];
895: } elsif ($target eq 'tex') {
896: }
897: return $currentstring;
898: }
899: sub end_a {
900: my ($target,$token,$stackref) = @_;
901: my $currentstring = '';
902: if ($target eq 'web') {
903: $currentstring .= $token->[2];
904: } elsif ($target eq 'tex') {
905: my $tempor_var = $stackref->[$#$stackref];
906: if (index($tempor_var,'name') != -1 ) {
907: $tempor_var =~ s/name=([^,]*),/$1/g;
908: $currentstring .= " \\label{$tempor_var}";
909: } elsif (index($tempor_var,'href') != -1 ) {
910: $tempor_var =~ s/href=([^,]*),/$1/g;
911: $currentstring .= " \\ref{$tempor_var}";
912: }
913: }
914: return $currentstring;
915: }
916: #---------------------------------------------------------------------------- <li> tag
917: sub start_li {
918: my ($target,$token,$stackref) = @_;
919: my $currentstring = '';
920: if ($target eq 'web') {
921: $currentstring = $token->[4];
922: } elsif ($target eq 'tex') {
923: my $tempor_var = $stackref->[$#$stackref-1];
924: if (index($tempor_var,'circle') != -1 ) {
925: $currentstring .= " \\item[o] ";
926: } elsif (index($tempor_var,'square') != -1 ) {
927: $currentstring .= " \\item[$\Box$] ";
928: } else {
929: $currentstring .= " \\item ";
930: }
931: }
932: return $currentstring;
933: }
934: sub end_li {
935: my ($target,$token) = @_;
936: my $currentstring = '';
937: if ($target eq 'web') {
938: $currentstring = $token->[2];
939: }
940: return $currentstring;
941: }
942: #----------------------------------------------------------------------------- <u> tag
943: sub start_u {
944: my ($target,$token) = @_;
945: my $currentstring = '';
946: if ($target eq 'web') {
947: $currentstring .= $token->[4];
948: } elsif ($target eq 'tex') {
949: $currentstring .= "{\\underline ";
950: }
951: return $currentstring;
952: }
953: sub end_u {
954: my ($target,$token) = @_;
955: my $currentstring = '';
956: if ($target eq 'web') {
957: $currentstring .= $token->[2];
958: } elsif ($target eq 'tex') {
959: $currentstring .= " }";
960: }
961: return $currentstring;
962: }
963: #---------------------------------------------------------------------------- <ul> tag
964: sub start_ul {
965: my ($target,$token) = @_;
966: my $currentstring = '';
967: if ($target eq 'web') {
968: $currentstring = $token->[4];
969: } elsif ($target eq 'tex') {
970: $currentstring = " \\begin{itemize} ";
971: }
972: return $currentstring;
973: }
974: sub end_ul {
975: my ($target,$token) = @_;
976: my $currentstring = '';
977: if ($target eq 'web') {
978: $currentstring = $token->[2];
979: } elsif ($target eq 'tex') {
980: $currentstring = " \\end{itemize}";
981: }
982: return $currentstring;
983: }
984: #-------------------------------------------------------------------------- <menu> tag
985: sub start_menu {
986: my ($target,$token) = @_;
987: my $currentstring = '';
988: if ($target eq 'web') {
989: $currentstring = $token->[4];
990: } elsif ($target eq 'tex') {
991: $currentstring = " \\begin{itemize} ";
992: }
993: return $currentstring;
994: }
995: sub end_menu {
996: my ($target,$token) = @_;
997: my $currentstring = '';
998: if ($target eq 'web') {
999: $currentstring = $token->[2];
1000: } elsif ($target eq 'tex') {
1001: $currentstring = " \\end{itemize}";
1002: }
1003: return $currentstring;
1004: }
1005: #--------------------------------------------------------------------------- <dir> tag
1006: sub start_dir {
1007: my ($target,$token) = @_;
1008: my $currentstring = '';
1009: if ($target eq 'web') {
1010: $currentstring = $token->[4];
1011: } elsif ($target eq 'tex') {
1012: $currentstring = " \\begin{itemize} ";
1013: }
1014: return $currentstring;
1015: }
1016: sub end_dir {
1017: my ($target,$token) = @_;
1018: my $currentstring = '';
1019: if ($target eq 'web') {
1020: $currentstring = $token->[2];
1021: } elsif ($target eq 'tex') {
1022: $currentstring = " \\end{itemize}";
1023: }
1024: return $currentstring;
1025: }
1026: #---------------------------------------------------------------------------- <ol> tag
1027: sub start_ol {
1028: my ($target,$token) = @_;
1029: my $currentstring = '';
1030: if ($target eq 'web') {
1031: $currentstring = $token->[4];
1032: } elsif ($target eq 'tex') {
1033: $currentstring = " \\begin{enumerate} ";
1034: }
1035: return $currentstring;
1036: }
1037: sub end_ol {
1038: my ($target,$token) = @_;
1039: my $currentstring = '';
1040: if ($target eq 'web') {
1041: $currentstring = $token->[2];
1042: } elsif ($target eq 'tex') {
1043: $currentstring = " \\end{enumerate}";
1044: }
1045: return $currentstring;
1046: }
1047: #---------------------------------------------------------------------------- <dl> tag
1048: sub start_dl {
1049: my ($target,$token) = @_;
1050: my $currentstring = '';
1051: if ($target eq 'web') {
1052: $currentstring = $token->[4];
1053: } elsif ($target eq 'tex') {
1054: $currentstring = " \\begin{description} ";
1055: }
1056: return $currentstring;
1057: }
1058: sub end_dl {
1059: my ($target,$token) = @_;
1060: my $currentstring = '';
1061: if ($target eq 'web') {
1062: $currentstring = $token->[2];
1063: } elsif ($target eq 'tex') {
1064: $currentstring = " \\end{description}";
1065: }
1066: return $currentstring;
1067: }
1068: #---------------------------------------------------------------------------- <dt> tag
1069: sub start_dt {
1070: my ($target,$token) = @_;
1071: my $currentstring = '';
1072: if ($target eq 'web') {
1073: $currentstring = $token->[4];
1074: } elsif ($target eq 'tex') {
1075: $currentstring = "\\item[ ";
1076: }
1077: return $currentstring;
1078: }
1079: sub end_dt {
1080: my ($target,$token) = @_;
1081: my $currentstring = '';
1082: if ($target eq 'web') {
1083: $currentstring = $token->[2];
1084: } elsif ($target eq 'tex') {
1085: $currentstring = "]";
1086: }
1087: return $currentstring;
1088: }
1089: #---------------------------------------------------------------------------- <dd> tag
1090: sub start_dd {
1091: my ($target,$token) = @_;
1092: my $currentstring = '';
1093: if ($target eq 'web') {
1094: $currentstring = $token->[4];
1095: }
1096: return $currentstring;
1097: }
1098: sub end_dd {
1099: my ($target,$token) = @_;
1100: my $currentstring = '';
1101: if ($target eq 'web') {
1102: $currentstring = $token->[2];
1103: }
1104: return $currentstring;
1105: }
1106: #------------------------------------------------------------------------- <table> tag
1107: sub start_table {
1108: my ($target,$token) = @_;
1109: my $currentstring = '';
1110: if ($target eq 'web') {
1111: $currentstring = $token->[4];
1112: } elsif ($target eq 'tex') {
1113: $currentstring = " \\begin{tabular} ";
1114: }
1115: return $currentstring;
1116: }
1117: sub end_table {
1118: my ($target,$token) = @_;
1119: my $currentstring = '';
1120: if ($target eq 'web') {
1121: $currentstring = $token->[2];
1122: } elsif ($target eq 'tex') {
1123: $currentstring = " \\end{tabular}";
1124: }
1125: return $currentstring;
1126: }
1.10 www 1127:
1128: # -------------------------------------------------------------------------- <img> tag
1129:
1130: sub start_img {
1131: my ($target,$token) = @_;
1132: $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=
1133: $token->[2]->{'src'};
1134: my $currentstring = '';
1135: if ($target eq 'web') {
1136: $currentstring = $token->[4];
1137: } elsif ($target eq 'tex') {
1138: $currentstring = " \\begin{figure} ";
1139: }
1140: return $currentstring;
1141: }
1142: sub end_img {
1143: my ($target,$token) = @_;
1144: my $currentstring = '';
1145: if ($target eq 'web') {
1146: $currentstring = $token->[2];
1147: } elsif ($target eq 'tex') {
1148: $currentstring = " \\end{figure}";
1149: }
1150: return $currentstring;
1151: }
1152: # ----------------------------------------------------------------------- <applet> tag
1153:
1154: sub start_applet {
1155: my ($target,$token) = @_;
1156: $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=
1157: $token->[2]->{'code'};
1158: $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=
1159: $token->[2]->{'archive'};
1160: my $currentstring = '';
1161: if ($target eq 'web') {
1162: $currentstring = $token->[4];
1163: } elsif ($target eq 'tex') {
1164: $currentstring = " \\begin{figure} ";
1165: }
1166: return $currentstring;
1167: }
1168: sub end_applet {
1169: my ($target,$token) = @_;
1170: my $currentstring = '';
1171: if ($target eq 'web') {
1172: $currentstring = $token->[2];
1173: } elsif ($target eq 'tex') {
1174: $currentstring = " \\end{figure}";
1175: }
1176: return $currentstring;
1177: }
1178:
1179: # ------------------------------------------------------------------------ <embed> tag
1180:
1181: sub start_embed {
1182: my ($target,$token) = @_;
1183: $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=
1184: $token->[2]->{'src'};
1185: my $currentstring = '';
1186: if ($target eq 'web') {
1187: $currentstring = $token->[4];
1188: } elsif ($target eq 'tex') {
1189: $currentstring = " \\begin{figure} ";
1190: }
1191: return $currentstring;
1192: }
1193: sub end_embed {
1194: my ($target,$token) = @_;
1195: my $currentstring = '';
1196: if ($target eq 'web') {
1197: $currentstring = $token->[2];
1198: } elsif ($target eq 'tex') {
1199: $currentstring = " \\end{figure}";
1200: }
1201: return $currentstring;
1202: }
1203:
1204: # ------------------------------------------------------------------------ <param> tag
1205:
1.11 www 1206: sub start_param {
1.10 www 1207: my ($target,$token) = @_;
1208: if ($token->[2]->{'name'} eq 'cabbase') {
1209: $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=
1210: $token->[2]->{'value'};
1211: }
1212: $Apache::lonxml::extlinks[$Apache::lonxml::extlinks+1]=
1213: $token->[2]->{'src'};
1214: my $currentstring = '';
1215: if ($target eq 'web') {
1216: $currentstring = $token->[4];
1217: } elsif ($target eq 'tex') {
1218: $currentstring = " \\begin{figure} ";
1219: }
1220: return $currentstring;
1221: }
1.11 www 1222: sub end_param {
1.10 www 1223: my ($target,$token) = @_;
1224: my $currentstring = '';
1225: if ($target eq 'web') {
1226: $currentstring = $token->[2];
1227: } elsif ($target eq 'tex') {
1228: $currentstring = " \\end{figure}";
1229: }
1230: return $currentstring;
1231: }
1232:
1233: # ------------------------------------------------------------------------ <allow> tag
1234:
1235: sub start_allow {
1236: my ($target,$token) = @_;
1237:
1238: $Apache::lonxml::extlinks[$Apache::lonxml::extlinks+1]=
1239: $token->[2]->{'src'};
1240:
1241: return '';
1242: }
1243: sub end_allow {
1244: return '';
1245: }
1246:
1.1 sakharuk 1247:
1248: 1;
1249: __END__
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>