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