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