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