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