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