--- loncom/xml/londefdef.pm 2008/11/10 11:17:50 1.396 +++ loncom/xml/londefdef.pm 2008/11/24 18:55:01 1.397 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Tags Default Definition Module # -# $Id: londefdef.pm,v 1.396 2008/11/10 11:17:50 foxr Exp $ +# $Id: londefdef.pm,v 1.397 2008/11/24 18:55:01 jms Exp $ # # # Copyright Michigan State University Board of Trustees @@ -4304,27 +4304,9 @@ sub image_replication { } return ''; } -# -# Get correct sizing parameter for an image given -# it's initial ht. and wid. This allows sizing of -# images that are generated on-the-fly (e.g. gnuplot) -# as well as serving as a utility for image_size. -# -# Parameter: -# height_param -# width_param - Initial picture dimensions. -# scaling - A scale factor. -# parstack, - the current stack of tag attributes -# from the xml parser -# safeeval, - pointer to the safespace -# depth, - from what level in the stack to look for attributes -# (assumes -1 if unspecified) -# cis - look for attrubutes case insensitively -# (assumes false) -# -# Returns: -# height, width - new dimensions. -# + + + sub resize_image { my ($height_param, $width_param, $scaling, $parstack, $safeeval, $depth, $cis) = @_; @@ -4514,11 +4496,8 @@ sub 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 { my $argument = shift; if (not $argument=~/(mm|cm|in|pc|pt)/) {return $argument.' mm';} @@ -4562,19 +4541,7 @@ sub LATEX_length { return $value; } -# Wrap image 'stuff' inside of the LaTeX required to implement -# alignment: -# align_tex_image(align, latex_rendering, image) -# Where: -# align - The HTML alignment specification. -# latex_rendering - rendering hint for latex. -# image - The LaTeX needed to insert the image itsef. -# width,height - dimensions of the image. -# Returns: -# The 1/2 wrapped image and the stuff required to close the -# wrappage. This allows e.g. randomlabel to insert more stuff -# into the closure. -# + sub align_latex_image { my ($align, $latex_rendering, $image, $width, $height) = @_; my $currentstring; # The 1/2 wrapped image. @@ -4641,16 +4608,7 @@ sub align_latex_image { return ($currentstring, $closure); } -# 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; @@ -4663,5 +4621,106 @@ sub is_inside_of { } +=pod + +=head1 NAME + +Apache::londefdef.pm + +=head1 SYNOPSIS + +Tags Default Definition Module + +This is part of the LearningOnline Network with CAPA project +described at http://www.lon-capa.org. + + +=head1 NOTABLE SUBROUTINES + +=over + +=item start_hideweboutput() + +=item end_hideweboutput() + +=item image_replication() + +=item resize_image() + + Get correct sizing parameter for an image given + it's initial ht. and wid. This allows sizing of + images that are generated on-the-fly (e.g. gnuplot) + as well as serving as a utility for image_size. + + Parameter: + height_param + width_param - Initial picture dimensions. + scaling - A scale factor. + parstack, - the current stack of tag attributes + from the xml parser + safeeval, - pointer to the safespace + depth, - from what level in the stack to look for attributes + (assumes -1 if unspecified) + cis - look for attrubutes case insensitively + (assumes false) + + Returns: + height, width - new dimensions. + +=item image_size() + +=item image_width() + +=item image_height() + +=item get_eps_image() + +=item eps_generation() + +=item file_path() + +=item recalc() + + 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 + +=item LATEX_length() + +=item align_latex_image() + + Wrap image 'stuff' inside of the LaTeX required to implement + alignment: + align_tex_image(align, latex_rendering, image) + Where: + align - The HTML alignment specification. + latex_rendering - rendering hint for latex. + image - The LaTeX needed to insert the image itsef. + width,height - dimensions of the image. + Returns: + The 1/2 wrapped image and the stuff required to close the + wrappage. This allows e.g. randomlabel to insert more stuff + into the closure. + + +=item 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.... + } + + + +=back + +=cut + + 1; __END__