diff --git a/conf/defaults.config b/conf/defaults.config index 9a3cb68a81..3832a18041 100644 --- a/conf/defaults.config +++ b/conf/defaults.config @@ -1111,26 +1111,16 @@ $pg{directories}{macrosPath} = [ ".", # search the problem file's directory $courseDirs{macros}, $pg{directories}{macros}, - "$courseDirs{templates}/Library/macros/Alfred", - "$courseDirs{templates}/Library/macros/BrockPhysics", - "$courseDirs{templates}/Library/macros/CollegeOfIdaho", - "$courseDirs{templates}/Library/macros/Dartmouth", - "$courseDirs{templates}/Library/macros/FortLewis", - "$courseDirs{templates}/Library/macros/Hope", - "$courseDirs{templates}/Library/macros/LaTech", - "$courseDirs{templates}/Library/macros/MC", - "$courseDirs{templates}/Library/macros/Michigan", - "$courseDirs{templates}/Library/macros/Mizzou", - "$courseDirs{templates}/Library/macros/NAU", - "$courseDirs{templates}/Library/macros/PCC", - "$courseDirs{templates}/Library/macros/TCNJ", - "$courseDirs{templates}/Library/macros/UBC", - "$courseDirs{templates}/Library/macros/UMass-Amherst", - "$courseDirs{templates}/Library/macros/UW-Stout", - "$courseDirs{templates}/Library/macros/UniSiegen", - "$courseDirs{templates}/Library/macros/Union", - "$courseDirs{templates}/Library/macros/WHFreeman", - "$courseDirs{templates}/Library/macros/Wiley", + "$pg{directories}{macros}/answers", + "$pg{directories}{macros}/capa", + "$pg{directories}{macros}/contexts", + "$pg{directories}{macros}/core", + "$pg{directories}{macros}/graph", + "$pg{directories}{macros}/math", + "$pg{directories}{macros}/misc", + "$pg{directories}{macros}/parsers", + "$pg{directories}{macros}/ui", + "$pg{directories}{macros}/deprecated", ]; $pg{directories}{htmlPath} = [ # paths to search for auxiliary html files (requires full url) diff --git a/doc/parser/macros/Differentiation.pl b/doc/parser/macros/Differentiation.pl deleted file mode 100644 index a052463b4a..0000000000 --- a/doc/parser/macros/Differentiation.pl +++ /dev/null @@ -1,20 +0,0 @@ -# -# Example of how to add new functionality to the Parser. -# -# Here we load new methods for the Parser object classes. Note, however, -# that these are PERSISTANT when used with webwork2 (mod_perl), and so we -# need to take care not to load them more than once. We look for the -# variable $Parser::Differentiation::loaded, which is defined in the -# differentiation package, in order to tell. -# -# DifferentiationDefs.pl is really just a copy of the -# Parser::Differentiation.pm file, and you really could just preload the -# latter instead by uncommenting the 'use Parser::Differentiation' line at -# the bottom of Parser.pm. (This file is really just a sample). The way -# it's done here will load it the first time it gets used, then will keep -# it around, so not much overhead even this way. -# - -loadMacros("DifferentiationDefs.pl") unless $Parser::Differentiation::loaded; - -1; diff --git a/doc/parser/macros/DifferentiationDefs.pl b/doc/parser/macros/DifferentiationDefs.pl deleted file mode 100644 index 38409648f1..0000000000 --- a/doc/parser/macros/DifferentiationDefs.pl +++ /dev/null @@ -1,737 +0,0 @@ -# -# Extend differentiation to multiple variables -# Check differentiation for complex functions -# Do derivatives for norm and unit. -# -# Make shortcuts for getting numbers 1, 2, and sqrt, etc. -# - -################################################## -# -# Differentiate the formula in terms of the given variable -# -sub Parser::D { - my $self = shift; - my $x = shift; - if (!defined($x)) { - my @vars = keys(%{ $self->{variables} }); - my $n = scalar(@vars); - if ($n == 0) { - return $self->new('0') if $self->{isNumber}; - $x = 'x'; - } else { - $self->Error("You must specify a variable to differentiate by") unless $n == 1; - $x = $vars[0]; - } - } else { - return $self->new('0') unless defined $self->{variables}{$x}; - } - return $self->new($self->{tree}->D($x)); -} - -sub Item::D { - my $self = shift; - my $type = ref($self); - $type =~ s/.*:://; - $self->Error("Differentiation for '$type' is not implemented", $self->{ref}); -} - -######################################################################### - -sub Parser::BOP::comma::D { Item::D(shift) } -sub Parser::BOP::union::D { Item::D(shift) } - -sub Parser::BOP::add::D { - my $self = shift; - my $x = shift; - $self = Parser::BOP->new($self->{equation}, $self->{bop}, $self->{lop}->D($x), $self->{rop}->D($x)); - return $self->reduce; -} - -sub Parser::BOP::subtract::D { - my $self = shift; - my $x = shift; - $self = Parser::BOP->new($self->{equation}, $self->{bop}, $self->{lop}->D($x), $self->{rop}->D($x)); - return $self->reduce; -} - -sub Parser::BOP::multiply::D { - my $self = shift; - my $x = shift; - my $equation = $self->{equation}; - $self = Parser::BOP->new( - $equation, '+', - Parser::BOP->new($equation, $self->{bop}, $self->{lop}->D($x), $self->{rop}->copy($equation)), - Parser::BOP->new($equation, $self->{bop}, $self->{lop}->copy($equation), $self->{rop}->D($x)) - ); - return $self->reduce; -} - -sub Parser::BOP::divide::D { - my $self = shift; - my $x = shift; - my $equation = $self->{equation}; - $self = Parser::BOP->new( - $equation, - $self->{bop}, - Parser::BOP->new( - $equation, '-', - Parser::BOP->new($equation, '*', $self->{lop}->D($x), $self->{rop}->copy($equation)), - Parser::BOP->new($equation, '*', $self->{lop}->copy($equation), $self->{rop}->D($x)) - ), - Parser::BOP->new($equation, '^', $self->{rop}, Parser::Number->new($equation, 2)) - ); - return $self->reduce; -} - -sub Parser::BOP::power::D { - my $self = shift; - my $x = shift; - my $equation = $self->{equation}; - my $vars = $self->{rop}->getVariables; - if (defined($vars->{$x})) { - $vars = $self->{lop}->getVariables; - if (defined($vars->{$x})) { - $self = Parser::Function->new( - $equation, - 'exp', - [ - Parser::BOP->new( - $equation, '*', - $self->{rop}->copy($equation), - Parser::Function->new($equation, 'log', [ $self->{lop}->copy($equation) ], 0) - ) - ] - ); - return $self->D($x); - } - $self = Parser::BOP->new( - $equation, '*', - Parser::Function->new($equation, 'log', [ $self->{lop}->copy($equation) ], 0), - Parser::BOP->new($equation, '*', $self->copy($equation), $self->{rop}->D($x)) - ); - } else { - $self = Parser::BOP->new( - $equation, - '*', - Parser::BOP->new( - $equation, - '*', - $self->{rop}->copy($equation), - Parser::BOP->new( - $equation, - $self->{bop}, - $self->{lop}->copy($equation), - Parser::BOP->new( - $equation, '-', - $self->{rop}->copy($equation), - Parser::Number->new($equation, 1) - ) - ) - ), - $self->{lop}->D($x) - ); - } - return $self->reduce; -} - -sub Parser::BOP::cross::D { Item::D(shift) } -sub Parser::BOP::dot::D { Item::D(shift) } -sub Parser::BOP::underscore::D { Item::D(shift) } - -######################################################################### - -sub Parser::UOP::plus::D { - my $self = shift; - my $x = shift; - return $self->{op}->D($x); -} - -sub Parser::UOP::minus::D { - my $self = shift; - my $x = shift; - $self = Parser::UOP->new($self->{equation}, 'u-', $self->{op}->D($x)); - return $self->reduce; -} - -sub Parser::UOP::factorial::D { Item::D(shift) } - -######################################################################### - -sub Parser::Function::D { - my $self = shift; - $self->Error("Differentiation of '$self->{name}' not implemented", $self->{ref}); -} - -sub Parser::Function::D_chain { - my $self = shift; - my $x = $self->{params}[0]; - my $name = "D_" . $self->{name}; - $self = Parser::BOP->new($self->{equation}, '*', $self->$name($x->copy), $x->D(shift)); - return $self->reduce; -} - -############################# - -sub Parser::Function::trig::D { Parser::Function::D_chain(@_) } - -sub Parser::Function::trig::D_sin { - my $self = shift; - my $x = shift; - return Parser::Function->new($self->{equation}, 'cos', [$x]); -} - -sub Parser::Function::trig::D_cos { - my $self = shift; - my $x = shift; - my $equation = $self->{equation}; - return Parser::UOP->new($equation, 'u-', Parser::Function->new($equation, 'sin', [$x])); -} - -sub Parser::Function::trig::D_tan { - my $self = shift; - my $x = shift; - my $equation = $self->{equation}; - return Parser::BOP->new( - $equation, '^', - Parser::Function->new($equation, 'sec', [$x]), - Parser::Number->new($equation, 2) - ); -} - -sub Parser::Function::trig::D_cot { - my $self = shift; - my $x = shift; - my $equation = $self->{equation}; - return Parser::UOP->new( - $equation, - 'u-', - Parser::BOP->new( - $equation, '^', - Parser::Function->new($equation, 'csc', [$x]), - Parser::Number->new($equation, 2) - ) - ); -} - -sub Parser::Function::trig::D_sec { - my $self = shift; - my $x = shift; - my $equation = $self->{equation}; - return Parser::BOP->new( - $equation, '*', - Parser::Function->new($equation, 'sec', [$x]), - Parser::Function->new($equation, 'tan', [$x]) - ); -} - -sub Parser::Function::trig::D_csc { - my $self = shift; - my $x = shift; - my $equation = $self->{equation}; - return Parser::UOP->new( - $equation, - 'u-', - Parser::BOP->new( - $equation, '*', - Parser::Function->new($equation, 'csc', [$x]), - Parser::Function->new($equation, 'cot', [$x]) - ) - ); -} - -sub Parser::Function::trig::D_asin { - my $self = shift; - my $x = shift; - my $equation = $self->{equation}; - return Parser::BOP->new( - $equation, - '/', - Parser::Number->new($equation, 1), - Parser::Function->new( - $equation, - 'sqrt', - [ - Parser::BOP->new( - $equation, '-', - Parser::Number->new($equation, 1), - Parser::BOP->new($equation, '^', $x, Parser::Number->new($equation, 2)) - ) - ] - ) - ); -} - -sub Parser::Function::trig::D_acos { - my $self = shift; - my $x = shift; - my $equation = $self->{equation}; - return Parser::UOP->new( - $equation, - 'u-', - Parser::BOP->new( - $equation, - '/', - Parser::Number->new($equation, 1), - Parser::Function->new( - $equation, - 'sqrt', - [ - Parser::BOP->new( - $equation, '-', - Parser::Number->new($equation, 1), - Parser::BOP->new($equation, '^', $x, Parser::Number->new($equation, 2)) - ) - ] - ) - ) - ); -} - -sub Parser::Function::trig::D_atan { - my $self = shift; - my $x = shift; - my $equation = $self->{equation}; - return Parser::BOP->new( - $equation, - '/', - Parser::Number->new($equation, 1), - Parser::BOP->new( - $equation, '+', - Parser::Number->new($equation, 1), - Parser::BOP->new($equation, '^', $x, Parser::Number->new($equation, 2)) - ) - ); -} - -sub Parser::Function::trig::D_acot { - my $self = shift; - my $x = shift; - my $equation = $self->{equation}; - return Parser::UOP->new( - $equation, - 'u-', - Parser::BOP->new( - $equation, - '/', - Parser::Number->new($equation, 1), - Parser::BOP->new( - $equation, '+', - Parser::Number->new($equation, 1), - Parser::BOP->new($equation, '^', $x, Parser::Number->new($equation, 2)) - ) - ) - ); -} - -sub Parser::Function::trig::D_asec { - my $self = shift; - my $x = shift; - my $equation = $self->{equation}; - return Parser::BOP->new( - $equation, - '/', - Parser::Number->new($equation, 1), - Parser::BOP->new( - $equation, - '*', - Parser::Function->new($equation, 'abs', [$x]), - Parser::Function->new( - $equation, - 'sqrt', - [ - Parser::BOP->new( - $equation, '-', - Parser::BOP->new($equation, '^', $x, Parser::Number->new($equation, 2)), - Parser::Number->new($equation, 1) - ) - ] - ) - ) - ); -} - -sub Parser::Function::trig::D_acsc { - my $self = shift; - my $x = shift; - my $equation = $self->{equation}; - return Parser::UOP->new( - $equation, - 'u-', - Parser::BOP->new( - $equation, - '/', - Parser::Number->new($equation, 1), - Parser::BOP->new( - $equation, - '*', - Parser::Function->new($equation, 'abs', [$x]), - Parser::Function->new( - $equation, - 'sqrt', - [ - Parser::BOP->new( - $equation, '-', - Parser::BOP->new($equation, '^', $x, Parser::Number->new($equation, 2)), - Parser::Number->new($equation, 1) - ) - ] - ) - ) - ) - ); -} - -############################# - -sub Parser::Function::hyperbolic::D { Parser::Function::D_chain(@_) } - -sub Parser::Function::hyperbolic::D_sinh { - my $self = shift; - my $x = shift; - return Parser::Function->new($self->{equation}, 'cosh', [$x]); -} - -sub Parser::Function::hyperbolic::D_cosh { - my $self = shift; - my $x = shift; - return Parser::Function->new($self->{equation}, 'sinh', [$x]); -} - -sub Parser::Function::hyperbolic::D_tanh { - my $self = shift; - my $x = shift; - my $equation = $self->{equation}; - return Parser::BOP->new( - $equation, '^', - Parser::Function->new($equation, 'sech', [$x]), - Parser::Number->new($equation, 2) - ); -} - -sub Parser::Function::hyperbolic::D_coth { - my $self = shift; - my $x = shift; - my $equation = $self->{equation}; - return Parser::UOP->new( - $equation, - 'u-', - Parser::BOP->new( - $equation, '^', - Parser::Function->new($equation, 'csch', [$x]), - Parser::Number->new($equation, 2) - ) - ); -} - -sub Parser::Function::hyperbolic::D_sech { - my $self = shift; - my $x = shift; - my $equation = $self->{equation}; - return Parser::UOP->new( - $equation, - 'u-', - Parser::BOP->new( - $equation, '*', - Parser::Function->new($equation, 'sech', [$x]), - Parser::Function->new($equation, 'tanh', [$x]) - ) - ); -} - -sub Parser::Function::hyperbolic::D_csch { - my $self = shift; - my $x = shift; - my $equation = $self->{equation}; - return Parser::UOP->new( - $equation, - 'u-', - Parser::BOP->new( - $equation, '*', - Parser::Function->new($equation, 'csch', [$x]), - Parser::Function->new($equation, 'coth', [$x]) - ) - ); -} - -sub Parser::Function::hyperbolic::D_asinh { - my $self = shift; - my $x = shift; - my $equation = $self->{equation}; - return Parser::BOP->new( - $equation, - '/', - Parser::Number->new($equation, 1), - Parser::Function->new( - $equation, - 'sqrt', - [ - Parser::BOP->new( - $equation, '+', - Parser::Number->new($equation, 1), - Parser::BOP->new($equation, '^', $x, Parser::Number->new($equation, 2)) - ) - ] - ) - ); -} - -sub Parser::Function::hyperbolic::D_acosh { - my $self = shift; - my $x = shift; - my $equation = $self->{equation}; - return Parser::BOP->new( - $equation, - '/', - Parser::Number->new($equation, 1), - Parser::Function->new( - $equation, - 'sqrt', - [ - Parser::BOP->new( - $equation, '-', - Parser::BOP->new($equation, '^', $x, Parser::Number->new($equation, 2)), - Parser::Number->new($equation, 1) - ) - ] - ) - ); -} - -sub Parser::Function::hyperbolic::D_atanh { - my $self = shift; - my $x = shift; - my $equation = $self->{equation}; - return Parser::BOP->new( - $equation, - '/', - Parser::Number->new($equation, 1), - Parser::BOP->new( - $equation, '-', - Parser::Number->new($equation, 1), - Parser::BOP->new($equation, '^', $x, Parser::Number->new($equation, 2)) - ) - ); -} - -sub Parser::Function::hyperbolic::D_acoth { - my $self = shift; - my $x = shift; - my $equation = $self->{equation}; - return Parser::BOP->new( - $equation, - '/', - Parser::Number->new($equation, 1), - Parser::BOP->new( - $equation, '-', - Parser::Number->new($equation, 1), - Parser::BOP->new($equation, '^', $x, Parser::Number->new($equation, 2)) - ) - ); -} - -sub Parser::Function::hyperbolic::D_asech { - my $self = shift; - my $x = shift; - my $equation = $self->{equation}; - return Parser::UOP->new( - $equation, - 'u-', - Parser::BOP->new( - $equation, - '/', - Parser::Number->new($equation, 1), - Parser::BOP->new( - $equation, - '*', $x, - Parser::Function->new( - $equation, - 'sqrt', - [ - Parser::BOP->new( - $equation, '-', - Parser::Number->new($equation, 1), - Parser::BOP->new($equation, '^', $x, Parser::Number->new($equation, 2)) - ) - ] - ) - ) - ) - ); -} - -sub Parser::Function::hyperbolic::D_acsch { - my $self = shift; - my $x = shift; - my $equation = $self->{equation}; - return Parser::UOP->new( - $equation, - 'u-', - Parser::BOP->new( - $equation, - '/', - Parser::Number->new($equation, 1), - Parser::BOP->new( - $equation, - '*', - Parser::Function->new($equation, 'abs', [$x]), - Parser::Function->new( - $equation, - 'sqrt', - [ - Parser::BOP->new( - $equation, '+', - Parser::Number->new($equation, 1), - Parser::BOP->new($equation, '^', $x, Parser::Number->new($equation, 2)) - ) - ] - ) - ) - ) - ); -} - -############################# - -sub Parser::Function::numeric::D { Parser::Function::D_chain(@_) } - -sub Parser::Function::numeric::D_log { - my $self = shift; - my $x = shift; - my $equation = $self->{equation}; - return Parser::BOP->new($equation, '/', Parser::Number->new($equation, 1), $x); -} - -sub Parser::Function::numeric::D_log10 { - my $self = shift; - my $x = shift; - my $equation = $self->{equation}; - return Parser::BOP->new( - $equation, '/', - Parser::Number->new($equation, 1), - Parser::BOP->new($equation, '*', Parser::Number->new($equation, CORE::log(10)), $x) - ); -} - -sub Parser::Function::numeric::D_exp { - my $self = shift; - my $x = shift; - return $self->copy(); -} - -sub Parser::Function::numeric::D_sqrt { - my $self = shift; - my $x = shift; - my $equation = $self->{equation}; - return Parser::BOP->new( - $equation, '/', - Parser::Number->new($equation, 1), - Parser::BOP->new($equation, '*', Parser::Number->new($equation, 2), $self->copy) - ); -} - -sub Parser::Function::numeric::D_abs { Parser::Function::D(@_) } -sub Parser::Function::numeric::D_int { Parser::Function::D(@_) } -sub Parser::Function::numeric::D_sgn { Parser::Function::D(@_) } - -######################################################################### - -sub Parser::List::D { - my $self = shift; - my $x = shift; - $self = $self->copy($self->{equation}); - foreach my $f (@{ $self->{coords} }) { $f = $f->D($x) } - return $self->reduce; -} - -sub Parser::List::Interval::D { - my $self = shift; - $self->Error("Can't differentiate intervals", $self->{ref}); -} - -sub Parser::List::AbsoluteValue::D { - my $self = shift; - $self->Error("Can't differentiate absolute values", $self->{ref}); -} - -######################################################################### - -sub Parser::Number::D { Parser::Number->new(shift->{equation}, 0) } - -######################################################################### - -sub Parser::Complex::D { Parser::Number->new(shift->{equation}, 0) } - -######################################################################### - -sub Parser::Constant::D { Parser::Number->new(shift->{equation}, 0) } - -######################################################################### - -sub Parser::Value::D { - my $self = shift; - my $x = shift; - my $equation = $self->{equation}; - return Parser::Value->new($equation, $self->{value}->D($x, $equation)); -} - -sub Value::D { - my $self = shift; - my $x = shift; - my $equation = shift; - return 0 if $self->isComplex; - my @coords = @{ $self->{data} }; - foreach my $n (@coords) { - if (ref($n) eq "") { $n = 0 } - else { $n = $n->D($x, $equation)->data } - } - return $self->new([@coords]); -} - -sub Value::List::D { - my $self = shift; - my $x = shift; - my $equation = shift; - my @coords = @{ $self->{data} }; - foreach my $n (@coords) { - if (ref($n) eq "") { $n = 0 } - else { $n = $n->D($x) } - } - return $self->new([@coords]); -} - -sub Value::Interval::D { - shift; - shift; - my $self = shift; - $self->Error("Can't differentiate intervals", $self->{ref}); -} - -sub Value::Union::D { - shift; - shift; - my $self = shift; - $self->Error("Can't differentiate unions", $self->{ref}); -} - -######################################################################### - -sub Parser::Variable::D { - my $self = shift; - my $x = shift; - my $d = ($self->{name} eq $x) ? 1 : 0; - return Parser::Number->new($self->{equation}, $d); -} - -######################################################################### - -sub Parser::String::D { Parser::Number->new(shift->{equation}, 0) } - -######################################################################### - -package Parser::Differentiation; -our $loaded = 1; - -######################################################################### - -1; diff --git a/doc/parser/macros/parserTables.pl b/doc/parser/macros/parserTables.pl deleted file mode 100644 index 22b9b05a6d..0000000000 --- a/doc/parser/macros/parserTables.pl +++ /dev/null @@ -1,90 +0,0 @@ -loadMacros("parserUtils.pl"); - -############################################# -# -# For Parser example tables: -# - -$BTT = MODES(TeX => '{\tt ', Latex2HTML => $bHTML . '' . $eHTML, HTML => ''); -$ETT = MODES(TeX => '}', Latex2HTML => $bHTML . '' . $eHTML, HTML => ''); - -$BC = MODES( - TeX => '{\small\it ', - Latex2HTML => $bHTML . '' . $eHTML, - HTML => '' -); -$EC = MODES( - TeX => '}', - Latex2HTML => $bHTML . '' . $eHTML, - HTML => '' -); - -$LT = MODES(TeX => "<", Latex2HTML => "<", HTML => '<'); -$GT = MODES(TeX => ">", Latex2HTML => ">", HTML => '>'); - -$TEX = MODES(TeX => '{\TeX}', HTML => 'TeX', HTML_dpng => '\(\bf\TeX\)'); - -@rowOptions = ( - indent => 0, - separation => 0, - align => 'LEFT" NOWRAP="1', # alignment hack to get NOWRAP -); - -sub ParserRow { - my $f = shift; - my $t = ''; - Context()->clearError; - my ($s, $err) = PG_restricted_eval($f); - if (defined $s) { - my $ss = $s; - if (ref($s) && \&{ $s->string }) { - $t = '\(' . $s->TeX . '\)'; - $s = $s->string; - } elsif ($s !~ m/^[a-z]+$/i) { - $t = '\(' . Formula($s)->TeX . '\)'; - $s = Formula($s)->string; - } - $s =~ s/$LT/g; - $s =~ s/>/$GT/g; - if (ref($ss) && \&{ $ss->class }) { - if ($ss->class eq 'Formula') { - $s .= ' ' . $BC . '(Formula returning ' . $ss->showType . ')' . $EC; - } else { - $s .= ' ' . $BC . '(' . $ss->class . ' object)' . $EC; - } - } - } else { - $s = $BC . (Context()->{error}{message} || $err) . $EC; - $t = ''; - } - $f =~ s/$LT/g; - $f =~ s/>/$GT/g; - if ($displayMode eq 'TeX') { - $f =~ s/\^/\\char`\\^/g; - $s =~ s/\^/\\char`\\^/g; - $f =~ s/#/\\#/g; - $s =~ s/#/\\#/g; - } - my $row = Row([ $BTT . $f . $ETT, $BTT . $s . $ETT, $t ], @rowOptions); - $row =~ s/\$/\${DOLLAR}/g; - return $row; -} - -sub ParserTable { - my $table = BeginTable(border => 1, padding => 20) - . Row([ $BBOLD . "Perl Code" . $EBOLD, $BBOLD . "Result" . $EBOLD, $BBOLD . $TEX . ' version' . $EBOLD ], - @rowOptions); - foreach my $f (@_) { $table .= ParserRow($f) } - $table .= EndTable(); - return $table; -} - -sub Title { - my $title = shift; - - MODES( - TeX => "\\par\\centerline{\\bf $title}\\par\\nobreak\n", - Latex2HTML => $bHTML . '
', '\hskip3em '); -$EBLOCKQUOTE = HTML(''); - -# -# Smart-quotes in TeX mode, regular quotes in HTML mode -# -$LQ = MODES(TeX => '``', Latex2HTML => '"', HTML => '"'); -$RQ = MODES(TeX => "''", Latex2HTML => '"', HTML => '"'); - -# -# make sure all characters are displayed -# -sub protectHTML { - my $string = shift; - $string =~ s/&/\&/g; - $string =~ s/\</g; - $string =~ s/>/\>/g; - $string; -} - -sub _parserUtils_init { } - -1; - diff --git a/doc/parser/macros/unionImage.pl b/doc/parser/macros/unionImage.pl deleted file mode 100644 index c02b26fd30..0000000000 --- a/doc/parser/macros/unionImage.pl +++ /dev/null @@ -1,94 +0,0 @@ -###################################################################### -# -# A routine to make including images easier to control -# -# Usage: Image(name,options) -# -# where name is the name of an image file or a reference to a -# graphics object (or a reference to a pair of one of these), -# and options are taken from among the following: -# -# size => [w,h] the size of the image in the HTML page -# (default is [150,150]) -# -# tex_size => r the size to use in TeX mode (as a percentage -# of the line width times 10). E.g., 500 is -# half the width, etc. (default is 200.) -# -# link => 0 or 1 whether to include a link to the original -# image (default is 0, unless there are -# two images given) -# -# border => 0 or 1 size of image border in HTML mode -# (defaults to 2 or 1 depending on whether -# there is a link or not) -# -# align => placement vertical alignment for image in HTML mode -# (default is "BOTTOM") -# -# tex_center => 0 or 1 whether to center the image horizontally -# in TeX mode (default is 0) -# -# The image name can be one of a number of different things. It can be -# the name of an image file, or an alias to one produce by the alias() -# command. It can be a graphics object reference created by init_graph(). -# Or it can be a pair of these (in square brackets). The first is the -# image for the HTML file, and the second is the image that it will be -# linked to. -# -# Examples: Image("graph.gif", size => [200,200]); -# Image(["graph.gif","graph-large.gif"]); -# -# The alias() and insertGraph() functions will be called automatically -# when needed. -# -sub Image { - my $image = shift; - my $ilink; - my %options = ( - size => [ 150, 150 ], - tex_size => 200, - link => 0, - align => "BOTTOM", - tex_center => 0, - @_ - ); - my ($w, $h) = @{ $options{size} }; - my ($ratio, $link) = ($options{tex_size} * (.001), $options{link}); - my ($border, $align) = ($options{border}, $options{align}); - my ($tcenter) = $options{tex_center}; - my $HTML; - my $TeX; - ($image, $ilink) = @{$image} if (ref($image) eq "ARRAY"); - $image = alias(insertGraph($image)) if (ref($image) eq "WWPlot"); - $image = alias($image) unless ($image =~ m!^/!i); - - if ($ilink) { - $ilink = alias(insertGraph($ilink)) if (ref($ilink) eq "WWPlot"); - $ilink = alias($ilink) unless ($ilink =~ m!^/!i); - } else { - $ilink = $image; - } - $border = (($link || $ilink ne $image) ? 2 : 1) unless defined($border); - $HTML = - '
| $ehtml - $col1 - $bhtml | $ehtml - $col2 - $bhtml |