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