Annotation of loncom/xml/londefdef.pm, revision 1.41
1.1 sakharuk 1: # The LearningOnline Network with CAPA
2: # Tags Default Definition Module
3: #
1.41 ! sakharuk 4: # $Id: londefdef.pm,v 1.40 2002/01/17 17:42:34 albertel Exp $
! 5: #
1.34 www 6: #
7: # Copyright Michigan State University Board of Trustees
8: #
9: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
10: #
11: # LON-CAPA is free software; you can redistribute it and/or modify
12: # it under the terms of the GNU General Public License as published by
13: # the Free Software Foundation; either version 2 of the License, or
14: # (at your option) any later version.
15: #
16: # LON-CAPA is distributed in the hope that it will be useful,
17: # but WITHOUT ANY WARRANTY; without even the implied warranty of
18: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19: # GNU General Public License for more details.
20: #
21: # You should have received a copy of the GNU General Public License
22: # along with LON-CAPA; if not, write to the Free Software
23: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24: #
25: # /home/httpd/html/adm/gpl.txt
26: #
27: # http://www.lon-capa.org/
28: #
29: # Copyright for TtHfunc and TtMfunc by Ian Hutchinson.
30: # TtHfunc and TtMfunc (the "Code") may be compiled and linked into
31: # binary executable programs or libraries distributed by the
32: # Michigan State University (the "Licensee"), but any binaries so
33: # distributed are hereby licensed only for use in the context
34: # of a program or computational system for which the Licensee is the
35: # primary author or distributor, and which performs substantial
36: # additional tasks beyond the translation of (La)TeX into HTML.
37: # The C source of the Code may not be distributed by the Licensee
38: # to any other parties under any circumstances.
39: #
40: #
1.1 sakharuk 41: # last modified 06/26/00 by Alexander Sakharuk
1.28 www 42: # 11/6,11/30,02/01/01,5/4 Gerd Kortemeyer
1.41 ! sakharuk 43: # 01/18 Alex Sakharuk
1.1 sakharuk 44:
1.2 albertel 45: package Apache::londefdef;
1.1 sakharuk 46:
47: use strict;
1.3 sakharuk 48: use Apache::lonxml;
1.1 sakharuk 49:
1.38 harris41 50: BEGIN {
1.15 sakharuk 51:
1.41 ! sakharuk 52: &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','frameset','pre'));
1.15 sakharuk 53:
1.3 sakharuk 54: }
1.1 sakharuk 55:
1.35 sakharuk 56: #======================= TAG SUBROUTINES =====================
1.8 sakharuk 57: #-- <output>
1.21 albertel 58: sub start_output {
59: my ($target) = @_;
1.22 albertel 60: if ($target eq 'meta') { $Apache::lonxml::metamode--; }
1.21 albertel 61: return '';
62: }
63: sub end_output {
64: my ($target) = @_;
1.22 albertel 65: if ($target eq 'meta') { $Apache::lonxml::metamode++; }
1.21 albertel 66: return '';
67: }
1.4 sakharuk 68: #-- <m> tag
1.33 albertel 69: sub start_m {
70: my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
71: my $currentstring = '';
72: if ($target eq 'web') {
73: my $inside = &Apache::lonxml::get_all_text("/m",$$parser[-1]);
74: $inside ='\\documentstyle{article}'.$inside;
1.37 albertel 75: &Apache::lonxml::debug("M is starting with:$inside:");
1.33 albertel 76: my $eval=&Apache::lonxml::get_param('eval',$parstack,$safeeval);
77: if ($eval eq 'on') {
78: $inside=&Apache::run::evaluate($inside,$safeeval,$$parstack[-1]);
79: #&Apache::lonxml::debug("M is evaulated to:$inside:");
80: }
81: $currentstring = &Apache::lontexconvert::converted(\$inside);
1.37 albertel 82: if ($Apache::lontexconvert::errorstring) {
83: &Apache::lonxml::warning("tth error: ".
84: $Apache::lontexconvert::errorstring);
85: $Apache::lontexconvert::errorstring='';
86: }
1.33 albertel 87: #&Apache::lonxml::debug("M is ends with:$currentstring:");
88: } elsif ($target eq 'tex') {
89: $currentstring = "";
90: }
91: return $currentstring;
92: }
93: sub end_m {
94: my ($target,$token) = @_;
95: my $currentstring = '';
96: if ($target eq 'web') {
97: } elsif ($target eq 'tex') {
98: $currentstring = "";
99: } elsif ($target eq 'meta') {
100: }
101: return $currentstring;
102: }
1.35 sakharuk 103: #-- <html> tag
1.1 sakharuk 104: sub start_html {
105: my ($target,$token) = @_;
1.41 ! sakharuk 106: my $currentstring = '';
1.39 albertel 107: if ($ENV{'browser.mathml'}) {
108: &tth::ttminit();
109: } else {
110: &tth::tthinit();
111: }
1.1 sakharuk 112: if ($target eq 'web') {
1.29 www 113: $currentstring = &Apache::lonxml::xmlbegin().
114: &Apache::lonxml::fontsettings();
1.35 sakharuk 115: } elsif ($target eq 'tex') {
116: $currentstring .= '\documentclass[letterpaper]{article}
117: \setlength{\oddsidemargin}{-40pt}
118: \setlength{\evensidemargin}{-60pt}
119: \setlength{\topmargin}{200pt}
120: \setlength{\textwidth}{4.4in}
121: \setlength{\textheight}{6.8in}
122: \setlength{\parindent}{20pt}
123: \setlength{\marginparwidth}{90pt}
124: \setlength{\textfloatsep}{8pt plus 2.0pt minus 4.0pt}
1.41 ! sakharuk 125: \newcommand{\keephidden}[1]{}
! 126: \usepackage[dvips]{graphicx}';
1.35 sakharuk 127: }
1.1 sakharuk 128: return $currentstring;
129: }
130: sub end_html {
131: my ($target,$token) = @_;
132: my $currentstring = '';
133: if ($target eq 'web') {
1.28 www 134: $currentstring = &Apache::lonxml::xmlend();
1.35 sakharuk 135: }
1.1 sakharuk 136: return $currentstring;
137: }
1.35 sakharuk 138: #-- <head> tag
1.1 sakharuk 139: sub start_head {
140: my ($target,$token) = @_;
141: my $currentstring = '';
142: if ($target eq 'web') {
143: $currentstring = $token->[4];
144: }
145: return $currentstring;
146: }
147: sub end_head {
148: my ($target,$token) = @_;
149: my $currentstring = '';
150: if ($target eq 'web') {
1.29 www 151: $currentstring = &Apache::lonxml::registerurl().
152: $token->[2];
1.1 sakharuk 153: }
154: return $currentstring;
155: }
1.35 sakharuk 156: #-- <map> tag
1.1 sakharuk 157: sub start_map {
158: my ($target,$token) = @_;
159: my $currentstring = '';
160: if ($target eq 'web') {
161: $currentstring = $token->[4];
162: }
163: return $currentstring;
164: }
165: sub end_map {
166: my ($target,$token) = @_;
167: my $currentstring = '';
168: if ($target eq 'web') {
169: $currentstring = $token->[2];
170: }
171: return $currentstring;
172: }
1.35 sakharuk 173: #-- <select> tag
1.1 sakharuk 174: sub start_select {
175: my ($target,$token) = @_;
176: my $currentstring = '';
177: if ($target eq 'web') {
178: $currentstring = $token->[4];
179: }
180: return $currentstring;
181: }
182: sub end_select {
183: my ($target,$token) = @_;
184: my $currentstring = '';
185: if ($target eq 'web') {
186: $currentstring = $token->[2];
187: }
188: return $currentstring;
189: }
1.35 sakharuk 190: #-- <option> tag
1.1 sakharuk 191: sub start_option {
192: my ($target,$token) = @_;
193: my $currentstring = '';
194: if ($target eq 'web') {
195: $currentstring = $token->[4];
196: }
197: return $currentstring;
198: }
199: sub end_option {
200: my ($target,$token) = @_;
201: my $currentstring = '';
202: if ($target eq 'web') {
203: $currentstring = $token->[2];
204: }
205: return $currentstring;
206: }
1.35 sakharuk 207: #-- <input> tag
1.1 sakharuk 208: sub start_input {
209: my ($target,$token) = @_;
210: my $currentstring = '';
211: if ($target eq 'web') {
212: $currentstring = $token->[4];
213: }
214: return $currentstring;
215: }
216: sub end_input {
217: my ($target,$token) = @_;
218: my $currentstring = '';
219: if ($target eq 'web') {
220: $currentstring = $token->[2];
221: }
222: return $currentstring;
223: }
1.35 sakharuk 224: #-- <textarea> tag
1.1 sakharuk 225: sub start_textarea {
226: my ($target,$token) = @_;
227: my $currentstring = '';
228: if ($target eq 'web') {
229: $currentstring = $token->[4];
230: }
231: return $currentstring;
232: }
233: sub end_textarea {
234: my ($target,$token) = @_;
235: my $currentstring = '';
236: if ($target eq 'web') {
237: $currentstring = $token->[2];
238: }
239: return $currentstring;
240: }
1.35 sakharuk 241: #-- <form> tag
1.1 sakharuk 242: sub start_form {
243: my ($target,$token) = @_;
244: my $currentstring = '';
245: if ($target eq 'web') {
246: $currentstring = $token->[4];
247: }
248: return $currentstring;
249: }
250: sub end_form {
251: my ($target,$token) = @_;
252: my $currentstring = '';
253: if ($target eq 'web') {
254: $currentstring = $token->[2];
255: }
256: return $currentstring;
257: }
1.35 sakharuk 258: #-- <title> tag
1.1 sakharuk 259: sub start_title {
260: my ($target,$token) = @_;
261: my $currentstring = '';
262: if ($target eq 'web') {
263: $currentstring = $token->[4];
1.35 sakharuk 264: } elsif ($target eq 'tex') {
265: $currentstring .= '\keephidden{'
1.1 sakharuk 266: }
1.13 www 267: if ($target eq 'meta') {
268: $currentstring='<title>';
269: &start_output();
270: }
1.1 sakharuk 271: return $currentstring;
272: }
273: sub end_title {
274: my ($target,$token) = @_;
275: my $currentstring = '';
276: if ($target eq 'web') {
277: $currentstring = $token->[2];
1.35 sakharuk 278: } elsif ($target eq 'tex') {
279: $currentstring .= '}';
280: }
1.13 www 281: if ($target eq 'meta') {
282: &end_output();
283: $currentstring='</title>';
1.1 sakharuk 284: }
285: return $currentstring;
286: }
1.35 sakharuk 287: #-- <meta> tag
1.1 sakharuk 288: sub start_meta {
1.30 albertel 289: my ($target,$token,$tagstack,$parstack,$parser) = @_;
1.1 sakharuk 290: my $currentstring = '';
291: if ($target eq 'web') {
1.25 albertel 292: my $args='';
293: if ( $#$parstack > -1 ) { $args=$$parstack[$#$parstack]; }
294: if ($args eq '') {
295: &Apache::lonxml::get_all_text("/meta",$$parser[$#$parser]);
296: } else {
297: $currentstring = $token->[4];
298: }
1.12 www 299: }
300: if ($target eq 'meta') {
301: unless ($token->[2]->{'http-equiv'}) {
302: my $name=$token->[2]->{'name'};
303: $name=~tr/A-Z/a-z/;
304: $name=~s/\s/\_/g;
305: if ($name) {
306: $currentstring='<'.$name.'>'.
307: $token->[2]->{'content'}.
308: '</'.$name.'>';
309: }
310: }
1.1 sakharuk 311: }
312: return $currentstring;
313: }
1.26 albertel 314: sub end_meta {
1.30 albertel 315: my ($target,$token,$tagstack,$parstack,$parser) = @_;
1.26 albertel 316: my $currentstring = '';
317: if ($target eq 'web') {
318: my $args='';
319: if ( $#$parstack > -1 ) { $args=$$parstack[$#$parstack]; }
320: if ($args ne '') {
321: $currentstring = $token->[4];
322: }
323: }
324: return $currentstring;
325: }
1.35 sakharuk 326: #-- <body> tag
1.1 sakharuk 327: sub start_body {
1.41 ! sakharuk 328: my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
! 329: # my ($target,$token) = @_;
1.1 sakharuk 330: my $currentstring = '';
331: if ($target eq 'web') {
1.31 albertel 332: if (!$Apache::lonxml::registered) {
333: $currentstring.='<head>'.&Apache::lonxml::registerurl().'</head>';
334: }
1.32 albertel 335: my $onLoad='';
336: foreach my $key (keys(%{$token->[2]})) {
337: if ($key =~ /^onload$/i) {
338: $onLoad.=$token->[2]->{$key}.';';
339: delete($token->[2]->{$key});
340: }
341: }
342: $token->[2]->{'onLoad'}=$onLoad.&Apache::lonxml::loadevents();
343: my $onUnload='';
344: foreach my $key (keys(%{$token->[2]})) {
345: if ($key =~ /^onunload$/i) {
346: $onUnload.=$token->[2]->{$key}.';';
347: delete($token->[2]->{$key});
348: }
349: }
350: $token->[2]->{'onUnload'}=$onUnload.
351: &Apache::lonxml::unloadevents();
1.31 albertel 352:
353: $currentstring .= '<'.$token->[1];
1.37 albertel 354: foreach (keys %{$token->[2]}) {
355: $currentstring.=' '.$_.'="'.$token->[2]->{$_}.'"';
356: }
1.31 albertel 357: $currentstring.='>';
1.40 albertel 358: if ($ENV{'request.state'} ne 'published') {
359: $currentstring.=(<<EDITBUTTON);
360: <form method="post">
361: <input type="submit" name="showmode" value="Edit" />
362: </form>
363: EDITBUTTON
364: }
1.28 www 365: } elsif ($target eq 'tex') {
1.35 sakharuk 366: $currentstring = '\begin{document}';
1.1 sakharuk 367: }
368: return $currentstring;
369: }
370: sub end_body {
371: my ($target,$token) = @_;
372: my $currentstring = '';
373: if ($target eq 'web') {
374: $currentstring = $token->[2];
375: } elsif ($target eq 'tex') {
1.35 sakharuk 376: $currentstring = '\end{document}';
1.1 sakharuk 377: }
378: return $currentstring;
379: }
1.35 sakharuk 380: #-- <center> tag
1.1 sakharuk 381: sub start_center {
382: my ($target,$token) = @_;
383: my $currentstring = '';
384: if ($target eq 'web') {
385: $currentstring = $token->[4];
386: } elsif ($target eq 'tex') {
1.35 sakharuk 387: $currentstring = '\begin{center}';
1.18 sakharuk 388: } elsif ($target eq 'latexsource') {
1.35 sakharuk 389: $currentstring = '\begin{center}';
1.1 sakharuk 390: }
391: return $currentstring;
392: }
393: sub end_center {
394: my ($target,$token) = @_;
395: my $currentstring = '';
396: if ($target eq 'web') {
397: $currentstring = $token->[2];
398: } elsif ($target eq 'tex') {
1.35 sakharuk 399: $currentstring = '\end{center}';
1.18 sakharuk 400: } elsif ($target eq 'latexsource') {
1.35 sakharuk 401: $currentstring = '\end{center}';
1.1 sakharuk 402: }
403: return $currentstring;
404: }
1.35 sakharuk 405: #-- <b> tag
1.1 sakharuk 406: sub start_b {
407: my ($target,$token) = @_;
408: my $currentstring = '';
409: if ($target eq 'web') {
410: $currentstring = $token->[4];
411: } elsif ($target eq 'tex') {
1.35 sakharuk 412: $currentstring = '\textbf{';
1.18 sakharuk 413: } elsif ($target eq 'latexsource') {
1.35 sakharuk 414: $currentstring = '\textbf{';
1.1 sakharuk 415: }
416: return $currentstring;
417: }
418: sub end_b {
419: my ($target,$token) = @_;
420: my $currentstring = '';
421: if ($target eq 'web') {
422: $currentstring = $token->[2];
423: } elsif ($target eq 'tex') {
1.35 sakharuk 424: $currentstring = '}';
425:
1.18 sakharuk 426: } elsif ($target eq 'latexsource') {
1.35 sakharuk 427: $currentstring = '}';
1.1 sakharuk 428: }
429: return $currentstring;
430: }
1.35 sakharuk 431: #-- <strong> tag
1.1 sakharuk 432: sub start_strong {
433: my ($target,$token) = @_;
434: my $currentstring = '';
435: if ($target eq 'web') {
436: $currentstring = $token->[4];
437: } elsif ($target eq 'tex') {
1.35 sakharuk 438: $currentstring = '\textbf{';
1.18 sakharuk 439: } elsif ($target eq 'latexsource') {
1.35 sakharuk 440: $currentstring = '\textbf{';
1.1 sakharuk 441: }
442: return $currentstring;
443: }
444: sub end_strong {
445: my ($target,$token) = @_;
446: my $currentstring = '';
447: if ($target eq 'web') {
448:
449: $currentstring = $token->[2];
450: } elsif ($target eq 'tex') {
1.35 sakharuk 451: $currentstring = '}';
1.18 sakharuk 452: } elsif ($target eq 'latexsource') {
1.35 sakharuk 453: $currentstring = '}';
1.1 sakharuk 454: }
455: return $currentstring;
456: }
1.35 sakharuk 457: #-- <h1> tag
1.1 sakharuk 458: sub start_h1 {
459: my ($target,$token) = @_;
460: my $currentstring = '';
461: if ($target eq 'web') {
462: $currentstring .= $token->[4];
463: } elsif ($target eq 'tex') {
1.35 sakharuk 464: $currentstring .= '\large{\textbf{';
1.13 www 465: } elsif ($target eq 'meta') {
466: $currentstring='<subject>';
467: &start_output();
468: }
1.1 sakharuk 469: return $currentstring;
470: }
471: sub end_h1 {
472: my ($target,$token) = @_;
473: my $currentstring = '';
474: if ($target eq 'web') {
475: $currentstring .= $token->[2];
476: } elsif ($target eq 'tex') {
1.35 sakharuk 477: $currentstring .= '}}';
1.13 www 478: } elsif ($target eq 'meta') {
479: &end_output();
480: $currentstring='</subject>';
481: }
1.1 sakharuk 482: return $currentstring;
483: }
1.35 sakharuk 484: #-- <h2> tag
1.1 sakharuk 485: sub start_h2 {
486: my ($target,$token) = @_;
487: my $currentstring = '';
488: if ($target eq 'web') {
489: $currentstring .= $token->[4];
490: } elsif ($target eq 'tex') {
1.35 sakharuk 491: $currentstring .= '\large{\textbf{';
1.1 sakharuk 492: }
493: return $currentstring;
494: }
495: sub end_h2 {
496: my ($target,$token) = @_;
497: my $currentstring = '';
498: if ($target eq 'web') {
499: $currentstring .= $token->[2];
500: } elsif ($target eq 'tex') {
1.35 sakharuk 501: $currentstring .= '}}';
1.1 sakharuk 502: }
503: return $currentstring;
504: }
1.35 sakharuk 505: #-- <h3> tag
1.1 sakharuk 506: sub start_h3 {
507: my ($target,$token) = @_;
508: my $currentstring = '';
509: if ($target eq 'web') {
510: $currentstring .= $token->[4];
511: } elsif ($target eq 'tex') {
1.35 sakharuk 512: $currentstring .= '\large{\textbf{';
1.1 sakharuk 513: }
514: return $currentstring;
515: }
516: sub end_h3 {
517: my ($target,$token) = @_;
518: my $currentstring = '';
519: if ($target eq 'web') {
520: $currentstring .= $token->[2];
521: } elsif ($target eq 'tex') {
1.35 sakharuk 522: $currentstring .= '}}';
1.1 sakharuk 523: }
524: return $currentstring;
525: }
1.35 sakharuk 526: #-- <h4> tag
1.1 sakharuk 527: sub start_h4 {
528: my ($target,$token) = @_;
529: my $currentstring = '';
530: if ($target eq 'web') {
531: $currentstring .= $token->[4];
532: } elsif ($target eq 'tex') {
1.41 ! sakharuk 533: $currentstring .= '\large{\textbf{';
1.1 sakharuk 534: }
535: return $currentstring;
536: }
537: sub end_h4 {
538: my ($target,$token) = @_;
539: my $currentstring = '';
540: if ($target eq 'web') {
541: $currentstring .= $token->[2];
542: } elsif ($target eq 'tex') {
1.35 sakharuk 543: $currentstring .= '}}';
1.1 sakharuk 544: }
545: return $currentstring;
546: }
1.35 sakharuk 547: #-- <h5> tag
1.1 sakharuk 548: sub start_h5 {
549: my ($target,$token) = @_;
550: my $currentstring = '';
551: if ($target eq 'web') {
552: $currentstring .= $token->[4];
553: } elsif ($target eq 'tex') {
1.35 sakharuk 554: $currentstring .= '\large{\textbf{';
1.1 sakharuk 555: }
556: return $currentstring;
557: }
558: sub end_h5 {
559: my ($target,$token) = @_;
560: my $currentstring = '';
561: if ($target eq 'web') {
562: $currentstring .= $token->[2];
563: } elsif ($target eq 'tex') {
1.35 sakharuk 564: $currentstring .= '}}';
1.1 sakharuk 565: }
566: return $currentstring;
567: }
1.35 sakharuk 568: #-- <h6> tag
1.1 sakharuk 569: sub start_h6 {
570: my ($target,$token) = @_;
571: my $currentstring = '';
572: if ($target eq 'web') {
573: $currentstring .= $token->[4];
574: } elsif ($target eq 'tex') {
1.35 sakharuk 575: $currentstring .= '\large{\textbf{';
1.1 sakharuk 576: }
577: return $currentstring;
578: }
579: sub end_h6 {
580: my ($target,$token) = @_;
581: my $currentstring = '';
582: if ($target eq 'web') {
583: $currentstring .= $token->[2];
584: } elsif ($target eq 'tex') {
1.35 sakharuk 585: $currentstring .= '}}';
1.1 sakharuk 586: }
587: return $currentstring;
588: }
1.35 sakharuk 589: #--- <cite> tag
1.1 sakharuk 590: sub start_cite {
591: my ($target,$token) = @_;
592: my $currentstring = '';
593: if ($target eq 'web') {
594: $currentstring .= $token->[4];
595: } elsif ($target eq 'tex') {
1.18 sakharuk 596: $currentstring .= "\\textit{";
597: } elsif ($target eq 'latexsource') {
598: $currentstring .= "\\textit{";
1.1 sakharuk 599: }
600: return $currentstring;
601: }
602: sub end_cite {
603: my ($target,$token) = @_;
604: my $currentstring = '';
605: if ($target eq 'web') {
606: $currentstring .= $token->[2];
607: } elsif ($target eq 'tex') {
608: $currentstring .= "}";
1.18 sakharuk 609: } elsif ($target eq 'latexsource') {
610: $currentstring .= "}";
1.1 sakharuk 611: }
612: return $currentstring;
613: }
1.35 sakharuk 614: #-- <i> tag
1.1 sakharuk 615: sub start_i {
616: my ($target,$token) = @_;
617: my $currentstring = '';
618: if ($target eq 'web') {
619: $currentstring .= $token->[4];
620: } elsif ($target eq 'tex') {
1.35 sakharuk 621: $currentstring .= '\textit{';
1.18 sakharuk 622: } elsif ($target eq 'latexsource') {
1.35 sakharuk 623: $currentstring .= '\textit{';
1.1 sakharuk 624: }
625: return $currentstring;
626: }
627: sub end_i {
628: my ($target,$token) = @_;
629: my $currentstring = '';
630: if ($target eq 'web') {
631: $currentstring .= $token->[2];
632: } elsif ($target eq 'tex') {
1.35 sakharuk 633: $currentstring .= '}';
1.18 sakharuk 634: } elsif ($target eq 'latexsource') {
1.35 sakharuk 635: $currentstring .= '}';
1.1 sakharuk 636: }
637: return $currentstring;
638: }
1.35 sakharuk 639: #-- <address> tag
1.1 sakharuk 640: sub start_address {
641: my ($target,$token) = @_;
642: my $currentstring = '';
643: if ($target eq 'web') {
644: $currentstring .= $token->[4];
645: } elsif ($target eq 'tex') {
1.18 sakharuk 646: $currentstring .= "\\textit{";
647: } elsif ($target eq 'latexsource') {
648: $currentstring .= "\\textit{";
1.1 sakharuk 649: }
650: return $currentstring;
651: }
652: sub end_address {
653: my ($target,$token) = @_;
654: my $currentstring = '';
655: if ($target eq 'web') {
656: $currentstring .= $token->[2];
657: } elsif ($target eq 'tex') {
658: $currentstring .= "}";
1.18 sakharuk 659: } elsif ($target eq 'latexsource') {
660: $currentstring .= "}";
1.1 sakharuk 661: }
662: return $currentstring;
663: }
1.35 sakharuk 664: #-- <dfn> tag
1.1 sakharuk 665: sub start_dfn {
666: my ($target,$token) = @_;
667: my $currentstring = '';
668: if ($target eq 'web') {
669: $currentstring .= $token->[4];
670: } elsif ($target eq 'tex') {
1.18 sakharuk 671: $currentstring .= "\\textit{";
672: } elsif ($target eq 'latexsource') {
673: $currentstring .= "\\textit{";
1.1 sakharuk 674: }
675: return $currentstring;
676: }
677: sub end_dfn {
678: my ($target,$token) = @_;
679: my $currentstring = '';
680: if ($target eq 'web') {
681: $currentstring .= $token->[2];
682: } elsif ($target eq 'tex') {
683: $currentstring .= "}";
1.18 sakharuk 684: } elsif ($target eq 'latexsource') {
685: $currentstring .= "}";
1.1 sakharuk 686: }
687: return $currentstring;
688: }
1.35 sakharuk 689: #-- <tt> tag
1.1 sakharuk 690: sub start_tt {
691: my ($target,$token) = @_;
692: my $currentstring = '';
693: if ($target eq 'web') {
694: $currentstring .= $token->[4];
695: } elsif ($target eq 'tex') {
1.35 sakharuk 696: $currentstring .= '\texttt{';
1.18 sakharuk 697: } elsif ($target eq 'latexsource') {
1.35 sakharuk 698: $currentstring .= '\texttt{';
1.1 sakharuk 699: }
700: return $currentstring;
701: }
702: sub end_tt {
703: my ($target,$token) = @_;
704: my $currentstring = '';
705: if ($target eq 'web') {
706: $currentstring .= $token->[2];
707: } elsif ($target eq 'tex') {
1.35 sakharuk 708: $currentstring .= '}';
1.18 sakharuk 709: } elsif ($target eq 'latexsource') {
1.35 sakharuk 710: $currentstring .= '}';
1.18 sakharuk 711: }
1.1 sakharuk 712: return $currentstring;
713: }
1.35 sakharuk 714: #-- <kbd> tag
1.1 sakharuk 715: sub start_kbd {
716: my ($target,$token) = @_;
717: my $currentstring = '';
718: if ($target eq 'web') {
719: $currentstring .= $token->[4];
720: } elsif ($target eq 'tex') {
1.18 sakharuk 721: $currentstring .= "\\texttt";
722: } elsif ($target eq 'latexsource') {
723: $currentstring .= "\\texttt{";
1.1 sakharuk 724: }
725: return $currentstring;
726: }
727: sub end_kbd {
728: my ($target,$token) = @_;
729: my $currentstring = '';
730: if ($target eq 'web') {
731: $currentstring .= $token->[2];
732: } elsif ($target eq 'tex') {
733: $currentstring .= "}";
1.18 sakharuk 734: } elsif ($target eq 'latexsource') {
735: $currentstring .= "}";
1.1 sakharuk 736: }
737: return $currentstring;
738: }
1.35 sakharuk 739: #-- <code> tag
1.1 sakharuk 740: sub start_code {
741: my ($target,$token) = @_;
742: my $currentstring = '';
743: if ($target eq 'web') {
744: $currentstring .= $token->[4];
745: } elsif ($target eq 'tex') {
1.35 sakharuk 746: $currentstring .= '\texttt{';
1.1 sakharuk 747: }
748: return $currentstring;
749: }
750: sub end_code {
751: my ($target,$token) = @_;
752: my $currentstring = '';
753: if ($target eq 'web') {
754: $currentstring .= $token->[2];
755: } elsif ($target eq 'tex') {
1.35 sakharuk 756: $currentstring .= '}';
1.1 sakharuk 757: }
758: return $currentstring;
759: }
1.35 sakharuk 760: #-- <em> tag
1.1 sakharuk 761: sub start_em {
762: my ($target,$token) = @_;
763: my $currentstring = '';
764: if ($target eq 'web') {
765: $currentstring .= $token->[4];
766: } elsif ($target eq 'tex') {
1.35 sakharuk 767: $currentstring .= '\emph{';
1.18 sakharuk 768: } elsif ($target eq 'latexsource') {
1.35 sakharuk 769: $currentstring .= '\emph{';
1.1 sakharuk 770: }
771: return $currentstring;
772: }
773: sub end_em {
774: my ($target,$token) = @_;
775: my $currentstring = '';
776: if ($target eq 'web') {
777: $currentstring .= $token->[2];
778: } elsif ($target eq 'tex') {
1.35 sakharuk 779: $currentstring .= '}';
1.18 sakharuk 780: } elsif ($target eq 'latexsource') {
1.35 sakharuk 781: $currentstring .= '}';
1.18 sakharuk 782: }
1.1 sakharuk 783: return $currentstring;
784: }
1.35 sakharuk 785: #-- <q> tag
1.1 sakharuk 786: sub start_q {
787: my ($target,$token) = @_;
788: my $currentstring = '';
789: if ($target eq 'web') {
790: $currentstring .= $token->[4];
791: } elsif ($target eq 'tex') {
1.18 sakharuk 792: $currentstring .= "\\emph{";
793: } elsif ($target eq 'latexsource') {
794: $currentstring .= "\\emph{";
795: }
1.1 sakharuk 796: return $currentstring;
797: }
798: sub end_q {
799: my ($target,$token) = @_;
800: my $currentstring = '';
801: if ($target eq 'web') {
802: $currentstring .= $token->[2];
803: } elsif ($target eq 'tex') {
804: $currentstring .= "}";
1.18 sakharuk 805: } elsif ($target eq 'latexsource') {
806: $currentstring .= "}";
807: }
1.1 sakharuk 808: return $currentstring;
809: }
1.35 sakharuk 810: #-- <p> tag
1.1 sakharuk 811: sub start_p {
812: my ($target,$token) = @_;
813: my $currentstring = '';
814: if ($target eq 'web') {
815: $currentstring .= $token->[4];
816: } elsif ($target eq 'tex') {
1.35 sakharuk 817: $currentstring .= '{\par ';
1.18 sakharuk 818: } elsif ($target eq 'latexsource') {
1.35 sakharuk 819: $currentstring .= '{\par ';
1.1 sakharuk 820: }
821: return $currentstring;
822: }
823: sub end_p {
824: my ($target,$token) = @_;
825: my $currentstring = '';
826: if ($target eq 'web') {
827: $currentstring .= $token->[2];
828: } elsif ($target eq 'tex') {
1.35 sakharuk 829: $currentstring .= '}';
1.18 sakharuk 830: } elsif ($target eq 'latexsource') {
1.35 sakharuk 831: $currentstring .= '}';
1.1 sakharuk 832: }
833: return $currentstring;
834: }
1.35 sakharuk 835: #-- <br> tag
1.1 sakharuk 836: sub start_br {
837: my ($target,$token) = @_;
838: my $currentstring = '';
839: if ($target eq 'web') {
840: $currentstring .= $token->[4];
841: } elsif ($target eq 'tex') {
1.41 ! sakharuk 842: $currentstring .= '\\\\';
1.18 sakharuk 843: } elsif ($target eq 'latexsource') {
1.35 sakharuk 844: $currentstring .= '\\';
1.1 sakharuk 845: }
846: return $currentstring;
847: }
848: sub end_br {
849: my ($target,$token) = @_;
850: my $currentstring = '';
851: if ($target eq 'web') {
852: $currentstring .= $token->[2];
853: }
854: return $currentstring;
855: }
1.35 sakharuk 856: #-- <big> tag
1.1 sakharuk 857: sub start_big {
858: my ($target,$token) = @_;
859: my $currentstring = '';
860: if ($target eq 'web') {
861: $currentstring .= $token->[4];
862: } elsif ($target eq 'tex') {
1.36 albertel 863: $currentstring .= '\large{';
1.18 sakharuk 864: } elsif ($target eq 'latexsource') {
1.41 ! sakharuk 865: $currentstring .= '{\Large ';
1.18 sakharuk 866: }
1.1 sakharuk 867: return $currentstring;
868: }
869: sub end_big {
870: my ($target,$token) = @_;
871: my $currentstring = '';
872: if ($target eq 'web') {
873: $currentstring .= $token->[2];
874: } elsif ($target eq 'tex') {
1.35 sakharuk 875: $currentstring .= '}';
1.18 sakharuk 876: } elsif ($target eq 'latexsource') {
1.35 sakharuk 877: $currentstring .= '}';
1.1 sakharuk 878: }
879: return $currentstring;
880: }
1.35 sakharuk 881: #-- <small> tag
1.1 sakharuk 882: sub start_small {
883: my ($target,$token) = @_;
884: my $currentstring = '';
885: if ($target eq 'web') {
886: $currentstring .= $token->[4];
887: } elsif ($target eq 'tex') {
1.41 ! sakharuk 888: $currentstring .= '{\footnotesize ';
1.18 sakharuk 889: } elsif ($target eq 'latexsource') {
1.41 ! sakharuk 890: $currentstring .= '{\footnotesize ';
1.1 sakharuk 891: }
892: return $currentstring;
893: }
894: sub end_small {
895: my ($target,$token) = @_;
896: my $currentstring = '';
897: if ($target eq 'web') {
898: $currentstring .= $token->[2];
899: } elsif ($target eq 'tex') {
1.35 sakharuk 900: $currentstring .= '}';
1.18 sakharuk 901: } elsif ($target eq 'latexsource') {
1.35 sakharuk 902: $currentstring .= '}';
1.1 sakharuk 903: }
904: return $currentstring;
905: }
1.35 sakharuk 906: #-- <basefont> tag
1.1 sakharuk 907: sub start_basefont {
1.14 albertel 908: my ($target,$token) = @_;
909: my $currentstring = '';
910: if ($target eq 'web') {
911: $currentstring = $token->[4];
912: }
913: return $currentstring;
914: }
915: sub end_basefont {
916: my ($target,$token) = @_;
917: my $currentstring = '';
918: if ($target eq 'web') {
919: $currentstring = $token->[4];
920: }
921: return $currentstring;
922: }
1.35 sakharuk 923: #-- <font> tag
1.1 sakharuk 924: sub start_font {
925: my ($target,$token) = @_;
926: my $currentstring = '';
927: if ($target eq 'web') {
928: $currentstring = $token->[4];
929: }
930: return $currentstring;
931: }
932: sub end_font {
933: my ($target,$token) = @_;
934: my $currentstring = '';
935: if ($target eq 'web') {
936: $currentstring = $token->[2];
937: }
938: return $currentstring;
939: }
1.35 sakharuk 940: #-- <strike> tag
1.1 sakharuk 941: sub start_strike {
942: my ($target,$token) = @_;
943: my $currentstring = '';
944: if ($target eq 'web') {
945: $currentstring .= $token->[4];
946: } elsif ($target eq 'tex') {
947: $currentstring .= "{\\underline ";
948: }
949: return $currentstring;
950: }
951: sub end_strike {
952: my ($target,$token) = @_;
953: my $currentstring = '';
954: if ($target eq 'web') {
955: $currentstring .= $token->[2];
956: } elsif ($target eq 'tex') {
957: $currentstring .= " }";
958: }
959: return $currentstring;
960: }
1.35 sakharuk 961: #-- <s> tag
1.1 sakharuk 962: sub start_s {
963: my ($target,$token) = @_;
964: my $currentstring = '';
965: if ($target eq 'web') {
966: $currentstring .= $token->[4];
967: } elsif ($target eq 'tex') {
968: $currentstring .= "{\\underline ";
969: }
970: return $currentstring;
971: }
972: sub end_s {
973: my ($target,$token) = @_;
974: my $currentstring = '';
975: if ($target eq 'web') {
976: $currentstring .= $token->[2];
977: } elsif ($target eq 'tex') {
978: $currentstring .= " }";
979: }
980: return $currentstring;
981: }
1.35 sakharuk 982: #-- <sub> tag
1.1 sakharuk 983: sub start_sub {
984: my ($target,$token) = @_;
985: my $currentstring = '';
986: if ($target eq 'web') {
987: $currentstring .= $token->[4];
988: } elsif ($target eq 'tex') {
989: $currentstring .= "\$_{ ";
990: }
991: return $currentstring;
992: }
993: sub end_sub {
994: my ($target,$token) = @_;
995: my $currentstring = '';
996: if ($target eq 'web') {
997: $currentstring .= $token->[2];
998: } elsif ($target eq 'tex') {
999: $currentstring .= " }\$";
1000: }
1001: return $currentstring;
1002: }
1.35 sakharuk 1003: #-- <sup> tag
1.1 sakharuk 1004: sub start_sup {
1005: my ($target,$token) = @_;
1006: my $currentstring = '';
1007: if ($target eq 'web') {
1008: $currentstring .= $token->[4];
1009: } elsif ($target eq 'tex') {
1010: $currentstring .= "\$^{ ";
1011: }
1012: return $currentstring;
1013: }
1014: sub end_sup {
1015: my ($target,$token) = @_;
1016: my $currentstring = '';
1017: if ($target eq 'web') {
1018: $currentstring .= $token->[2];
1019: } elsif ($target eq 'tex') {
1020: $currentstring .= " }\$";
1021: }
1022: return $currentstring;
1023: }
1.35 sakharuk 1024: #-- <hr> tag
1.1 sakharuk 1025: sub start_hr {
1026: my ($target,$token) = @_;
1027: my $currentstring = '';
1028: if ($target eq 'web') {
1029: $currentstring .= $token->[4];
1030: } elsif ($target eq 'tex') {
1031: $currentstring .= "\\hline ";
1.6 sakharuk 1032: }
1033: return $currentstring;
1034: }
1035: sub end_hr {
1036: my ($target,$token) = @_;
1037: my $currentstring = '';
1038: if ($target eq 'web') {
1039: $currentstring .= $token->[2];
1040: } elsif ($target eq 'tex') {
1.1 sakharuk 1041: }
1042: return $currentstring;
1043: }
1.35 sakharuk 1044: #-- <a> tag
1.1 sakharuk 1045: sub start_a {
1046: my ($target,$token) = @_;
1047: my $currentstring = '';
1048: if ($target eq 'web') {
1049: $currentstring .= $token->[4];
1050: } elsif ($target eq 'tex') {
1051: }
1052: return $currentstring;
1053: }
1054: sub end_a {
1.30 albertel 1055: my ($target,$token,$tagstack,$stackref) = @_;
1.1 sakharuk 1056: my $currentstring = '';
1057: if ($target eq 'web') {
1058: $currentstring .= $token->[2];
1059: } elsif ($target eq 'tex') {
1060: my $tempor_var = $stackref->[$#$stackref];
1061: if (index($tempor_var,'name') != -1 ) {
1062: $tempor_var =~ s/name=([^,]*),/$1/g;
1.15 sakharuk 1063: # $currentstring .= " \\label{$tempor_var}";
1.1 sakharuk 1064: } elsif (index($tempor_var,'href') != -1 ) {
1065: $tempor_var =~ s/href=([^,]*),/$1/g;
1066: $currentstring .= " \\ref{$tempor_var}";
1067: }
1068: }
1069: return $currentstring;
1070: }
1.35 sakharuk 1071: #-- <li> tag
1.1 sakharuk 1072: sub start_li {
1.30 albertel 1073: my ($target,$token,$tagstack,$stackref) = @_;
1.1 sakharuk 1074: my $currentstring = '';
1075: if ($target eq 'web') {
1076: $currentstring = $token->[4];
1077: } elsif ($target eq 'tex') {
1.15 sakharuk 1078: my $tempor_var = $stackref->[$#$stackref];
1.1 sakharuk 1079: if (index($tempor_var,'circle') != -1 ) {
1080: $currentstring .= " \\item[o] ";
1081: } elsif (index($tempor_var,'square') != -1 ) {
1082: $currentstring .= " \\item[$\Box$] ";
1.15 sakharuk 1083: } elsif ($tempor_var ne '') {
1084: $_ = $tempor_var;
1085: m/my\s*([^=]*)=/;
1086: $currentstring .= " \\item[$1] ";
1087: } else {
1.1 sakharuk 1088: $currentstring .= " \\item ";
1089: }
1090: }
1091: return $currentstring;
1092: }
1093: sub end_li {
1094: my ($target,$token) = @_;
1095: my $currentstring = '';
1096: if ($target eq 'web') {
1097: $currentstring = $token->[2];
1098: }
1099: return $currentstring;
1100: }
1.35 sakharuk 1101: #-- <u> tag
1.1 sakharuk 1102: sub start_u {
1103: my ($target,$token) = @_;
1104: my $currentstring = '';
1105: if ($target eq 'web') {
1106: $currentstring .= $token->[4];
1107: } elsif ($target eq 'tex') {
1108: $currentstring .= "{\\underline ";
1109: }
1110: return $currentstring;
1111: }
1112: sub end_u {
1113: my ($target,$token) = @_;
1114: my $currentstring = '';
1115: if ($target eq 'web') {
1116: $currentstring .= $token->[2];
1117: } elsif ($target eq 'tex') {
1118: $currentstring .= " }";
1119: }
1120: return $currentstring;
1121: }
1.35 sakharuk 1122: #-- <ul> tag
1.1 sakharuk 1123: sub start_ul {
1124: my ($target,$token) = @_;
1125: my $currentstring = '';
1126: if ($target eq 'web') {
1127: $currentstring = $token->[4];
1128: } elsif ($target eq 'tex') {
1.41 ! sakharuk 1129: $currentstring = '\begin{itemize}';
1.1 sakharuk 1130: }
1131: return $currentstring;
1132: }
1133: sub end_ul {
1134: my ($target,$token) = @_;
1135: my $currentstring = '';
1136: if ($target eq 'web') {
1137: $currentstring = $token->[2];
1138: } elsif ($target eq 'tex') {
1.41 ! sakharuk 1139: $currentstring = '\end{itemize}';
1.1 sakharuk 1140: }
1141: return $currentstring;
1142: }
1.35 sakharuk 1143: #-- <menu> tag
1.1 sakharuk 1144: sub start_menu {
1145: my ($target,$token) = @_;
1146: my $currentstring = '';
1147: if ($target eq 'web') {
1148: $currentstring = $token->[4];
1149: } elsif ($target eq 'tex') {
1150: $currentstring = " \\begin{itemize} ";
1151: }
1152: return $currentstring;
1153: }
1154: sub end_menu {
1155: my ($target,$token) = @_;
1156: my $currentstring = '';
1157: if ($target eq 'web') {
1158: $currentstring = $token->[2];
1159: } elsif ($target eq 'tex') {
1160: $currentstring = " \\end{itemize}";
1161: }
1162: return $currentstring;
1163: }
1.35 sakharuk 1164: #-- <dir> tag
1.1 sakharuk 1165: sub start_dir {
1166: my ($target,$token) = @_;
1167: my $currentstring = '';
1168: if ($target eq 'web') {
1169: $currentstring = $token->[4];
1170: } elsif ($target eq 'tex') {
1171: $currentstring = " \\begin{itemize} ";
1172: }
1173: return $currentstring;
1174: }
1175: sub end_dir {
1176: my ($target,$token) = @_;
1177: my $currentstring = '';
1178: if ($target eq 'web') {
1179: $currentstring = $token->[2];
1180: } elsif ($target eq 'tex') {
1181: $currentstring = " \\end{itemize}";
1182: }
1183: return $currentstring;
1184: }
1.35 sakharuk 1185: #-- <ol> tag
1.1 sakharuk 1186: sub start_ol {
1187: my ($target,$token) = @_;
1188: my $currentstring = '';
1189: if ($target eq 'web') {
1190: $currentstring = $token->[4];
1191: } elsif ($target eq 'tex') {
1.41 ! sakharuk 1192: $currentstring = '\begin{enumerate}';
1.1 sakharuk 1193: }
1194: return $currentstring;
1195: }
1196: sub end_ol {
1197: my ($target,$token) = @_;
1198: my $currentstring = '';
1199: if ($target eq 'web') {
1200: $currentstring = $token->[2];
1201: } elsif ($target eq 'tex') {
1.41 ! sakharuk 1202: $currentstring = '\end{enumerate}';
1.1 sakharuk 1203: }
1204: return $currentstring;
1205: }
1.35 sakharuk 1206: #-- <dl> tag
1.1 sakharuk 1207: sub start_dl {
1208: my ($target,$token) = @_;
1209: my $currentstring = '';
1210: if ($target eq 'web') {
1211: $currentstring = $token->[4];
1212: } elsif ($target eq 'tex') {
1.41 ! sakharuk 1213: $currentstring = '\begin{description}';
1.1 sakharuk 1214: }
1215: return $currentstring;
1216: }
1217: sub end_dl {
1218: my ($target,$token) = @_;
1219: my $currentstring = '';
1220: if ($target eq 'web') {
1221: $currentstring = $token->[2];
1222: } elsif ($target eq 'tex') {
1.41 ! sakharuk 1223: $currentstring = '\end{description}';
1.1 sakharuk 1224: }
1225: return $currentstring;
1226: }
1.35 sakharuk 1227: #-- <dt> tag
1.1 sakharuk 1228: sub start_dt {
1229: my ($target,$token) = @_;
1230: my $currentstring = '';
1231: if ($target eq 'web') {
1232: $currentstring = $token->[4];
1233: } elsif ($target eq 'tex') {
1.41 ! sakharuk 1234: $currentstring = '\item[';
1.1 sakharuk 1235: }
1236: return $currentstring;
1237: }
1238: sub end_dt {
1239: my ($target,$token) = @_;
1240: my $currentstring = '';
1241: if ($target eq 'web') {
1242: $currentstring = $token->[2];
1243: } elsif ($target eq 'tex') {
1.41 ! sakharuk 1244: $currentstring = ']';
1.1 sakharuk 1245: }
1246: return $currentstring;
1247: }
1.35 sakharuk 1248: #-- <dd> tag
1.1 sakharuk 1249: sub start_dd {
1250: my ($target,$token) = @_;
1251: my $currentstring = '';
1252: if ($target eq 'web') {
1253: $currentstring = $token->[4];
1254: }
1255: return $currentstring;
1256: }
1257: sub end_dd {
1258: my ($target,$token) = @_;
1259: my $currentstring = '';
1260: if ($target eq 'web') {
1261: $currentstring = $token->[2];
1262: }
1263: return $currentstring;
1264: }
1.35 sakharuk 1265: #-- <table> tag
1.1 sakharuk 1266: sub start_table {
1267: my ($target,$token) = @_;
1268: my $currentstring = '';
1269: if ($target eq 'web') {
1270: $currentstring = $token->[4];
1271: } elsif ($target eq 'tex') {
1.41 ! sakharuk 1272: $currentstring = '';
1.1 sakharuk 1273: }
1274: return $currentstring;
1275: }
1276: sub end_table {
1277: my ($target,$token) = @_;
1278: my $currentstring = '';
1279: if ($target eq 'web') {
1280: $currentstring = $token->[2];
1281: } elsif ($target eq 'tex') {
1.41 ! sakharuk 1282: $currentstring = '';
1.15 sakharuk 1283: }
1284: return $currentstring;
1285: }
1.35 sakharuk 1286: #-- <tr> tag
1.15 sakharuk 1287: sub start_tr {
1288: my ($target,$token) = @_;
1289: my $currentstring = '';
1290: if ($target eq 'web') {
1291: $currentstring = $token->[4];
1292: } elsif ($target eq 'tex') {
1293: $currentstring = '';
1294: }
1295: return $currentstring;
1296: }
1297: sub end_tr {
1298: my ($target,$token) = @_;
1299: my $currentstring = '';
1300: if ($target eq 'web') {
1301: $currentstring = $token->[2];
1302: } elsif ($target eq 'tex') {
1.41 ! sakharuk 1303: $currentstring = '';
1.15 sakharuk 1304: }
1305: return $currentstring;
1306: }
1.35 sakharuk 1307: #-- <td> tag
1.15 sakharuk 1308: sub start_td {
1309: my ($target,$token) = @_;
1310: my $currentstring = '';
1311: if ($target eq 'web') {
1312: $currentstring = $token->[4];
1313: } elsif ($target eq 'tex') {
1314: $currentstring = '';
1315: }
1316: return $currentstring;
1317: }
1318: sub end_td {
1319: my ($target,$token) = @_;
1320: my $currentstring = '';
1321: if ($target eq 'web') {
1322: $currentstring = $token->[2];
1323: } elsif ($target eq 'tex') {
1.41 ! sakharuk 1324: $currentstring = '';
1.1 sakharuk 1325: }
1326: return $currentstring;
1327: }
1.35 sakharuk 1328: #-- <img> tag
1.10 www 1329: sub start_img {
1.41 ! sakharuk 1330: my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
1.10 www 1331: $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=
1332: $token->[2]->{'src'};
1333: my $currentstring = '';
1334: if ($target eq 'web') {
1335: $currentstring = $token->[4];
1336: } elsif ($target eq 'tex') {
1.41 ! sakharuk 1337: my $durty = $token->[2]->{'src'};
! 1338: $durty =~ s!(^.*)/(.*)$!$1/!;
! 1339: my $durtytwo = $2;
! 1340: my $num = index($durtytwo,'gif',0);
! 1341: substr($durtytwo,$num,3) = 'eps';
! 1342: $currentstring = '\graphicspath{{/home/httpd/html'.$durty.'}}\fbox{\includegraphics{'.$durtytwo.'}}';
1.10 www 1343: }
1344: return $currentstring;
1345: }
1346: sub end_img {
1347: my ($target,$token) = @_;
1348: my $currentstring = '';
1349: if ($target eq 'web') {
1.41 ! sakharuk 1350: $currentstring = $token->[2];
1.10 www 1351: } elsif ($target eq 'tex') {
1.41 ! sakharuk 1352: $currentstring = '';
1.10 www 1353: }
1354: return $currentstring;
1355: }
1.35 sakharuk 1356: #-- <applet> tag
1.10 www 1357:
1358: sub start_applet {
1359: my ($target,$token) = @_;
1360: $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=
1361: $token->[2]->{'code'};
1362: $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=
1363: $token->[2]->{'archive'};
1364: my $currentstring = '';
1365: if ($target eq 'web') {
1366: $currentstring = $token->[4];
1367: } elsif ($target eq 'tex') {
1368: $currentstring = " \\begin{figure} ";
1369: }
1370: return $currentstring;
1371: }
1372: sub end_applet {
1373: my ($target,$token) = @_;
1374: my $currentstring = '';
1375: if ($target eq 'web') {
1376: $currentstring = $token->[2];
1377: } elsif ($target eq 'tex') {
1378: $currentstring = " \\end{figure}";
1379: }
1380: return $currentstring;
1381: }
1382:
1.35 sakharuk 1383: #-- <embed> tag
1.10 www 1384:
1385: sub start_embed {
1386: my ($target,$token) = @_;
1387: $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=
1388: $token->[2]->{'src'};
1389: my $currentstring = '';
1390: if ($target eq 'web') {
1391: $currentstring = $token->[4];
1392: } elsif ($target eq 'tex') {
1393: $currentstring = " \\begin{figure} ";
1394: }
1395: return $currentstring;
1396: }
1397: sub end_embed {
1398: my ($target,$token) = @_;
1399: my $currentstring = '';
1400: if ($target eq 'web') {
1401: $currentstring = $token->[2];
1402: } elsif ($target eq 'tex') {
1403: $currentstring = " \\end{figure}";
1404: }
1405: return $currentstring;
1406: }
1407:
1.35 sakharuk 1408: #-- <param> tag
1.10 www 1409:
1.11 www 1410: sub start_param {
1.10 www 1411: my ($target,$token) = @_;
1412: if ($token->[2]->{'name'} eq 'cabbase') {
1413: $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=
1414: $token->[2]->{'value'};
1415: }
1.20 www 1416: $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=
1.10 www 1417: $token->[2]->{'src'};
1418: my $currentstring = '';
1419: if ($target eq 'web') {
1420: $currentstring = $token->[4];
1421: } elsif ($target eq 'tex') {
1422: $currentstring = " \\begin{figure} ";
1423: }
1424: return $currentstring;
1425: }
1.11 www 1426: sub end_param {
1.10 www 1427: my ($target,$token) = @_;
1428: my $currentstring = '';
1429: if ($target eq 'web') {
1430: $currentstring = $token->[2];
1431: } elsif ($target eq 'tex') {
1432: $currentstring = " \\end{figure}";
1433: }
1434: return $currentstring;
1435: }
1436:
1.35 sakharuk 1437: #-- <allow> tag
1.10 www 1438:
1439: sub start_allow {
1440: my ($target,$token) = @_;
1441:
1.20 www 1442: $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=
1.10 www 1443: $token->[2]->{'src'};
1444:
1445: return '';
1446: }
1447: sub end_allow {
1448: return '';
1449: }
1.35 sakharuk 1450: #-- Frames
1.31 albertel 1451: sub start_frameset {
1452: my ($target,$token) = @_;
1453: my $currentstring = '';
1454: if ($target eq 'web') {
1455: if (!$Apache::lonxml::registered) {
1456: $currentstring.='<head>'.&Apache::lonxml::registerurl().'</head>';
1457: }
1458: $currentstring .= $token->[4];
1459: }
1460: return $currentstring;
1461: }
1462: sub end_frameset {
1463: my ($target,$token) = @_;
1464: my $currentstring = '';
1465: if ($target eq 'web') {
1466: $currentstring = $token->[2];
1467: }
1468: return $currentstring;
1.41 ! sakharuk 1469: }
! 1470: #-- <pre>
! 1471: sub start_pre {
! 1472: my ($target,$token) = @_;
! 1473: my $currentstring = '';
! 1474: if ($target eq 'web') {
! 1475: $currentstring .= $token->[4];
! 1476: } elsif ($target eq 'tex') {
! 1477: $currentstring .= '\begin{verbatim}';
! 1478: }
! 1479: return $currentstring;
! 1480: }
! 1481: sub end_pre {
! 1482: my ($target,$token) = @_;
! 1483: my $currentstring = '';
! 1484: if ($target eq 'web') {
! 1485: $currentstring .= $token->[2];
! 1486: } elsif ($target eq 'tex') {
! 1487: $currentstring .= '\end{verbatim}';
! 1488: }
! 1489: return $currentstring;
1.31 albertel 1490: }
1.1 sakharuk 1491: 1;
1492: __END__
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>