Diff for /loncom/xml/londefdef.pm between versions 1.39 and 1.41

version 1.39, 2002/01/09 23:11:59 version 1.41, 2002/01/18 16:33:54
Line 2 Line 2
 # Tags Default Definition Module   # Tags Default Definition Module 
 #  #
 # $Id$  # $Id$
   # 
 #  #
 # Copyright Michigan State University Board of Trustees  # Copyright Michigan State University Board of Trustees
 #  #
Line 39 Line 40
 #  #
 # last modified 06/26/00 by Alexander Sakharuk  # last modified 06/26/00 by Alexander Sakharuk
 # 11/6,11/30,02/01/01,5/4 Gerd Kortemeyer  # 11/6,11/30,02/01/01,5/4 Gerd Kortemeyer
   # 01/18 Alex Sakharuk
   
 package Apache::londefdef;   package Apache::londefdef; 
   
Line 47  use Apache::lonxml; Line 49  use Apache::lonxml;
   
 BEGIN {  BEGIN {
   
     &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'));      &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'));
   
 }  }
   
Line 101  sub end_m { Line 103  sub end_m {
 #-- <html> tag      #-- <html> tag    
       sub start_html {        sub start_html {
     my ($target,$token) = @_;      my ($target,$token) = @_;
             my $currentstring = '';               my $currentstring = '';
     if ($ENV{'browser.mathml'}) {      if ($ENV{'browser.mathml'}) {
       &tth::ttminit();        &tth::ttminit();
     } else {      } else {
Line 120  sub end_m { Line 122  sub end_m {
                                  \setlength{\parindent}{20pt}                                   \setlength{\parindent}{20pt}
                                  \setlength{\marginparwidth}{90pt}                                   \setlength{\marginparwidth}{90pt}
                                  \setlength{\textfloatsep}{8pt plus 2.0pt minus 4.0pt}                                   \setlength{\textfloatsep}{8pt plus 2.0pt minus 4.0pt}
                                  \newcommand{\keephidden}[1]{}';                                   \newcommand{\keephidden}[1]{}           
                                    \usepackage[dvips]{graphicx}';
     }      }
    return $currentstring;     return $currentstring;
  }   }
Line 322  sub end_m { Line 325  sub end_m {
       }        }
 #-- <body> tag  #-- <body> tag
         sub start_body {          sub start_body {
     my ($target,$token) = @_;              my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
   #    my ($target,$token) = @_;
             my $currentstring = '';              my $currentstring = '';
             if ($target eq 'web') {              if ($target eq 'web') {
       if (!$Apache::lonxml::registered) {        if (!$Apache::lonxml::registered) {
Line 351  sub end_m { Line 355  sub end_m {
        $currentstring.=' '.$_.'="'.$token->[2]->{$_}.'"';         $currentstring.=' '.$_.'="'.$token->[2]->{$_}.'"';
       }        }
       $currentstring.='>';        $currentstring.='>';
         if ($ENV{'request.state'} ne 'published') {
    $currentstring.=(<<EDITBUTTON);
    <form method="post">
    <input type="submit" name="showmode" value="Edit" />
    </form>
   EDITBUTTON
         }
            } elsif ($target eq 'tex') {             } elsif ($target eq 'tex') {
               $currentstring = '\begin{document}';                  $currentstring = '\begin{document}';  
     }       } 
Line 519  sub end_m { Line 530  sub end_m {
             if ($target eq 'web') {              if ($target eq 'web') {
        $currentstring .= $token->[4];         $currentstring .= $token->[4];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '\large{\textbf';   $currentstring .= '\large{\textbf{';
     }       } 
            return $currentstring;             return $currentstring;
  }   }
Line 828  sub end_m { Line 839  sub end_m {
             if ($target eq 'web') {              if ($target eq 'web') {
        $currentstring .= $token->[4];         $currentstring .= $token->[4];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '\\';   $currentstring .= '\\\\';
     } elsif ($target eq 'latexsource') {      } elsif ($target eq 'latexsource') {
  $currentstring .= '\\';   $currentstring .= '\\';
     }       } 
Line 851  sub end_m { Line 862  sub end_m {
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '\large{';   $currentstring .= '\large{';
     } elsif ($target eq 'latexsource') {      } elsif ($target eq 'latexsource') {
  $currentstring .= '\large{';   $currentstring .= '{\Large ';
     }        }  
            return $currentstring;             return $currentstring;
  }   }
Line 874  sub end_m { Line 885  sub end_m {
             if ($target eq 'web') {              if ($target eq 'web') {
        $currentstring .= $token->[4];         $currentstring .= $token->[4];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '\footnotesize{';   $currentstring .= '{\footnotesize ';
     } elsif ($target eq 'latexsource') {      } elsif ($target eq 'latexsource') {
  $currentstring .= '\footnotesize{';   $currentstring .= '{\footnotesize ';
     }       } 
            return $currentstring;             return $currentstring;
  }   }
Line 1115  sub end_m { Line 1126  sub end_m {
             if ($target eq 'web') {              if ($target eq 'web') {
               $currentstring = $token->[4];                     $currentstring = $token->[4];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
               $currentstring = " \\begin{itemize} ";                  $currentstring = '\begin{itemize}';  
     }       } 
    return $currentstring;     return $currentstring;
  }   }
Line 1125  sub end_m { Line 1136  sub end_m {
             if ($target eq 'web') {              if ($target eq 'web') {
               $currentstring = $token->[2];                     $currentstring = $token->[2];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
               $currentstring = " \\end{itemize}";                  $currentstring = '\end{itemize}';  
     }       } 
    return $currentstring;     return $currentstring;
  }   }
Line 1178  sub end_m { Line 1189  sub end_m {
             if ($target eq 'web') {              if ($target eq 'web') {
               $currentstring = $token->[4];                     $currentstring = $token->[4];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
               $currentstring = " \\begin{enumerate} ";                  $currentstring = '\begin{enumerate}';  
     }       } 
    return $currentstring;     return $currentstring;
  }   }
Line 1188  sub end_m { Line 1199  sub end_m {
             if ($target eq 'web') {              if ($target eq 'web') {
               $currentstring = $token->[2];                     $currentstring = $token->[2];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
               $currentstring = " \\end{enumerate}";                  $currentstring = '\end{enumerate}';  
     }       } 
    return $currentstring;     return $currentstring;
  }   }
Line 1199  sub end_m { Line 1210  sub end_m {
             if ($target eq 'web') {              if ($target eq 'web') {
               $currentstring = $token->[4];                     $currentstring = $token->[4];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
               $currentstring = " \\begin{description} ";                  $currentstring = '\begin{description}';  
     }       } 
    return $currentstring;     return $currentstring;
  }   }
Line 1209  sub end_m { Line 1220  sub end_m {
             if ($target eq 'web') {              if ($target eq 'web') {
               $currentstring = $token->[2];                     $currentstring = $token->[2];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
               $currentstring = " \\end{description}";                  $currentstring = '\end{description}';  
     }       } 
    return $currentstring;     return $currentstring;
  }   }
Line 1220  sub end_m { Line 1231  sub end_m {
             if ($target eq 'web') {              if ($target eq 'web') {
               $currentstring = $token->[4];                     $currentstring = $token->[4];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
               $currentstring = "\\item[ ";                  $currentstring = '\item[';  
     }       } 
    return $currentstring;     return $currentstring;
  }   }
Line 1230  sub end_m { Line 1241  sub end_m {
             if ($target eq 'web') {              if ($target eq 'web') {
               $currentstring = $token->[2];                    $currentstring = $token->[2];    
             } elsif ($target eq 'tex') {              } elsif ($target eq 'tex') {
               $currentstring = "]";                  $currentstring = ']';  
     }       } 
    return $currentstring;     return $currentstring;
  }   }
Line 1258  sub end_m { Line 1269  sub end_m {
             if ($target eq 'web') {              if ($target eq 'web') {
               $currentstring = $token->[4];                     $currentstring = $token->[4];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
               $currentstring = "";                  $currentstring = '';  
     }       } 
    return $currentstring;     return $currentstring;
  }   }
Line 1268  sub end_m { Line 1279  sub end_m {
             if ($target eq 'web') {              if ($target eq 'web') {
               $currentstring = $token->[2];                     $currentstring = $token->[2];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
               $currentstring = "";                  $currentstring = '';  
     }       } 
    return $currentstring;     return $currentstring;
  }   }
Line 1289  sub end_m { Line 1300  sub end_m {
             if ($target eq 'web') {              if ($target eq 'web') {
               $currentstring = $token->[2];                     $currentstring = $token->[2];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
               $currentstring = "";                  $currentstring = '';  
     }       } 
    return $currentstring;     return $currentstring;
  }   }
Line 1310  sub end_m { Line 1321  sub end_m {
             if ($target eq 'web') {              if ($target eq 'web') {
               $currentstring = $token->[2];                     $currentstring = $token->[2];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
               $currentstring = "";                  $currentstring = '';  
     }       } 
    return $currentstring;     return $currentstring;
  }   }
 #-- <img> tag  #-- <img> tag
   
         sub start_img {          sub start_img {
     my ($target,$token) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
             $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=                 $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=   
                                         $token->[2]->{'src'};                                          $token->[2]->{'src'};
             my $currentstring = '';              my $currentstring = '';
             if ($target eq 'web') {              if ($target eq 'web') {
               $currentstring = $token->[4];                     $currentstring = $token->[4];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
               $currentstring = " \\begin{figure} ";                    my $durty = $token->[2]->{'src'};
                   $durty =~ s!(^.*)/(.*)$!$1/!;
                   my $durtytwo = $2;
                   my $num = index($durtytwo,'gif',0);
    substr($durtytwo,$num,3) = 'eps';
    $currentstring = '\graphicspath{{/home/httpd/html'.$durty.'}}\fbox{\includegraphics{'.$durtytwo.'}}';
     }       } 
    return $currentstring;     return $currentstring;
  }   }
Line 1332  sub end_m { Line 1347  sub end_m {
     my ($target,$token) = @_;      my ($target,$token) = @_;
             my $currentstring = '';              my $currentstring = '';
             if ($target eq 'web') {              if ($target eq 'web') {
               $currentstring = $token->[2];                     $currentstring = $token->[2];  
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
               $currentstring = " \\end{figure}";                  $currentstring = '';  
     }       } 
    return $currentstring;     return $currentstring;
  }   }
Line 1452  sub end_m { Line 1467  sub end_m {
   }    }
   return $currentstring;    return $currentstring;
  }   }
   #-- <pre>
    sub start_pre {
       my ($target,$token) = @_;
               my $currentstring = '';
               if ($target eq 'web') {
          $currentstring .= $token->[4];
       } elsif ($target eq 'tex') {
    $currentstring .= '\begin{verbatim}';
       } 
              return $currentstring;
    }
           sub end_pre {
       my ($target,$token) = @_;
               my $currentstring = '';
               if ($target eq 'web') {
          $currentstring .= $token->[2];
       } elsif ($target eq 'tex') {
    $currentstring .= '\end{verbatim}';
       }
              return $currentstring;
    }
 1;  1;
 __END__  __END__

Removed from v.1.39  
changed lines
  Added in v.1.41


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>