version 1.180, 2003/10/14 00:21:12
|
version 1.189, 2003/10/24 21:48:17
|
Line 50 use Apache::File();
|
Line 50 use Apache::File();
|
use Image::Magick; |
use Image::Magick; |
use Apache::lonmenu(); |
use Apache::lonmenu(); |
use Apache::lonmeta(); |
use Apache::lonmeta(); |
|
use Apache::Constants qw(:common); |
|
|
$Apache::londefdef::TD_redirection=0; |
|
|
|
BEGIN { |
BEGIN { |
|
|
Line 59 BEGIN {
|
Line 59 BEGIN {
|
|
|
} |
} |
|
|
|
sub initialize_londefdef { |
|
$Apache::londefdef::TD_redirection=0; |
|
@Apache::londefdef::table = (); |
|
$Apache::londefdef::select=0; |
|
@Apache::londefdef::description=(); |
|
$Apache::londefdef::DD_redirection=0; |
|
$Apache::londefdef::DT_redirection=0; |
|
} |
|
|
#======================= TAG SUBROUTINES ===================== |
#======================= TAG SUBROUTINES ===================== |
#-- <output> |
#-- <output> |
sub start_output { |
sub start_output { |
Line 140 sub end_tthoption {
|
Line 149 sub end_tthoption {
|
return $result; |
return $result; |
} |
} |
|
|
#-- <html> tag |
#-- <html> tag (end tag optional) |
sub start_html { |
sub start_html { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 159 sub start_html {
|
Line 168 sub start_html {
|
&tth::tthoptions('-L -u0'); |
&tth::tthoptions('-L -u0'); |
} |
} |
} |
} |
if ($target eq 'web') { |
if ($target eq 'web' || $target eq 'edit') { |
$currentstring = &Apache::lonxml::xmlbegin(). |
$currentstring = &Apache::lonxml::xmlbegin(). |
&Apache::lonxml::fontsettings(); |
&Apache::lonxml::fontsettings(); |
} elsif ($target eq 'tex') { |
} elsif ($target eq 'tex') { |
Line 188 sub end_html {
|
Line 197 sub end_html {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <head> tag |
#-- <head> tag (end tag optional) |
sub start_head { |
sub start_head { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 208 sub end_head {
|
Line 217 sub end_head {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <map> tag |
#-- <map> tag (end tag required) |
sub start_map { |
sub start_map { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 227 sub end_map {
|
Line 236 sub end_map {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <select> tag |
#-- <select> tag (end tag required) |
sub start_select { |
sub start_select { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
if ($target eq 'web') { |
if ($target eq 'web') { |
$currentstring = $token->[4]; |
$currentstring = $token->[4]; |
} |
} elsif ($target eq 'tex') { |
|
$Apache::londefdef::select=0; |
|
} |
return $currentstring; |
return $currentstring; |
} |
} |
|
|
Line 246 sub end_select {
|
Line 257 sub end_select {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <option> tag |
#-- <option> tag (end tag optional) |
sub start_option { |
sub start_option { |
my ($target,$token) = @_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
if ($target eq 'web') { |
if ($target eq 'web') { |
$currentstring = $token->[4]; |
$currentstring = $token->[4]; |
} |
} elsif ($target eq 'tex') { |
|
$Apache::londefdef::select++; |
|
if ($Apache::londefdef::select == 1) { |
|
$currentstring='\noindent\fbox{'.&Apache::lonxml::get_param('value',$parstack,$safeeval).'}\keephidden{'; |
|
} else { |
|
$currentstring='\keephidden{'; |
|
} |
|
} |
return $currentstring; |
return $currentstring; |
} |
} |
|
|
Line 261 sub end_option {
|
Line 279 sub end_option {
|
my $currentstring = ''; |
my $currentstring = ''; |
if ($target eq 'web') { |
if ($target eq 'web') { |
$currentstring = $token->[2]; |
$currentstring = $token->[2]; |
} |
} elsif ($target eq 'tex') { |
|
$currentstring='}'; |
|
} |
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <input> tag |
#-- <input> tag (end tag forbidden) |
sub start_input { |
sub start_input { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 284 sub end_input {
|
Line 304 sub end_input {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <textarea> tag |
#-- <textarea> tag (end tag required) |
sub start_textarea { |
sub start_textarea { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 303 sub end_textarea {
|
Line 323 sub end_textarea {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <form> tag |
#-- <form> tag (end tag required) |
sub start_form { |
sub start_form { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 322 sub end_form {
|
Line 342 sub end_form {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <title> tag |
#-- <title> tag (end tag required) |
sub start_title { |
sub start_title { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 333 sub start_title {
|
Line 353 sub start_title {
|
} |
} |
if ($target eq 'meta') { |
if ($target eq 'meta') { |
$currentstring='<title>'; |
$currentstring='<title>'; |
&start_output(); |
&start_output($target); |
} |
} |
return $currentstring; |
return $currentstring; |
} |
} |
Line 347 sub end_title {
|
Line 367 sub end_title {
|
$currentstring .= '}'; |
$currentstring .= '}'; |
} |
} |
if ($target eq 'meta') { |
if ($target eq 'meta') { |
&end_output(); |
&end_output($target); |
$currentstring='</title>'; |
$currentstring='</title>'; |
} |
} |
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <meta> tag |
#-- <meta> tag (end tag forbidden) |
sub start_meta { |
sub start_meta { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 467 sub end_accessrule {
|
Line 487 sub end_accessrule {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <body> tag |
#-- <body> tag (end tag required) |
sub start_body { |
sub start_body { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 553 sub end_body {
|
Line 573 sub end_body {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <center> tag |
#-- <center> tag (end tag required) |
sub start_center { |
sub start_center { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 576 sub end_center {
|
Line 596 sub end_center {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <b> tag |
#-- <b> tag (end tag required) |
sub start_b { |
sub start_b { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 599 sub end_b {
|
Line 619 sub end_b {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <strong> tag |
#-- <strong> tag (end tag required) |
sub start_strong { |
sub start_strong { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 614 sub start_strong {
|
Line 634 sub start_strong {
|
sub end_strong { |
sub end_strong { |
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 = '}'; |
$currentstring = '}'; |
Line 623 sub end_strong {
|
Line 642 sub end_strong {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <h1> tag |
#-- <h1> tag (end tag required) |
sub start_h1 { |
sub start_h1 { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 644 sub start_h1 {
|
Line 663 sub start_h1 {
|
$currentstring .= $pre.'{\\'.$TeXsize.' \textbf{'; |
$currentstring .= $pre.'{\\'.$TeXsize.' \textbf{'; |
} elsif ($target eq 'meta') { |
} elsif ($target eq 'meta') { |
$currentstring='<subject>'; |
$currentstring='<subject>'; |
&start_output(); |
&start_output($target); |
} |
} |
return $currentstring; |
return $currentstring; |
} |
} |
Line 666 sub end_h1 {
|
Line 685 sub end_h1 {
|
} |
} |
$currentstring .= '}}'.$post; |
$currentstring .= '}}'.$post; |
} elsif ($target eq 'meta') { |
} elsif ($target eq 'meta') { |
&end_output(); |
&end_output($target); |
$currentstring='</subject>'; |
$currentstring='</subject>'; |
} |
} |
return $currentstring; |
return $currentstring; |
Line 887 sub end_h6 {
|
Line 906 sub end_h6 {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#--- <cite> tag |
#--- <cite> tag (end tag required) |
sub start_cite { |
sub start_cite { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 910 sub end_cite {
|
Line 929 sub end_cite {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <i> tag |
#-- <i> tag (end tag required) |
sub start_i { |
sub start_i { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 933 sub end_i {
|
Line 952 sub end_i {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <address> tag |
#-- <address> tag (end tag required) |
sub start_address { |
sub start_address { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 956 sub end_address {
|
Line 975 sub end_address {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <dfn> tag |
#-- <dfn> tag (end tag required) |
sub start_dfn { |
sub start_dfn { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 979 sub end_dfn {
|
Line 998 sub end_dfn {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <tt> tag |
#-- <tt> tag (end tag required) |
sub start_tt { |
sub start_tt { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 1002 sub end_tt {
|
Line 1021 sub end_tt {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <kbd> tag |
#-- <kbd> tag (end tag required) |
sub start_kbd { |
sub start_kbd { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 1025 sub end_kbd {
|
Line 1044 sub end_kbd {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <code> tag |
#-- <code> tag (end tag required) |
sub start_code { |
sub start_code { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 1048 sub end_code {
|
Line 1067 sub end_code {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <em> tag |
#-- <em> tag (end tag required) |
sub start_em { |
sub start_em { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 1071 sub end_em {
|
Line 1090 sub end_em {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <q> tag |
#-- <q> tag (end tag required) |
sub start_q { |
sub start_q { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 1094 sub end_q {
|
Line 1113 sub end_q {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <p> tag |
#-- <p> tag (end tag optional) |
sub start_p { |
sub start_p { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 1117 sub end_p {
|
Line 1136 sub end_p {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <br> tag |
#-- <br> tag (end tag forbidden) |
sub start_br { |
sub start_br { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 1140 sub end_br {
|
Line 1159 sub end_br {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <big> tag |
#-- <big> tag (end tag required) |
sub start_big { |
sub start_big { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 1163 sub end_big {
|
Line 1182 sub end_big {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <small> tag |
#-- <small> tag (end tag required) |
sub start_small { |
sub start_small { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 1186 sub end_small {
|
Line 1205 sub end_small {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <basefont> tag |
#-- <basefont> tag (end tag forbidden) |
sub start_basefont { |
sub start_basefont { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 1215 sub end_basefont {
|
Line 1234 sub end_basefont {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <font> tag |
#-- <font> tag (end tag required) |
sub start_font { |
sub start_font { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 1253 sub end_font {
|
Line 1272 sub end_font {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <strike> tag |
#-- <strike> tag (end tag required) |
sub start_strike { |
sub start_strike { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 1279 sub end_strike {
|
Line 1298 sub end_strike {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <s> tag |
#-- <s> tag (end tag required) |
sub start_s { |
sub start_s { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 1305 sub end_s {
|
Line 1324 sub end_s {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <sub> tag |
#-- <sub> tag (end tag required) |
sub start_sub { |
sub start_sub { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
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 .= "\$_{ "; |
$currentstring .= "\$_{"; |
} |
} |
return $currentstring; |
return $currentstring; |
} |
} |
Line 1323 sub end_sub {
|
Line 1342 sub end_sub {
|
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; |
} |
} |
|
|
#-- <sup> tag |
#-- <sup> tag (end tag required) |
sub start_sup { |
sub start_sup { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
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 .= "\$^{ "; |
$currentstring .= "\$^{"; |
} |
} |
return $currentstring; |
return $currentstring; |
} |
} |
Line 1346 sub end_sup {
|
Line 1365 sub end_sup {
|
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; |
} |
} |
|
|
#-- <hr> tag |
#-- <hr> tag (end tag forbidden) |
sub start_hr { |
sub start_hr { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 1391 sub end_hr {
|
Line 1410 sub end_hr {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <div> tag |
#-- <div> tag (end tag required) |
sub start_div { |
sub start_div { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 1410 sub end_div {
|
Line 1429 sub end_div {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <a> tag |
#-- <a> tag (end tag required) |
sub start_a { |
sub start_a { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 1440 sub end_a {
|
Line 1459 sub end_a {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <li> tag |
#-- <li> tag (end tag optional) |
sub start_li { |
sub start_li { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 1470 sub end_li {
|
Line 1489 sub end_li {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <u> tag |
#-- <u> tag (end tag required) |
sub start_u { |
sub start_u { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 1496 sub end_u {
|
Line 1515 sub end_u {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <ul> tag |
#-- <ul> tag (end tag required) |
sub start_ul { |
sub start_ul { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 1539 sub end_ul {
|
Line 1558 sub end_ul {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <menu> tag |
#-- <menu> tag (end tag required) |
sub start_menu { |
sub start_menu { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 1562 sub end_menu {
|
Line 1581 sub end_menu {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <dir> tag |
#-- <dir> tag (end tag required) |
sub start_dir { |
sub start_dir { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 1585 sub end_dir {
|
Line 1604 sub end_dir {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <ol> tag |
#-- <ol> tag (end tag required) |
sub start_ol { |
sub start_ol { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 1638 sub end_ol {
|
Line 1657 sub end_ol {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <dl> tag |
#-- <dl> tag (end tag required) |
sub start_dl { |
sub start_dl { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 1716 sub item_cleanup {
|
Line 1735 sub item_cleanup {
|
return $item; |
return $item; |
} |
} |
|
|
#-- <dd> tag |
#-- <dd> tag (end tag optional) |
sub start_dd { |
sub start_dd { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 1746 sub end_dd {
|
Line 1765 sub end_dd {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <table> tag |
#-- <table> tag (end tag required) |
sub start_table { |
sub start_table { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my $textwidth=''; |
my $textwidth=''; |
Line 1984 sub end_td_tex {
|
Line 2003 sub end_td_tex {
|
$newdata=~s/\\vskip \d*\.?\d*\s*mm/THISISJUSTTEMPORARYSEPARATOR/g; |
$newdata=~s/\\vskip \d*\.?\d*\s*mm/THISISJUSTTEMPORARYSEPARATOR/g; |
my @newdata=split(/THISISJUSTTEMPORARYSEPARATOR/,$newdata); |
my @newdata=split(/THISISJUSTTEMPORARYSEPARATOR/,$newdata); |
foreach my $elementdata (@newdata) { |
foreach my $elementdata (@newdata) { |
$elementdata=~s/^\s+(\S.*)/$1/; |
my $lengthnewdata=1.8*LATEX_length($elementdata); |
$elementdata=~s/(.*\S)\s+$/$1/; |
|
$elementdata=~s/(\s)+/$1/; |
|
my $lengthnewdata=1.8*length($elementdata); |
|
if ($lengthnewdata>$current_length) {$current_length=$lengthnewdata;} |
if ($lengthnewdata>$current_length) {$current_length=$lengthnewdata;} |
} |
} |
} else { |
} else { |
$current_length=1.8*length($data); |
$current_length=1.8*LATEX_length($data); |
} |
} |
$Apache::londefdef::table[-1]{'length'} .= $current_length.','; |
$Apache::londefdef::table[-1]{'length'} .= $current_length.','; |
$Apache::londefdef::table[-1]{'TeXlength'} .= '0,'; |
$Apache::londefdef::table[-1]{'TeXlength'} .= '0,'; |
Line 2072 sub end_th {
|
Line 2088 sub end_th {
|
} |
} |
return $currentstring; |
return $currentstring; |
} |
} |
#-- <img> tag |
#-- <img> tag (end tag forbidden) |
sub start_img { |
sub start_img { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my $src = &Apache::lonxml::get_param('src',$parstack,$safeeval, |
my $src = &Apache::lonxml::get_param('src',$parstack,$safeeval, |
undef,1); |
undef,1); |
|
if (not $src and ($target eq 'web' or $target eq 'tex')) { |
|
my $inside = &Apache::lonxml::get_all_text("/img",$parser); |
|
&Apache::lonnet::logthis("inside was $inside"); |
|
return ''; |
|
} |
$Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=$src; |
$Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=$src; |
my $currentstring = ''; |
my $currentstring = ''; |
my $width_param = ''; |
my $width_param = ''; |
Line 2152 sub start_img {
|
Line 2173 sub start_img {
|
my $filename = "/home/httpd/prtspool/$ENV{'user.name'}_$ENV{'user.domain'}_printout.dat"; |
my $filename = "/home/httpd/prtspool/$ENV{'user.name'}_$ENV{'user.domain'}_printout.dat"; |
$temp_file = Apache::File->new('>>'.$filename); |
$temp_file = Apache::File->new('>>'.$filename); |
print $temp_file "$src\n"; |
print $temp_file "$src\n"; |
$currentstring .= '\vskip 1 mm \graphicspath{{/home/httpd/prtspool/}}\includegraphics[width='.$width_param.' mm]{'.$file.'} '; |
$newsrc=~s/\/home\/httpd\/html\/res//; |
|
$newsrc=~s/\/([^\/]+)\.(ps|eps)/\//; |
|
$currentstring .= '\vskip 1 mm \graphicspath{{/home/httpd/prtspool'.$newsrc.'}}\includegraphics[width='.$width_param.' mm]{'.$file.'} '; |
} |
} |
} |
} |
} else { |
} else { |
Line 2169 sub start_img {
|
Line 2192 sub start_img {
|
#<allow> tag will care about replication |
#<allow> tag will care about replication |
} |
} |
} |
} |
|
} elsif ($target eq 'edit') { |
|
$currentstring .=&Apache::edit::tag_start($target,$token); |
|
$currentstring .=&Apache::edit::text_arg('Image Url:','src',$token,70). |
|
&Apache::edit::browse('src',undef,'alt').' '. |
|
&Apache::edit::search('src',undef,'alt').'<br />'; |
|
$currentstring .=&Apache::edit::text_arg('Description:','alt',$token,70).'<br />'; |
|
$currentstring .=&Apache::edit::text_arg('width (pixel):','width',$token,5); |
|
$currentstring .=&Apache::edit::text_arg('height (pixel):','height',$token,5).'<br />'; |
|
$currentstring .=&Apache::edit::text_arg('TeXwidth (mm):','TeXwidth',$token,5); |
|
$currentstring .=&Apache::edit::text_arg('TeXheight (mm):','TeXheight',$token,5); |
|
$currentstring .=&Apache::edit::end_row().&Apache::edit::start_spanning_row(); |
|
my $src=&Apache::lonxml::get_param('src',$parstack,$safeeval); |
|
my $alt=&Apache::lonxml::get_param('alt',$parstack,$safeeval); |
|
my $width=&Apache::lonxml::get_param('width',$parstack,$safeeval); |
|
my $height=&Apache::lonxml::get_param('height',$parstack,$safeeval); |
|
$currentstring .= '<img src="'.$src.'" alt="'.$alt.'" '; |
|
if ($width) { $currentstring.=' width="'.$width.'" '; } |
|
if ($height) { $currentstring.=' height="'.$height.'" '; } |
|
$currentstring .= ' />'; |
|
} elsif ($target eq 'modified') { |
|
my $constructtag=&Apache::edit::get_new_args($token,$parstack, |
|
$safeeval,'src','alt', |
|
'TeXwidth','TeXheight', |
|
'width','height'); |
|
$src=$token->[2]{'src'}; |
|
if (!$token->[2]{'width'} && !$token->[2]{'height'}) { |
|
$src=&Apache::lonnet::filelocation($Apache::lonxml::pwd[-1],$src); |
|
&image_replication($src); |
|
if (-e $src) { |
|
my $image = Image::Magick->new; |
|
my ($width, $height, $size, $format) = $image->Ping($src); |
|
if ($width && $height) { |
|
$token->[2]{'width'} =$width; |
|
$token->[2]{'height'}=$height; |
|
$constructtag=1; |
|
} |
|
} |
|
} |
|
if ($constructtag) {$currentstring=&Apache::edit::rebuild_tag($token);} |
} |
} |
return $currentstring; |
return $currentstring; |
} |
} |
Line 2184 sub end_img {
|
Line 2246 sub end_img {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <applet> tag |
#-- <applet> tag (end tag required) |
sub start_applet { |
sub start_applet { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
|
|
Line 2233 sub end_applet {
|
Line 2295 sub end_applet {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <embed> tag |
#-- <embed> tag (end tag optional/required) |
sub start_embed { |
sub start_embed { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my $src=&Apache::lonxml::get_param('src',$parstack,$safeeval,undef,1); |
my $src=&Apache::lonxml::get_param('src',$parstack,$safeeval,undef,1); |
Line 2265 sub end_embed {
|
Line 2327 sub end_embed {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <param> tag |
#-- <param> tag (end tag forbidden) |
sub start_param { |
sub start_param { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
if (&Apache::lonxml::get_param |
if (&Apache::lonxml::get_param |
Line 2320 sub end_allow {
|
Line 2382 sub end_allow {
|
return ''; |
return ''; |
} |
} |
|
|
#-- Frames |
#-- Frames (end tag required) |
|
#-- <frameset> |
sub start_frameset { |
sub start_frameset { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 2366 sub end_frameset {
|
Line 2429 sub end_frameset {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <xmp> |
#-- <xmp> (end tag required) |
sub start_xmp { |
sub start_xmp { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 2389 sub end_xmp {
|
Line 2452 sub end_xmp {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <pre> |
#-- <pre> (end tag required) |
sub start_pre { |
sub start_pre { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 2472 sub end_blankspace {
|
Line 2535 sub end_blankspace {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <abbr> tag |
#-- <abbr> tag (end tag required) |
sub start_abbr { |
sub start_abbr { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 2491 sub end_abbr {
|
Line 2554 sub end_abbr {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <acronym> tag |
#-- <acronym> tag (end tag required) |
sub start_acronym { |
sub start_acronym { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 2510 sub end_acronym {
|
Line 2573 sub end_acronym {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <area> tag |
#-- <area> tag (end tag forbidden) |
sub start_area { |
sub start_area { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 2529 sub end_area {
|
Line 2592 sub end_area {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <base> tag |
#-- <base> tag (end tag forbidden) |
sub start_base { |
sub start_base { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 2548 sub end_base {
|
Line 2611 sub end_base {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <bdo> tag |
#-- <bdo> tag (end tag required) |
sub start_bdo { |
sub start_bdo { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 2567 sub end_bdo {
|
Line 2630 sub end_bdo {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <bgsound> tag |
#-- <bgsound> tag (end tag optional) |
sub start_bgsound { |
sub start_bgsound { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 2586 sub end_bgsound {
|
Line 2649 sub end_bgsound {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <blink> tag |
#-- <blink> tag (end tag required) |
sub start_blink { |
sub start_blink { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 2605 sub end_blink {
|
Line 2668 sub end_blink {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <blockquote> tag |
#-- <blockquote> tag (end tag required) |
sub start_blockquote { |
sub start_blockquote { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 2624 sub end_blockquote {
|
Line 2687 sub end_blockquote {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <button> tag |
#-- <button> tag (end tag required) |
sub start_button { |
sub start_button { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 2643 sub end_button {
|
Line 2706 sub end_button {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <caption> tag |
#-- <caption> tag (end tag required) |
sub start_caption { |
sub start_caption { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 2662 sub end_caption {
|
Line 2725 sub end_caption {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <col> tag |
#-- <col> tag (end tag forbdden) |
sub start_col { |
sub start_col { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 2681 sub end_col {
|
Line 2744 sub end_col {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <colgroup> tag |
#-- <colgroup> tag (end tag optional) |
sub start_colgroup { |
sub start_colgroup { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 2700 sub end_colgroup {
|
Line 2763 sub end_colgroup {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <del> tag |
#-- <del> tag (end tag required) |
sub start_del { |
sub start_del { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 2719 sub end_del {
|
Line 2782 sub end_del {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <fieldset> tag |
#-- <fieldset> tag (end tag required) |
sub start_fieldset { |
sub start_fieldset { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 2738 sub end_fieldset {
|
Line 2801 sub end_fieldset {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <frame> tag |
#-- <frame> tag (end tag forbidden) |
sub start_frame { |
sub start_frame { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 2757 sub end_frame {
|
Line 2820 sub end_frame {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <iframe> tag |
#-- <iframe> tag (end tag required) |
sub start_iframe { |
sub start_iframe { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 2776 sub end_iframe {
|
Line 2839 sub end_iframe {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <ins> tag |
#-- <ins> tag (end tag required) |
sub start_ins { |
sub start_ins { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 2795 sub end_ins {
|
Line 2858 sub end_ins {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <isindex> tag |
#-- <isindex> tag (end tag forbidden) |
sub start_isindex { |
sub start_isindex { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 2814 sub end_isindex {
|
Line 2877 sub end_isindex {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <keygen> tag |
#-- <keygen> tag (end tag forbidden) |
sub start_keygen { |
sub start_keygen { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 2852 sub end_label {
|
Line 2915 sub end_label {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <layer> tag |
#-- <layer> tag (end tag required) |
sub start_layer { |
sub start_layer { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 2871 sub end_layer {
|
Line 2934 sub end_layer {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <legend> tag |
#-- <legend> tag (end tag required) |
sub start_legend { |
sub start_legend { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 2890 sub end_legend {
|
Line 2953 sub end_legend {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <link> tag |
#-- <link> tag (end tag forbidden) |
sub start_link { |
sub start_link { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 2909 sub end_link {
|
Line 2972 sub end_link {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
#-- <marquee> tag |
#-- <marquee> tag (end tag optional) |
sub start_marquee { |
sub start_marquee { |
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
Line 3284 sub end_hideweboutput {
|
Line 3347 sub end_hideweboutput {
|
|
|
sub image_replication { |
sub image_replication { |
my $src = shift; |
my $src = shift; |
if (not -e $src) { |
if (not -e $src) { &Apache::lonnet::repcopy($src); } |
#replicates image itself |
#replicates eps or ps |
&Apache::lonnet::repcopy($src); |
my $epssrc = my $pssrc = $src; |
#replicates eps or ps |
$epssrc =~ s/\.(gif|jpg|jpeg|png)$/.eps/i; |
my $newsrc = $src; |
$pssrc =~ s/\.(gif|jpg|jpeg|png)$/.ps/i; |
$newsrc =~ s/\.(gif|jpg|jpeg|png)$/.eps/i; |
if (not -e $epssrc && not -e $pssrc) { |
if (not -e $newsrc) { |
my $result=&Apache::lonnet::repcopy($epssrc); |
if (&Apache::lonnet::repcopy($newsrc) ne 'OK') { |
if ($result ne OK) { &Apache::lonnet::repcopy($pssrc); } |
$newsrc =~ s/\.eps$/\.ps/; |
|
&Apache::lonnet::repcopy($newsrc); |
|
} |
|
} |
|
} |
} |
return ''; |
return ''; |
} |
} |
Line 3318 sub recalc {
|
Line 3377 sub recalc {
|
return $value.' mm'; |
return $value.' mm'; |
} |
} |
|
|
|
sub LATEX_length { |
|
my $garbage=shift; |
|
$garbage=~s/^\s+(\S.*)/$1/; |
|
$garbage=~s/(.*\S)\s+$/$1/; |
|
$garbage=~s/(\s)+/$1/; |
|
$garbage=~s/(\\begin{([^\}]+)}|\\end{([^\}]+)})//g; |
|
$garbage=~s/(\$\_\{|\$\_|\$\^{|\$\^|\}\$|\$)//g; |
|
$garbage=~s/(\\alpha|\\beta|\\gamma|\\delta|\\epsilon|\\verepsilon|\\zeta|\\eta|\\theta|\\vartheta|\\iota|\\kappa|\\lambda|\\mu|\\nu|\\xi|\\pi|\\varpi|\\rho|\\varrho|\\sigma|\\varsigma|\\tau|\\upsilon|\\phi|\\varphi|\\chi|\\psi|\\omega|\\Gamma|\\Delta|\\Theta|\\Lambda|\\Xi|\\Pi|\\Sigma|\\Upsilon|\\Phi|\\Psi|\\Omega)/1/g; |
|
$garbage=~s/(\\pm|\\mp|\\times|\\div|\\cdot|\\ast|\\star|\\dagger|\\ddagger|\\amalg|\\cap|\\cup|\\uplus|\\sqcap|\\sqcup|\\vee|\\wedge|\\oplus|\\ominus|\\otimes|\\circ|\\bullet|\\diamond|\\lhd|\\rhd|\\unlhd|\\unrhd|\\oslash|\\odot|\\bigcirc|\\Box|\\Diamond|\\bigtriangleup|\\bigtriangledown|\\triangleleft|\\triangleright|\\setminus|\\wr)/1/g; |
|
$garbage=~s/(\\le|\\ll|\\leq|\\ge|\\geq|\\gg|\\neq|\\doreq|\\sim|\\simeq|\\subset|\\subseteq|\\sqsubset|\\sqsubseteq|\\in|\\vdash|\\models|\\supset|\\supseteq|\\sqsupset|\\sqsupseteq|\\ni|\\dash|\\perp|\\approx|\\cong|\\equiv|\\propto|\\prec|\\preceq|\\parallel|\\asymp|\\smile|\\frown|\\bowtie|\\succ|\\succeq|\\mid)/1/g; |
|
$garbage=~s/(\\not<|\\\\not\\le|\\not\\prec|\\not\\preceq|\\not\\subset|\\not\\subseteq|\\not\\sqsubseteq|\\not\\in|\\not>|\\not\\ge|\\not\\succ|\\notsucceq|\\not\\supset|\\notsupseteq|\\not\\sqsupseteq|\\notin|\\not=|\\not\\equiv|\\not\\sim|\\not\\simeq|\\not\\approx|\\not\\cong|\\not\\asymp)/1/g; |
|
$garbage=~s/(\\leftarrow|\\gets|\\Leftarrow|\\rightarrow|\\to|\\Rightarrow|\\leftrightarrow|\\Leftrightarrow|\\mapsto|\\hookleftarrow|\\leftharpoonup|\\leftkarpoondown|\\rightleftharpoons|\\longleftarrow|\\Longleftarrow|\\longrightarrow|\\Longrightarrow|\\longleftrightarrow|\\Longleftrightarrow|\\longmapsto|\\hookrightarrow|\\rightharpoonup|\\rightharpoondown|\\uparrow|\\Uparrow|\\downarrow|\\Downarrow|\\updownarrow|\\Updownarrow|\\nearrow|\\searrow|\\swarrow|\\nwarrow)/1/g; |
|
$garbage=~s/(\\aleph|\\hbar|\\imath|\\jmath|\\ell|\\wp|\\Re|\\Im|\\mho|\\prime|\\emptyset|\\nabla|\\surd|\\partial|\\top|\\bot|\\vdash|\\dashv|\\forall|\\exists|\\neg|\\flat|\\natural|\\sharp|\\\||\\angle|\\backslash|\\Box|\\Diamond|\\triangle|\\clubsuit|\\diamondsuit|\\heartsuit|\\spadesuit|\\Join|\\infty)/ /g; |
|
$garbage=~s/(\\hat{([^}]+)}|\\check{([^}]+)}|\\dot{([^}]+)}|\\breve{([^}]+)}|\\acute{([^}]+)}|\\ddot{([^}]+)}|\\grave{([^}]+)}|\\tilde{([^}]+)}|\\mathring{([^}]+)}|\\bar{([^}]+)}|\\vec{([^}]+)})/$1/g; |
|
my $value=length($garbage); |
|
return $value; |
|
} |
|
|
|
|
|
|
|
|
1; |
1; |
__END__ |
__END__ |