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