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