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