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