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