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