version 1.279, 2005/07/11 09:49:59
|
version 1.317, 2006/01/27 23:56:55
|
Line 47 use Image::Magick;
|
Line 47 use Image::Magick;
|
use Apache::lonmenu(); |
use Apache::lonmenu(); |
use Apache::lonmeta(); |
use Apache::lonmeta(); |
use Apache::Constants qw(:common); |
use Apache::Constants qw(:common); |
|
use File::Basename; |
|
# use Data::Dumper; |
|
|
BEGIN { |
BEGIN { |
|
|
Line 55 BEGIN {
|
Line 56 BEGIN {
|
|
|
} |
} |
|
|
|
# |
|
# Dumps all elements of the table structure. |
|
# Need this 'cause evidently when given an array, Data::Dumper only seems |
|
# to dump element 0. |
|
# |
|
#sub debug_dump_table { |
|
# my $lastrow = $#Apache::londefdef::table; |
|
# &Apache::lonnet::logthis("Dumping table: Last row index: $lastrow"); |
|
# my $row; |
|
# for ($row =0; $row <= $lastrow; $row++ ) { |
|
# my $text = Dumper($Apache::londefdef::table[$row]); |
|
# &Apache::lonnet::logthis("table [ $row ]".$text); |
|
# } |
|
#} |
sub initialize_londefdef { |
sub initialize_londefdef { |
$Apache::londefdef::TD_redirection=0; |
$Apache::londefdef::TD_redirection=0; |
@Apache::londefdef::table = (); |
@Apache::londefdef::table = (); |
Line 90 sub start_m {
|
Line 105 sub start_m {
|
$inside=&Apache::run::evaluate($inside,$safeeval,$$parstack[-1]); |
$inside=&Apache::run::evaluate($inside,$safeeval,$$parstack[-1]); |
#&Apache::lonxml::debug("M is evaulated to:$inside:"); |
#&Apache::lonxml::debug("M is evaulated to:$inside:"); |
} |
} |
|
my $tex = $inside; |
my $display=&Apache::lonxml::get_param('display',$parstack,$safeeval); |
my $display=&Apache::lonxml::get_param('display',$parstack,$safeeval); |
$currentstring = &Apache::lontexconvert::converted(\$inside,$display); |
$currentstring = &Apache::lontexconvert::converted(\$inside,$display); |
if ($Apache::lontexconvert::errorstring) { |
if ($Apache::lontexconvert::errorstring) { |
&Apache::lonxml::warning("tth error: ". |
my $errormsg='<pre>'.&HTML::Entities::encode($Apache::lontexconvert::errorstring,'<>&"').'</pre> occured while attempting to convert this TeX: <pre>'; |
$Apache::lontexconvert::errorstring); |
$tex = &HTML::Entities::encode($tex,'<>&"'); |
|
my ($linenumber) = |
|
($Apache::lontexconvert::errorstring =~ /Line (\d+)/); |
|
if (defined($linenumber)) { |
|
my @tex=split("\n",$tex); |
|
$tex[$linenumber]='<b><font color="red">'. |
|
$tex[$linenumber].'</font></b>'; |
|
$tex=join("\n",@tex); |
|
} |
|
&Apache::lonxml::warning($errormsg.$tex.'</pre>'); |
$Apache::lontexconvert::errorstring=''; |
$Apache::lontexconvert::errorstring=''; |
} |
} |
#&Apache::lonxml::debug("M is ends with:$currentstring:"); |
#&Apache::lonxml::debug("M is ends with:$currentstring:"); |
Line 109 sub start_m {
|
Line 134 sub start_m {
|
# detect simple math mode entry exits, and convert them |
# detect simple math mode entry exits, and convert them |
# to use \ensuremath |
# to use \ensuremath |
if ($currentstring=~/^\s*\$[^\$].*[^\$]\$\s*$/) { |
if ($currentstring=~/^\s*\$[^\$].*[^\$]\$\s*$/) { |
$currentstring=~s/^\$//; |
$currentstring=~s/^(\s*)\$/$1/; |
$currentstring=~s/\$$//; |
$currentstring=~s/\$(\s*)$/$1/; |
$currentstring='\ensuremath{'.$currentstring.'}'; |
$currentstring='\ensuremath{'.$currentstring.'}'; |
} |
} |
$Apache::lonxml::post_evaluate=0; |
$Apache::lonxml::post_evaluate=0; |
Line 128 sub end_m {
|
Line 153 sub end_m {
|
} |
} |
|
|
sub start_tthoption { |
sub start_tthoption { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style) = @_; |
my $result; |
my $result; |
if ($target eq 'web') { |
if ($target eq 'web') { |
my $inside = &Apache::lonxml::get_all_text("/tthoption",$parser); |
my $inside = &Apache::lonxml::get_all_text("/tthoption",$parser, |
|
$style); |
$inside=~s/^\s*//; |
$inside=~s/^\s*//; |
if ($env{'browser.mathml'}) { |
if ($env{'browser.mathml'}) { |
&tth::ttmoptions($inside); |
&tth::ttmoptions($inside); |
Line 157 sub start_html {
|
Line 183 sub start_html {
|
if ($target eq 'web' || $target eq 'edit' || $target eq 'webgrade' ) { |
if ($target eq 'web' || $target eq 'edit' || $target eq 'webgrade' ) { |
$currentstring = &Apache::lonxml::xmlbegin(); |
$currentstring = &Apache::lonxml::xmlbegin(); |
} elsif ($target eq 'tex') { |
} elsif ($target eq 'tex') { |
$currentstring .= '\documentclass[letterpaper]{article}'; |
$currentstring .= '\documentclass[letterpaper,twoside]{article}'; |
if (($env{'form.latex_type'}=~'batchmode') || |
if (($env{'form.latex_type'}=~'batchmode') || |
(!$env{'request.role.adv'})) {$currentstring .='\batchmode';} |
(!$env{'request.role.adv'})) {$currentstring .='\batchmode';} |
$currentstring .= '\newcommand{\keephidden}[1]{}'. |
$currentstring .= '\newcommand{\keephidden}[1]{}'. |
'\renewcommand{\deg}{$^{\circ}$}'. |
'\renewcommand{\deg}{$^{\circ}$}'. |
|
'\usepackage{multirow}'. |
'\usepackage{longtable}'. |
'\usepackage{longtable}'. |
'\usepackage{textcomp}'. |
'\usepackage{textcomp}'. |
'\usepackage{makeidx}'. |
'\usepackage{makeidx}'. |
'\usepackage[dvips]{graphicx}'. |
'\usepackage[dvips]{graphicx}'. |
|
'\usepackage{wrapfig}'. |
'\usepackage{picins}'. |
'\usepackage{picins}'. |
'\usepackage{epsfig}'. |
'\usepackage{epsfig}'. |
'\usepackage{calc}'. |
'\usepackage{calc}'. |
Line 367 sub end_title {
|
Line 395 sub end_title {
|
|
|
#-- <meta> tag (end tag forbidden) |
#-- <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,$style) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
if ($target eq 'web') { |
if ($target eq 'web') { |
my $args=''; |
my $args=''; |
if ( $#$parstack > -1 ) { $args=$$parstack[$#$parstack]; } |
if ( $#$parstack > -1 ) { $args=$$parstack[$#$parstack]; } |
if ($args eq '') { |
if ($args eq '') { |
&Apache::lonxml::get_all_text("/meta",$parser); |
&Apache::lonxml::get_all_text("/meta",$parser,$style); |
} else { |
} else { |
$currentstring = $token->[4]; |
$currentstring = $token->[4]; |
} |
} |
Line 436 sub end_meta {
|
Line 464 sub end_meta {
|
|
|
# accessrule |
# accessrule |
sub start_accessrule { |
sub start_accessrule { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
my $eff=&Apache::lonxml::get_param |
my $eff=&Apache::lonxml::get_param |
('effect',$parstack,$safeeval,undef,1); |
('effect',$parstack,$safeeval,undef,1); |
Line 455 sub start_accessrule {
|
Line 483 sub start_accessrule {
|
my $args=''; |
my $args=''; |
if ( $#$parstack > -1 ) { $args=$$parstack[$#$parstack]; } |
if ( $#$parstack > -1 ) { $args=$$parstack[$#$parstack]; } |
if ($args eq '') { |
if ($args eq '') { |
&Apache::lonxml::get_all_text("/accessrule",$parser); |
&Apache::lonxml::get_all_text("/accessrule",$parser,$style); |
} else { |
} else { |
$currentstring = $token->[4]; |
$currentstring = $token->[4]; |
} |
} |
Line 540 sub start_body {
|
Line 568 sub start_body {
|
$currentstring.=' '.$_.'="'.$token->[2]->{$_}.'"'; |
$currentstring.=' '.$_.'="'.$token->[2]->{$_}.'"'; |
} |
} |
$currentstring.='>'; |
$currentstring.='>'; |
|
&Apache::lontexconvert::jsMath_reset(); |
|
if ($env{'environment.texengine'} eq 'jsMath') { |
|
$currentstring.=&Apache::lontexconvert::jsMath_header(); |
|
} |
if ($env{'request.state'} ne 'published') { |
if ($env{'request.state'} ne 'published') { |
if ($env{'environment.remote'} eq 'off') { |
if ($env{'environment.remote'} eq 'off') { |
$currentstring.= |
$currentstring.= |
Line 572 sub end_body {
|
Line 604 sub end_body {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
|
# \begin{center} causes a new paragprah spacing that looks odd inside |
|
# of a table cell |
|
sub center_correction { return '\vspace*{-6 mm}'; } |
#-- <center> tag (end tag required) |
#-- <center> tag (end tag required) |
sub start_center { |
sub start_center { |
my ($target,$token) = @_; |
my ($target,$token,$tagstack) = @_; |
my $currentstring = &end_p(); # Close off any prior para. |
my $currentstring = &end_p(); # Close off any prior para. |
if ($target eq 'web') { |
if ($target eq 'web') { |
$currentstring .= $token->[4]; |
$currentstring .= $token->[4]; |
} elsif ($target eq 'tex') { |
} elsif ($target eq 'tex') { |
|
if (&is_inside_of($tagstack, "table")) { |
|
$currentstring .= ¢er_correction(); |
|
} |
$currentstring .= '\begin{center}'; |
$currentstring .= '\begin{center}'; |
} |
} |
return $currentstring; |
return $currentstring; |
} |
} |
|
|
sub end_center { |
sub end_center { |
my ($target,$token) = @_; |
my ($target,$token,$tagstack) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
if ($target eq 'web') { |
if ($target eq 'web') { |
$currentstring = $token->[2]; |
$currentstring = $token->[2]; |
Line 1156 sub start_p {
|
Line 1194 sub start_p {
|
$closing_string = '</p>'; # Deal correctly with <p /> e.g. |
$closing_string = '</p>'; # Deal correctly with <p /> e.g. |
} |
} |
} elsif ($target eq 'tex' && !$para_disabled) { |
} elsif ($target eq 'tex' && !$para_disabled) { |
|
|
$currentstring .= &end_p(); # close off prior para if in progress. |
$currentstring .= &end_p(); # close off prior para if in progress. |
my $align=&Apache::lonxml::get_param('align',$parstack,$safeeval,undef,1); |
my $align=&Apache::lonxml::get_param('align',$parstack,$safeeval,undef,1); |
if ($align eq 'center') { |
if ($align eq 'center') { |
$currentstring .='\begin{center}\par'; |
$currentstring .='\begin{center}\par'; |
$closing_string = '\end{center}'; |
$closing_string = '\end{center}'; |
|
if (&is_inside_of($tagstack, "table")) { |
|
$currentstring = ¢er_correction().$currentstring; |
|
} |
} elsif ($align eq 'right') { |
} elsif ($align eq 'right') { |
$currentstring.='\makebox['.$env{'form.textwidth'}.']{\hfill\llap{'; |
$currentstring.='\makebox['.$env{'form.textwidth'}.']{\hfill\llap{'; |
$closing_string= '}}'; |
$closing_string= '}}'; |
Line 1169 sub start_p {
|
Line 1211 sub start_p {
|
$closing_string = '}\hfill}'; |
$closing_string = '}\hfill}'; |
} else { |
} else { |
$currentstring.='\par '; |
$currentstring.='\par '; |
$closing_string = '\strut\\\\\strut '; |
if (&is_inside_of($tagstack, 'table')) { |
|
$closing_string = '\vskip 0pt'; # Seems to be consistent with <p> in tables. |
|
} else { |
|
$closing_string = '\strut\\\\\strut '; |
|
} |
} |
} |
|
|
} |
} |
Line 1201 sub start_br {
|
Line 1247 sub start_br {
|
} elsif ($target eq 'tex') { |
} elsif ($target eq 'tex') { |
my @tempo=@$tagstack; |
my @tempo=@$tagstack; |
my $signal=0; |
my $signal=0; |
|
# Not going to factor this to is_inside_of since that would require |
|
# multiple stack traversals. |
|
# |
for (my $i=$#tempo;$i>=0;$i--) { |
for (my $i=$#tempo;$i>=0;$i--) { |
if (($tempo[$i] eq 'b') || ($tempo[$i] eq 'strong') || |
if (($tempo[$i] eq 'b') || ($tempo[$i] eq 'strong') || |
($tempo[$i] eq 'ol') || ($tempo[$i] eq 'ul') || |
($tempo[$i] eq 'ol') || ($tempo[$i] eq 'ul') || |
Line 1475 sub end_hr {
|
Line 1524 sub end_hr {
|
} |
} |
|
|
#-- <div> tag (end tag required) |
#-- <div> tag (end tag required) |
|
{ |
|
|
|
# Since div can be nested, the stack below is used |
|
# in 'tex' mode to store the ending strings |
|
# for the div stack. |
|
|
|
my @div_end_stack; |
|
|
sub start_div { |
sub start_div { |
my ($target,$token) = @_; |
my ($target,$token, $tagstack, $parstack, $parser, $safeeval) = @_; |
my $currentstring = &end_p(); # Close enclosing para. |
my $currentstring = &end_p(); # Close enclosing para. |
if ($target eq 'web') { |
if ($target eq 'web') { |
$currentstring .= $token->[4]; |
$currentstring .= $token->[4]; |
} |
} |
|
if ($target eq 'tex') { |
|
# 4 possible alignments: left, right, center, and -missing-. |
|
|
|
my $endstring = ''; |
|
|
|
my $align = lc(&Apache::lonxml::get_param('align', $parstack, |
|
$safeeval, undef, 1)); |
|
if ($align eq 'center') { |
|
$currentstring .= '\begin{center}'; |
|
$endstring = '\end{center}'; |
|
if (&is_inside_of($tagstack, "table")) { |
|
$currentstring = ¢er_correction().$currentstring; |
|
} |
|
} |
|
elsif ($align eq 'right') { |
|
$currentstring .= '\begin{flushright}'; |
|
$endstring .= '\end{flushright}'; |
|
} elsif ($align eq 'left') { |
|
$currentstring .= '\begin{flushleft}'; |
|
$endstring = '\end{flushleft}'; |
|
} else { |
|
|
|
} |
|
$currentstring .= "\n"; # For human readability. |
|
$endstring = "\n$endstring\n"; # For human readability |
|
push(@div_end_stack, $endstring); |
|
} |
return $currentstring; |
return $currentstring; |
} |
} |
|
|
Line 1489 sub end_div {
|
Line 1573 sub end_div {
|
my $currentstring = ''; |
my $currentstring = ''; |
if ($target eq 'web') { |
if ($target eq 'web') { |
$currentstring .= $token->[2]; |
$currentstring .= $token->[2]; |
} |
} |
|
if ($target eq 'tex') { |
|
my $endstring = pop @div_end_stack; |
|
$currentstring .= $endstring; |
|
} |
return $currentstring; |
return $currentstring; |
} |
} |
|
} |
|
|
#-- <a> tag (end tag required) |
#-- <a> tag (end tag required) |
sub start_a { |
sub start_a { |
Line 1879 sub start_table {
|
Line 1968 sub start_table {
|
} |
} |
} |
} |
} |
} |
|
|
|
# width either comes forced from the TeXwidth or the width parameters. |
|
# in either case it can be a percentage or absolute width. |
|
# in the width case we ignore absolute width |
my $TeXwidth = &Apache::lonxml::get_param('TeXwidth',$parstack,$safeeval,undef,0); |
my $TeXwidth = &Apache::lonxml::get_param('TeXwidth',$parstack,$safeeval,undef,0); |
if (not defined $TeXwidth) { |
if (!defined($TeXwidth)) { |
my $htmlwidth = &Apache::lonxml::get_param('width',$parstack,$safeeval,undef,1); |
my $htmlwidth = &Apache::lonxml::get_param('width',$parstack, |
if ($htmlwidth=~/%/) { |
$safeeval,undef,1); |
$Apache::londefdef::table[-1]{'percent'}=1; |
if ($htmlwidth =~ /%/) { |
$htmlwidth=~/(\d+)/; |
$TeXwidth = $htmlwidth; |
$Apache::londefdef::table[-1]{'width'}=$1*$textwidth/100;; |
} else { |
} else { |
$TeXwidth = $textwidth; |
$Apache::londefdef::table[-1]{'width'}=$textwidth; |
|
} |
} |
} elsif ($TeXwidth=~/%/) { |
} else { |
|
$Apache::londefdef::table[-1]{'forcedtablewidth'} = 1; |
|
} |
|
if ($TeXwidth=~/%/) { |
$Apache::londefdef::table[-1]{'percent'}=1; |
$Apache::londefdef::table[-1]{'percent'}=1; |
$TeXwidth=~/(\d+)/; |
$TeXwidth=~/(\d+)/; |
$Apache::londefdef::table[-1]{'width'}=$1*$textwidth/100; |
$Apache::londefdef::table[-1]{'width'}=$1*$textwidth/100; |
} else { |
} else { |
$Apache::londefdef::table[-1]{'forcetablewidth'}=1; |
|
$Apache::londefdef::table[-1]{'width'}=$TeXwidth; |
$Apache::londefdef::table[-1]{'width'}=$TeXwidth; |
} |
} |
|
# In the end, however the table width cannot be wider than $textwidth... |
|
|
|
if ($Apache::londefdef::table[-1]{'width'} > $textwidth) { |
|
$Apache::londefdef::table[-1]{'width'} = $textwidth; |
|
} |
|
|
#table's border |
#table's border |
my $border = &Apache::lonxml::get_param('border',$parstack,$safeeval); |
my $border = &Apache::lonxml::get_param('border',$parstack,$safeeval); |
my $permission=&Apache::lonxml::get_param('TeXDropEmptyColumns',$parstack,$safeeval,undef,0); |
my $permission=&Apache::lonxml::get_param('TeXDropEmptyColumns',$parstack,$safeeval,undef,0); |
Line 1911 sub start_table {
|
Line 2011 sub start_table {
|
$Apache::londefdef::table[-1]{'vvinc'} = ''; |
$Apache::londefdef::table[-1]{'vvinc'} = ''; |
} |
} |
if ($#Apache::londefdef::table==0) { |
if ($#Apache::londefdef::table==0) { |
$Apache::londefdef::table[-1]{'output'}='\strut\newline\strut\setlength{\tabcolsep}{1 mm}'; |
# Note that \newline seems to destroy the alignment envs. |
|
# $Apache::londefdef::table[-1]{'output'}='\strut\newline\strut\setlength{\tabcolsep}{1 mm}'; |
|
$Apache::londefdef::table[-1]{'output'}='\strut'.'\\\\'."\n".'\strut\setlength{\tabcolsep}{1 mm}'; |
} |
} |
$Apache::londefdef::table[-1]{'output'}.=' \noindent \begin{tabular} '; |
$Apache::londefdef::table[-1]{'output'}.=' \noindent \begin{tabular} '; |
$Apache::londefdef::table[-1]{'TeXlen'}=[]; |
$Apache::londefdef::table[-1]{'TeXlen'}=[]; |
Line 1922 sub start_table {
|
Line 2024 sub start_table {
|
$Apache::londefdef::table[-1]{'content'}=[]; |
$Apache::londefdef::table[-1]{'content'}=[]; |
$Apache::londefdef::table[-1]{'align'}=[]; |
$Apache::londefdef::table[-1]{'align'}=[]; |
$currentstring.='\keephidden{NEW TABLE ENTRY}'; |
$currentstring.='\keephidden{NEW TABLE ENTRY}'; |
} |
|
|
|
|
} |
return $currentstring; |
return $currentstring; |
} |
} |
|
|
Line 1935 sub end_table {
|
Line 2039 sub end_table {
|
my $inmemory = ''; |
my $inmemory = ''; |
my $output = ''; |
my $output = ''; |
my $WARNING=''; |
my $WARNING=''; |
|
# &debug_dump_table($Apache::londefdef::table[-1]); |
#width of columns from TeXwidth attributes |
#width of columns from TeXwidth attributes |
|
|
for (my $in=0;$in<=$Apache::londefdef::table[-1]{'row_number'};$in++) { |
for (my $in=0;$in<=$Apache::londefdef::table[-1]{'row_number'};$in++) { |
for (my $jn=0;$jn<=$Apache::londefdef::table[-1]{'counter_columns'};$jn++) { |
for (my $jn=0;$jn<=$Apache::londefdef::table[-1]{'counter_columns'};$jn++) { |
if ($Apache::londefdef::table[-1]{'TeXlen'}[0][$jn]<$Apache::londefdef::table[-1]{'TeXlen'}[$in][$jn]) { |
if ($Apache::londefdef::table[-1]{'TeXlen'}[0][$jn]<$Apache::londefdef::table[-1]{'TeXlen'}[$in][$jn]) { |
Line 2118 sub end_table {
|
Line 2224 sub end_table {
|
$header_of_table .= '}'; |
$header_of_table .= '}'; |
#fill the table |
#fill the table |
for (my $in=0;$in<=$Apache::londefdef::table[-1]{'row_number'};$in++) { |
for (my $in=0;$in<=$Apache::londefdef::table[-1]{'row_number'};$in++) { |
|
my $have_rowspan = 0; |
for (my $jn=0;$jn<=$#fwidth;$jn++) { |
for (my $jn=0;$jn<=$#fwidth;$jn++) { |
|
# |
|
# Do the appropriate magic if this has a colspan |
|
# |
|
my $colspan = $Apache::londefdef::table[-1]{'colspan'}[$in][$jn]; |
|
if ($colspan > 1) { |
|
$output .= '\multicolumn{'. |
|
$colspan |
|
.'}{|l|}{'; |
|
} |
|
my $rowspan = $Apache::londefdef::table[-1]{'rowspan'}[$in][$jn]; |
|
|
|
# Start a rowspan if necessary: |
|
|
|
if ($rowspan > 1) { |
|
$have_rowspan++; |
|
$output .= '\multirow{'.$rowspan.'}[0]{'.$fwidth[$jn].'mm}{'; |
|
} |
|
if (($rowspan eq '^') || ($rowspan eq '_')) { |
|
$have_rowspan++; |
|
} |
|
|
if ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'c') { |
if ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'c') { |
$output.='\vspace*{-6 mm}\begin{center}'; |
$output.=¢er_correction().'\begin{center}'; |
} elsif ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'r') { |
} elsif ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'r') { |
$output.=' \hfill \llap{' |
$output.=' \hfill \llap{' |
} |
} |
$output.=$Apache::londefdef::table[-1]{'content'}[$in][$jn]; |
$output.=$Apache::londefdef::table[-1]{'content'}[$in][$jn]; |
if ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'c') { |
if ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'c') { |
$output.='\end{center}\vspace*{-6 mm}'; |
$output.='\end{center}'; |
} elsif ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'r') { |
} elsif ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'r') { |
$output.='} '; |
$output.='} '; |
} |
} |
|
# Close off any open multirow: |
|
|
|
if ($rowspan > 1) { |
|
$output .= '}'; |
|
} |
|
# Close off the colspan... |
|
# |
|
if ($colspan > 1) { |
|
$output .= '}'; |
|
$jn += $colspan-1; # Adjust for number of rows really left. |
|
} |
if ($jn!=$#fwidth) {$output.=' '.$Apache::londefdef::table[-1]{'vinc'};} |
if ($jn!=$#fwidth) {$output.=' '.$Apache::londefdef::table[-1]{'vinc'};} |
} |
} |
$output.=' \\\\ '.$Apache::londefdef::table[-1]{'hinc'}.' '; |
# If have_rowspan > 0, and borders are on, then |
|
# we need to do more than put an \hline at the bottom of row. |
|
# we need to do the appropriate \cline to ensure that |
|
# the spanned rows don't have \hlines through them. |
|
|
|
if (($Apache::londefdef::table[-1]{'hinc'} =~ /\\hline/) && $have_rowspan) { |
|
$output .= ' \\\\ '; |
|
for (my $jn=0; $jn<=$#fwidth;$jn++) { |
|
my $rowspan = $Apache::londefdef::table[-1]{'rowspan'}[$in][$jn]; |
|
if (($rowspan <= 1) || ($rowspan eq '_')) { |
|
my $column = $jn+1; |
|
$output .= '\cline{'.$column.'-'.$column.'} '; |
|
} |
|
} |
|
|
|
} else { |
|
$output.=' \\\\ '.$Apache::londefdef::table[-1]{'hinc'}.' '; |
|
} |
} |
} |
$Apache::londefdef::table[-1]{'output'} .= $header_of_table.$Apache::londefdef::table[-1]{'hinc'}.$output.'\end{tabular}\strut\newline\strut '; |
# Note that \newline destroys alignment env's produced by e.g. <div> |
|
# $Apache::londefdef::table[-1]{'output'} .= $header_of_table.$Apache::londefdef::table[-1]{'hinc'}.$output.'\end{tabular}\strut\newline\strut '; |
|
$Apache::londefdef::table[-1]{'output'} .= $header_of_table.$Apache::londefdef::table[-1]{'hinc'}.$output.'\end{tabular}\strut'.'\\\\'."\n".'\strut '; |
if ($#Apache::londefdef::table > 0) { |
if ($#Apache::londefdef::table > 0) { |
my $inmemory = $Apache::londefdef::table[-1]{'output'}; |
my $inmemory = $Apache::londefdef::table[-1]{'output'}; |
|
# Figure out max/and min width by summing us and then |
|
# apply that to the current column of the table we nest in |
|
# if it's larger than the current width or the current width |
|
# is undefined. |
|
# |
|
my $min_nested_width = 0; |
|
my $max_nested_width = 0; |
|
for (my $col = 0; $col <= $Apache::londefdef::table[-1]{'counter_columns'}; $col++) { |
|
$min_nested_width += $min_len[$col]; |
|
$max_nested_width += $max_len[$col]; |
|
|
|
} |
|
# Fudge in an extra 5 mm for borders etc: |
|
|
|
$min_nested_width += 5; |
|
$max_nested_width += 5; |
|
|
|
my $outer_column = $Apache::londefdef::table[-2]{'counter_columns'}; |
|
my $outer_row = $Apache::londefdef::table[-2]{'row_number'}; |
|
if ($min_nested_width > $Apache::londefdef::table[-2]{'minlen'}[$outer_row][$outer_column]) { |
|
$Apache::londefdef::table[-2]{'minlen'}[$outer_row][$outer_column] = $min_nested_width; |
|
} |
|
if ($max_nested_width > $Apache::londefdef::table[-2]{'maxlen'}[$outer_row][$outer_column]) { |
|
$Apache::londefdef::table[-2]{'maxlen'}[$outer_row][$outer_column] = $max_nested_width; |
|
} |
|
|
pop @Apache::londefdef::table; |
pop @Apache::londefdef::table; |
push @{$Apache::londefdef::table[-1]{'include'}}, $inmemory; |
push @{$Apache::londefdef::table[-1]{'include'}}, $inmemory; |
} else { |
} else { |
Line 2163 sub start_tr {
|
Line 2347 sub start_tr {
|
push @ {$Apache::londefdef::table[-1]{'rows'} }, 'l'; |
push @ {$Apache::londefdef::table[-1]{'rows'} }, 'l'; |
} |
} |
push ( @{ $Apache::londefdef::table[-1]{'rowdata'} }, $Apache::londefdef::table[-1]{'hinc'}); |
push ( @{ $Apache::londefdef::table[-1]{'rowdata'} }, $Apache::londefdef::table[-1]{'hinc'}); |
|
# |
|
# Need to save the number of table columns to preserve the max # columns. |
|
# |
|
$Apache::londefdef::table[-1]{'prior_columns'} = $Apache::londefdef::table[-1]{'counter_columns'}; |
$Apache::londefdef::table[-1]{'counter_columns'} = -1; |
$Apache::londefdef::table[-1]{'counter_columns'} = -1; |
push @ {$Apache::londefdef::table[-1]{'TeXlen'}}, []; |
push @ {$Apache::londefdef::table[-1]{'TeXlen'}}, []; |
push @ {$Apache::londefdef::table[-1]{'objectlen'}}, []; |
push @ {$Apache::londefdef::table[-1]{'objectlen'}}, []; |
Line 2182 sub end_tr {
|
Line 2370 sub end_tr {
|
if ($Apache::londefdef::TD_redirection) { |
if ($Apache::londefdef::TD_redirection) { |
&end_td_tex($parstack,$parser,$safeeval); |
&end_td_tex($parstack,$parser,$safeeval); |
} |
} |
|
# Counter columns must be the maximum number of columns seen |
|
# in the table so far so: |
|
if ($Apache::londefdef::table[-1]{'prior_columns'} > $Apache::londefdef::table[-1]{'counter_columns'}) { |
|
$Apache::londefdef::table[-1]{'counter_columns'} = $Apache::londefdef::table[-1]{'prior_columns'}; |
|
} |
|
|
|
|
|
|
} |
} |
return $currentstring; |
return $currentstring; |
} |
} |
Line 2236 sub start_td_tex {
|
Line 2432 sub start_td_tex {
|
|
|
sub end_td_tex { |
sub end_td_tex { |
my ($parstack,$parser,$safeeval) = @_; |
my ($parstack,$parser,$safeeval) = @_; |
my $current_row = $Apache::londefdef::table[-1]{'row_number'}; |
my $current_row = $Apache::londefdef::table[-1]{'row_number'}; |
my $data=&Apache::lonxml::endredirection(); |
my $current_column = $Apache::londefdef::table[-1]{'counter_columns'}; |
|
my $data = &Apache::lonxml::endredirection(); |
|
|
|
# The rowspan array of the table indicates which cells are part of a span. |
|
# n indicates the start of a span set of n rows. |
|
# ^ indicates a cell that continues a span set. |
|
# _ indicates the cell is at the bottom of a span set. |
|
# If this and subsequent cells are part of a rowspan, we must |
|
# push along the row until we find one that is not. |
|
|
|
while ((defined $Apache::londefdef::table[-1]{'rowspan'}[$current_row] [$current_column]) |
|
&& ($Apache::londefdef::table[-1]{'rowspan'}[$current_row][$current_column] =~ /[\^\_]/)) { |
|
# Part of a span. |
|
push @ {$Apache::londefdef::table[-1]{'content'}[-1]}, ''; |
|
$current_column++; |
|
} |
|
$Apache::londefdef::table[-1]{'counter_columns'} = $current_column; |
|
|
|
|
|
|
|
my $rowspan = &Apache::lonxml::get_param('rowspan', $parstack, $safeeval, undef, 0); |
|
if (!$rowspan) { |
|
$rowspan = 1; |
|
} |
|
|
|
|
|
|
|
$Apache::londefdef::table[-1]{'rowspan'}[$current_row][$current_column] = $rowspan; |
|
for (my $i = 1; $i < $rowspan; $i++) { |
|
$Apache::londefdef::table[-1]{'rowspan'}[$current_row+$i][$current_column] = '^'; |
|
if ($i == ($rowspan-1)) { |
|
$Apache::londefdef::table[-1]{'rowspan'}[$current_row+$i][$current_column] = '_'; |
|
} |
|
} |
|
|
my $TeXwidth=&Apache::lonxml::get_param('TeXwidth',$parstack,$safeeval,undef,0); |
my $TeXwidth=&Apache::lonxml::get_param('TeXwidth',$parstack,$safeeval,undef,0); |
if (defined $TeXwidth) { |
if (defined $TeXwidth) { |
push @ {$Apache::londefdef::table[-1]{'objectlen'}[$Apache::londefdef::table[-1]{'row_number'}] },'0'; |
push @ {$Apache::londefdef::table[-1]{'objectlen'}[$Apache::londefdef::table[-1]{'row_number'}] },'0'; |
Line 2314 sub end_td_tex {
|
Line 2544 sub end_td_tex {
|
push @ {$Apache::londefdef::table[-1]{'minlen'}[$Apache::londefdef::table[-1]{'row_number'}] },$min_length; |
push @ {$Apache::londefdef::table[-1]{'minlen'}[$Apache::londefdef::table[-1]{'row_number'}] },$min_length; |
} |
} |
} |
} |
for (my $in=0; $in<=$#{$Apache::londefdef::table[-1]{'include'}};$in++) { |
# Substitute all of the tables nested in this cell in their appropriate places. |
$data=~s/\\keephidden\{NEW TABLE ENTRY\}/$Apache::londefdef::table[-1]{'include'}[$in]/; |
|
} |
|
|
my $nested_count = $#{$Apache::londefdef::table[-1]{'include'}}; # This one is constant... |
|
for (my $in=0; $in<=$nested_count; $in++) { |
|
my $nested = shift @{$Apache::londefdef::table[-1]{'include'}}; |
|
$nested =~ s/\\end\{tabular\}\\strut\\\\/\\end\{tabular\}/; |
|
# $data=~s/\\keephidden\{NEW TABLE ENTRY\}/$Apache::londefdef::table[-1]{'include'}[$in]/; |
|
$data =~ s/\\keephidden\{NEW TABLE ENTRY\}/$nested/; |
|
|
|
} |
|
# Should be be killing off the 'include' elements as they're used up? |
|
|
push @ {$Apache::londefdef::table[-1]{'content'}[-1] },$data; |
push @ {$Apache::londefdef::table[-1]{'content'}[-1] },$data; |
return''; |
|
|
# Get the column and row spans. |
|
# Colspan can be done via \multicolumn if I can figure out the data structs. |
|
|
|
my $colspan = &Apache::lonxml::get_param('colspan', $parstack, $safeeval, undef, 0); |
|
if (!$colspan) { |
|
$colspan = 1; |
|
} |
|
|
|
|
|
# the colspan array will indicate how many columns will be spanned by this |
|
# cell..this requires that counter_columns also be adjusted accordingly |
|
# so that the next bunch of text goes in the right cell. Note that since |
|
# counter_columns is incremented in the start_td_tex, we adjust by colspan-1. |
|
# |
|
|
|
$Apache::londefdef::table[-1]{'colspan'}[$current_row][$current_column] = $colspan; |
|
$Apache::londefdef::table[-1]{'counter_columns'} += $colspan -1; |
|
|
|
# Put empty text in spanned cols. |
|
|
|
for (my $i = 0; $i < ($colspan -1); $i++) { |
|
push @ {$Apache::londefdef::table[-1]{'content'}[-1] },''; |
|
} |
|
|
|
|
|
return ''; |
} |
} |
|
|
sub end_td { |
sub end_td { |
Line 2474 sub end_th {
|
Line 2740 sub end_th {
|
# (Note there seems to also be support for this as a % of page size) |
# (Note there seems to also be support for this as a % of page size) |
# |
# |
sub start_img { |
sub start_img { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style) = @_; |
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')) { |
if (not $src and ($target eq 'web' or $target eq 'tex')) { |
my $inside = &Apache::lonxml::get_all_text("/img",$parser); |
my $inside = &Apache::lonxml::get_all_text("/img",$parser,$style); |
return ''; |
return ''; |
} |
} |
$Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=$src; |
&Apache::lonxml::extlink($src); |
my $currentstring = ''; |
my $currentstring = ''; |
my $scaling = .3; |
my $scaling = .3; |
|
|
Line 2514 sub start_img {
|
Line 2780 sub start_img {
|
$safeeval, |
$safeeval, |
undef,1)); |
undef,1)); |
if(!$align) { |
if(!$align) { |
$align = "bottom"; # This is html's default so it's ours too. |
$align = "bottom"; # This is html's default so it's ours too. |
} |
} |
# |
# |
&Apache::lonxml::debug("Alignemnt = $align"); |
&Apache::lonxml::debug("Alignemnt = $align"); |
Line 2529 sub start_img {
|
Line 2795 sub start_img {
|
$parstack, |
$parstack, |
$safeeval, |
$safeeval, |
undef,0); |
undef,0); |
&Apache::lonxml::debug("LaTeX rendering = $latex_rendering"); |
# &Apache::lonxml::debug("LaTeX rendering = $latex_rendering"); |
if(!$latex_rendering) { |
if(!$latex_rendering) { |
$latex_rendering = "parbox"; |
$latex_rendering = "texwrap"; |
|
} |
|
# using texwrap inside a table does not work. So, if after all of this, |
|
# texwrap is on, we turn it off if we detect we're in a table: |
|
# |
|
if (($latex_rendering eq 'texwrap') && &is_inside_of($tagstack, "table")) { |
|
$latex_rendering = 'parpic'; |
} |
} |
&Apache::lonxml::debug("LaTeX rendering = $latex_rendering image file: $src"); |
# &Apache::lonxml::debug("LaTeX rendering = $latex_rendering image file: $src"); |
|
|
#if original gif/jpg/png file exist do following: |
#if original gif/jpg/png file exist do following: |
my $origsrc=$src; |
my $origsrc=$src; |
Line 2572 sub start_img {
|
Line 2844 sub start_img {
|
} elsif ($align eq "left") { |
} elsif ($align eq "left") { |
if ($latex_rendering eq "parpic") { |
if ($latex_rendering eq "parpic") { |
$currentstring = '\parpic[l]{'.$currentstring.'}'; |
$currentstring = '\parpic[l]{'.$currentstring.'}'; |
} else { # parbox rendering |
} else { # wrapfig render |
$currentstring = "\\strut\\newline\n". |
$currentstring = '\begin{wrapfigure}{l}{'.$width_param.'mm}' |
'\parbox{'.$width_param.'mm}{'.$currentstring.'}'; |
.'\scalebox{1.0}{'.$currentstring.'}\end{wrapfigure}'; |
} |
} |
} elsif ($align eq "right") { |
} elsif ($align eq "right") { |
if ($latex_rendering eq "parpic") { |
if ($latex_rendering eq "parpic") { |
$currentstring = '\parpic[r]{'.$currentstring.'}'; |
$currentstring = '\parpic[r]{'.$currentstring.'}'; |
} else { # parbox rendering. |
} else { # wrapfig rendering |
$currentstring = '\parbox{'.$width_param.'mm}{\begin{flushright}' |
$currentstring = '\begin{wrapfigure}{r}{'.$width_param.'mm}' |
.$currentstring.'\end{flushright}} \newline'."\n"; |
.'\scalebox{1.0}{'.$currentstring.'}\end{wrapfigure}'; |
|
|
} |
} |
} else { # Bottom is also default. |
} else { # Bottom is also default. |
# $currentstring = '\raisebox{'.$height_param.'mm}{'.$currentstring.'}'; |
# $currentstring = '\raisebox{'.$height_param.'mm}{'.$currentstring.'}'; |
Line 2686 sub start_applet {
|
Line 2959 sub start_applet {
|
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
|
|
my $code=&Apache::lonxml::get_param('code',$parstack,$safeeval,undef,1); |
my $code=&Apache::lonxml::get_param('code',$parstack,$safeeval,undef,1); |
$Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=$code; |
&Apache::lonxml::extlink($code); |
|
|
my $archive=&Apache::lonxml::get_param('archive',$parstack,$safeeval, |
my $archive=&Apache::lonxml::get_param('archive',$parstack,$safeeval, |
undef,1); |
undef,1); |
$Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=$archive; |
&Apache::lonxml::extlink($archive); |
|
|
my $currentstring = ''; |
my $currentstring = ''; |
if ($target eq 'web') { |
if ($target eq 'web') { |
if ($env{'browser.appletsuppress'} ne 'on') { |
if ($env{'browser.appletsuppress'} ne 'on') { |
Line 2737 sub end_applet {
|
Line 3008 sub end_applet {
|
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); |
$Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=$src; |
&Apache::lonxml::extlink($src); |
my $currentstring = ''; |
my $currentstring = ''; |
if ($target eq 'web') { |
if ($target eq 'web') { |
if ($env{'browser.embedsuppress'} ne 'on') { |
if ($env{'browser.embedsuppress'} ne 'on') { |
Line 2768 sub end_embed {
|
Line 3039 sub end_embed {
|
#-- <param> tag (end tag forbidden) |
#-- <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('name',$parstack, |
('name',$parstack,$safeeval,undef,1)=~/^cabbase$/i) { |
$safeeval,undef,1)=~/^cabbase$/i) { |
$Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]= |
my $value=&Apache::lonxml::get_param('value',$parstack, |
&Apache::lonxml::get_param('value',$parstack,$safeeval,undef,1); |
$safeeval,undef,1); |
} |
&Apache::lonxml::extlink($value); |
$Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]= |
} |
&Apache::lonxml::get_param('src',$parstack,$safeeval,undef,1); |
|
|
my $src = &Apache::lonxml::get_param('src',$parstack,$safeeval,undef,1); |
|
&Apache::lonxml::extlink($src); |
my $currentstring = ''; |
my $currentstring = ''; |
if ($target eq 'web') { |
if ($target eq 'web') { |
my %toconvert; |
my %toconvert; |
Line 2806 sub end_param {
|
Line 3079 sub end_param {
|
sub start_allow { |
sub start_allow { |
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); |
$src=&Apache::lonnet::filelocation($Apache::lonxml::pwd[-1],$src); |
&Apache::lonxml::extlink($src); |
$Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]= |
|
&Apache::lonnet::clutter($src); |
|
if ($target eq 'tex') { &image_replication($src); } |
if ($target eq 'tex') { &image_replication($src); } |
my $result; |
my $result; |
if ($target eq 'edit') { |
if ($target eq 'edit') { |
Line 3402 sub end_legend {
|
Line 3674 sub end_legend {
|
|
|
#-- <link> tag (end tag forbidden) |
#-- <link> tag (end tag forbidden) |
sub start_link { |
sub start_link { |
my ($target,$token) = @_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; |
my $currentstring = ''; |
my $currentstring = ''; |
if ($target eq 'web') { |
if ($target eq 'web') { |
|
my $href=&Apache::lonxml::get_param('href',$parstack,$safeeval, |
|
undef,1); |
|
&Apache::lonxml::extlink($href); |
$currentstring = $token->[4]; |
$currentstring = $token->[4]; |
} |
} |
return $currentstring; |
return $currentstring; |
Line 3920 sub image_height {
|
Line 4195 sub image_height {
|
sub get_eps_image { |
sub get_eps_image { |
my ($src)=@_; |
my ($src)=@_; |
my $orig_src=&Apache::lonnet::filelocation($Apache::lonxml::pwd[-1], $src); |
my $orig_src=&Apache::lonnet::filelocation($Apache::lonxml::pwd[-1], $src); |
|
|
|
# In order to prevent the substitution of the alt text, we need to |
|
# be sure the orig_src file is on system now so: |
|
|
|
if (! -e $orig_src) { |
|
&Apache::lonnet::repcopy($orig_src); # Failure is not completely fatal. |
|
} |
&Apache::lonxml::debug("get_eps_image: Original image: $orig_src"); |
&Apache::lonxml::debug("get_eps_image: Original image: $orig_src"); |
|
my ($spath, $sname, $sext) = fileparse($src, qr/\.(gif|png|jpg|jpeg)/i); |
$src=~s/\.(gif|png|jpg|jpeg)$/\.eps/i; |
$src=~s/\.(gif|png|jpg|jpeg)$/\.eps/i; |
$src=&Apache::lonnet::filelocation($Apache::lonxml::pwd[-1],$src); |
$src=&Apache::lonnet::filelocation($Apache::lonxml::pwd[-1],$src); |
&Apache::lonxml::debug("Filelocation gives: $src"); |
&Apache::lonxml::debug("Filelocation gives: $src"); |
Line 3949 sub get_eps_image {
|
Line 4232 sub get_eps_image {
|
close FILE; |
close FILE; |
$src=~s|/home/httpd/html/res|/home/httpd/prtspool|; |
$src=~s|/home/httpd/html/res|/home/httpd/prtspool|; |
$src=~s|/home/([^/]*)/public_html/|/home/httpd/prtspool/$1/|; |
$src=~s|/home/([^/]*)/public_html/|/home/httpd/prtspool/$1/|; |
|
if ($sext ne "") { # Put the ext. back in to uniquify. |
|
$src =~ s/\.eps$/$sext.eps/; |
|
} |
} |
} |
} |
} |
} |
} |
Line 3988 sub file_path {
|
Line 4274 sub file_path {
|
} |
} |
return $file,$path; |
return $file,$path; |
} |
} |
|
# Converts a measurement in to mm from any of |
|
# the other valid LaTeX units of measure. |
|
# If the units of measure are missing from the |
|
# parameter, it is assumed to be in and returned |
|
# with mm units of measure |
sub recalc { |
sub recalc { |
my $argument = shift; |
my $argument = shift; |
if (not $argument=~/(mm|cm|in|pc|pt)/) {return $argument.' mm';} |
if (not $argument=~/(mm|cm|in|pc|pt)/) {return $argument.' mm';} |
Line 4033 sub LATEX_length {
|
Line 4323 sub LATEX_length {
|
} |
} |
|
|
|
|
|
# is_inside_of $tagstack $tag |
|
# This sub returns true if the current state of Xml processing |
|
# is inside of the tag. |
|
# Parameters: |
|
# tagstack - The tagstack from the parser. |
|
# tag - The tag (without the <>'s.). |
|
# Sample usage: |
|
# if (is_inside_of($tagstack "table")) { |
|
# # I'm in a table.... |
|
# } |
|
sub is_inside_of { |
|
my ($tagstack, $tag) = @_; |
|
my @stack = @$tagstack; |
|
for (my $i = ($#stack - 1); $i >= 0; $i--) { |
|
if ($stack[$i] eq $tag) { |
|
return 1; |
|
} |
|
} |
|
return 0; |
|
} |
|
|
|
|
1; |
1; |