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