Skip to content

Commit

Permalink
Removing jsmath, tth, asciimath, latexmathml, latex2html
Browse files Browse the repository at this point in the history
  • Loading branch information
jwj61 committed Mar 18, 2013
1 parent bb1b6c3 commit 7e5fe6f
Show file tree
Hide file tree
Showing 16 changed files with 89 additions and 409 deletions.
9 changes: 7 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
*~
.svn
vn
.DS_Store
.*
*~
Expand All @@ -10,6 +9,12 @@ logs/*
conf/*.conf
conf/*.apache2-config
htdocs/site_info.txt
htdocs/applets/*.swf
bin/wwapache2ctl
webwork2.komodoproject
#courses.dist/*
node_modules
node_modules/*
WeBWorK.sublime-project
WeBWorK.sublime-workspace
conf/*.apache-config
1 change: 0 additions & 1 deletion bin/check_modules.pl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
latex
pdflatex
dvipng
tth
giftopnm
ppmtopgm
pnmtops
Expand Down
5 changes: 1 addition & 4 deletions clients/webwork_soap_client.pl
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@

# $pg{displayModes} = [
# "plainText", # display raw TeX for math expressions
# "formattedText", # format math expressions using TtH
# "images", # display math expressions as images generated by dvipng
# "jsMath", # render TeX math expressions on the client side using jsMath
# "asciimath", # render TeX math expressions on the client side using ASCIIMathML
# ];
use constant DISPLAYMODE => 'images';

Expand Down Expand Up @@ -225,7 +223,6 @@ sub environment {
dueDate=> '4014438528',
externalGif2EpsPath=>'not defined',
externalPng2EpsPath=>'not defined',
externalTTHPath=>'/usr/local/bin/tth',
fileName=>'set0/prob1a.pg',
formattedAnswerDate=>'6/19/00',
formattedDueDate=>'6/19/00',
Expand Down Expand Up @@ -275,4 +272,4 @@ sub environment {
webworkDocsURL => 'http://webwork.math.rochester.edu/webwork_gage_system_html',
};
$envir;
};
};
1 change: 0 additions & 1 deletion clients/webwork_xmlrpc_client.pl
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,6 @@ sub environment {
dueDate=> '4014438528',
externalGif2EpsPath=>'not defined',
externalPng2EpsPath=>'not defined',
externalTTHPath=>'/usr/local/bin/tth',
fileName=>'set0/prob1a.pg',
formattedAnswerDate=>'6/19/00',
formattedDueDate=>'6/19/00',
Expand Down
333 changes: 70 additions & 263 deletions conf/defaults.config

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions conf/localOverrides.conf.dist
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,8 @@ $permissionLevels{dont_log_past_answers} = undef;
# available for use.
$pg{displayModes} = [
# "plainText", # display raw TeX for math expressions
# "formattedText", # format math expressions using TtH
"images", # display math expressions as images generated by dvipng
"jsMath", # render TeX math expressions on the client side using jsMath
"MathJax", # render TeX math expressions on the client side using MathJax --- we strongly recommend people install and use MathJax
# "asciimath", # render TeX math expressions on the client side using ASCIIMathML
"LaTeXMathML", # render TeX math expressions on the client side using LaTeXMathML
];

# Default display mode. Should be an uncommented item listed above.
Expand Down
1 change: 0 additions & 1 deletion conf/site.conf.dist
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ $externalPrograms{gzip} = "/bin/gzip";
$externalPrograms{latex} ="/usr/bin/latex";
$externalPrograms{pdflatex} ="/usr/bin/pdflatex --shell-escape";
$externalPrograms{dvipng} ="/usr/bin//dvipng";
$externalPrograms{tth} ="/usr/bin/tth";

####################################################
# NetPBM - basic image manipulation utilities
Expand Down
1 change: 0 additions & 1 deletion doc/devel/headers-footers
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ $TEX_PROB_FOOTER texProbFooter.tex screenProblemPostamble.tex
$TEX_PROB_PREAMBLE texProbPreamble.tex screenProblemPreamble.tex
$TEX_SET_FOOTER texSetFooter.tex paperSetPostamble.tex hardcopy generation (see below)
$TEX_SET_PREAMBLE texSetPreamble.tex paperSetPreamble.tex hardcopy generation (see below)
(none) tthPreamble.tex tthPreamble.tex prepended to an equation by the translator before sending it to TTH


$set->set_header is paperSetHeader
Expand Down
9 changes: 0 additions & 9 deletions htdocs/js/setmaker.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,15 +279,6 @@ function randomize(filepath, el) {
// run typesetter depending on the displaymode
if(displayMode=='MathJax')
MathJax.Hub.Queue(["Typeset",MathJax.Hub,el]);
if(displayMode=='jsMath')
jsMath.ProcessBeforeShowing(el);
if(displayMode=='asciimath') {
//processNode(el);
translate();
}
if(displayMode=='LaTeXMathML') {
AMprocessNode(document.getElementsByTagName("body")[0], false);
}
//console.log(data);
});
return false;
Expand Down
2 changes: 0 additions & 2 deletions lib/WeBWorK/ContentGenerator/Instructor/ProblemGrader.pm
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,6 @@ sub body {
);


my $tthPreambleCache;

return CGI::div({class=>"ResultsWithError"}, CGI::p("You are not authorized to acces the Instructor tools."))
unless $authz->hasPermissions($userID, "access_instructor_tools");

Expand Down
95 changes: 6 additions & 89 deletions lib/WeBWorK/ContentGenerator/Problem.pm
Original file line number Diff line number Diff line change
Expand Up @@ -249,14 +249,13 @@ sub attemptResults {
my $numCorrect = 0;
my $numBlanks =0;
my $numEssay = 0;
my $tthPreambleCache;
foreach my $name (@answerNames) {
my $answerResult = $pg->{answers}->{$name};
my $studentAnswer = $answerResult->{student_ans}; # original_student_ans
my $preview = ($showAttemptPreview
? $self->previewAnswer($answerResult, $imgGen, \$tthPreambleCache)
? $self->previewAnswer($answerResult, $imgGen)
: "");
my $correctAnswerPreview = $self->previewCorrectAnswer($answerResult, $imgGen, \$tthPreambleCache);
my $correctAnswerPreview = $self->previewCorrectAnswer($answerResult, $imgGen);
my $correctAnswer = $answerResult->{correct_ans};
my $answerScore = $answerResult->{score};
my $answerMessage = $showMessages ? $answerResult->{ans_message} : "";
Expand Down Expand Up @@ -347,7 +346,7 @@ sub attemptResults {


sub previewAnswer {
my ($self, $answerResult, $imgGen, $tthPreambleCache) = @_;
my ($self, $answerResult, $imgGen) = @_;
my $ce = $self->r->ce;
my $effectiveUser = $self->{effectiveUser};
my $set = $self->{set};
Expand All @@ -357,7 +356,7 @@ sub previewAnswer {
# note: right now, we have to do things completely differently when we are
# rendering math from INSIDE the translator and from OUTSIDE the translator.
# so we'll just deal with each case explicitly here. there's some code
# duplication that can be dealt with later by abstracting out tth/dvipng/etc.
# duplication that can be dealt with later by abstracting out dvipng/etc.

my $tex = $answerResult->{preview_latex_string};

Expand All @@ -367,55 +366,14 @@ sub previewAnswer {
return $tex;
} elsif ($answerResult->{type} eq 'essay') {
return $tex;
} elsif ($displayMode eq "formattedText") {

# read the TTH preamble, or use the cached copy passed in from the caller
my $tthPreamble='';
if (defined $$tthPreambleCache) {
$tthPreamble = $$tthPreambleCache;
} else {
my $tthPreambleFile = $ce->{courseDirs}->{templates} . "/tthPreamble.tex";
if (-r $tthPreambleFile) {
$tthPreamble = readFile($tthPreambleFile);
# thanks to Jim Martino. each line in the definition file should end with
#a % to prevent adding supurious paragraphs to output:
$tthPreamble =~ s/(.)\n/$1%\n/g;
# solves the problem if the file doesn't end with a return:
$tthPreamble .="%\n";
# store preamble in cache:
$$tthPreambleCache = $tthPreamble;
} else {
}
}

# construct TTH command line
my $tthCommand = $ce->{externalPrograms}->{tth}
. " -L -f5 -u -r 2> /dev/null <<END_OF_INPUT; echo > /dev/null\n"
. $tthPreamble . "\\[" . $tex . "\\]\n"
. "END_OF_INPUT\n";

# call tth
my $result = `$tthCommand`;
if ($?) {
return "<b>[tth failed: $? $@]</b>";
} else {
# avoid border problems in tables and remove unneeded initial <br>
$result =~ s/(<table [^>]*)>/$1 CLASS="ArrayLayout">/gi;
$result =~ s!\s*<br clear="all" />!!;
return $result;
}

} elsif ($displayMode eq "images") {
$imgGen->add($tex);
} elsif ($displayMode eq "MathJax") {
return '<span class="MathJax_Preview">[math]</span><script type="math/tex; mode=display">'.$tex.'</script>';
} elsif ($displayMode eq "jsMath") {
$tex =~ s/&/&amp;/g; $tex =~ s/</&lt;/g; $tex =~ s/>/&gt;/g;
return '<SPAN CLASS="math">\\displaystyle{'.$tex.'}</SPAN>';
}
}
sub previewCorrectAnswer {
my ($self, $answerResult, $imgGen, $tthPreambleCache) = @_;
my ($self, $answerResult, $imgGen) = @_;
my $ce = $self->r->ce;
my $effectiveUser = $self->{effectiveUser};
my $set = $self->{set};
Expand All @@ -425,59 +383,18 @@ sub previewCorrectAnswer {
# note: right now, we have to do things completely differently when we are
# rendering math from INSIDE the translator and from OUTSIDE the translator.
# so we'll just deal with each case explicitly here. there's some code
# duplication that can be dealt with later by abstracting out tth/dvipng/etc.
# duplication that can be dealt with later by abstracting out dvipng/etc.

my $tex = $answerResult->{correct_ans_latex_string};
return $answerResult->{correct_ans} unless defined $tex and $tex=~/\S/; # some answers don't have latex strings defined
# return "" unless defined $tex and $tex ne "";

if ($displayMode eq "plainText") {
return $tex;
} elsif ($displayMode eq "formattedText") {

# read the TTH preamble, or use the cached copy passed in from the caller
my $tthPreamble='';
if (defined $$tthPreambleCache) {
$tthPreamble = $$tthPreambleCache;
} else {
my $tthPreambleFile = $ce->{courseDirs}->{templates} . "/tthPreamble.tex";
if (-r $tthPreambleFile) {
$tthPreamble = readFile($tthPreambleFile);
# thanks to Jim Martino. each line in the definition file should end with
#a % to prevent adding supurious paragraphs to output:
$tthPreamble =~ s/(.)\n/$1%\n/g;
# solves the problem if the file doesn't end with a return:
$tthPreamble .="%\n";
# store preamble in cache:
$$tthPreambleCache = $tthPreamble;
} else {
}
}

# construct TTH command line
my $tthCommand = $ce->{externalPrograms}->{tth}
. " -L -f5 -u -r 2> /dev/null <<END_OF_INPUT; echo > /dev/null\n"
. $tthPreamble . "\\[" . $tex . "\\]\n"
. "END_OF_INPUT\n";

# call tth
my $result = `$tthCommand`;
if ($?) {
return "<b>[tth failed: $? $@]</b>";
} else {
# avoid border problems in tables and remove unneeded initial <br>
$result =~ s/(<table [^>]*)>/$1 CLASS="ArrayLayout">/gi;
$result =~ s!\s*<br clear="all" />!!;
return $result;
}

} elsif ($displayMode eq "images") {
$imgGen->add($tex);
} elsif ($displayMode eq "MathJax") {
return '<span class="MathJax_Preview">[math]</span><script type="math/tex; mode=display">'.$tex.'</script>';
} elsif ($displayMode eq "jsMath") {
$tex =~ s/&/&amp;/g; $tex =~ s/</&lt;/g; $tex =~ s/>/&gt;/g;
return '<SPAN CLASS="math">\\displaystyle{'.$tex.'}</SPAN>';
}
}

Expand Down
3 changes: 1 addition & 2 deletions lib/WeBWorK/ContentGenerator/instructorXMLHandler.pm
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ our ($XML_URL,$FORM_ACTION_URL, $XML_PASSWORD, $XML_COURSE);
$XML_URL = "$server_root_url/mod_xmlrpc";
$FORM_ACTION_URL = "$server_root_url/webwork2/instructorXMLHandler";

use constant DISPLAYMODE => 'images'; # jsMath is another possibilities.
use constant DISPLAYMODE => 'images'; # Mathjax is another possibilities.



Expand Down Expand Up @@ -380,7 +380,6 @@ sub environment {
dueDate=> '4014438528',
externalGif2EpsPath=>'not defined',
externalPng2EpsPath=>'not defined',
externalTTHPath=>'/usr/local/bin/tth',
fileName=>'the XMLHandlerenvironment->{fileName} should be set',
formattedAnswerDate=>'6/19/00',
formattedDueDate=>'6/19/00',
Expand Down
2 changes: 1 addition & 1 deletion lib/WeBWorK/ContentGenerator/renderViaXMLRPC.pm
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ our ($XML_URL,$FORM_ACTION_URL, $XML_PASSWORD, $XML_COURSE);
$XML_URL = "$server_root_url/mod_xmlrpc";
$FORM_ACTION_URL = "$server_root_url/webwork2/html2xml";

use constant DISPLAYMODE => 'images'; # jsMath is another possibilities.
use constant DISPLAYMODE => 'images'; # Mathjax is another possibilities.


our @COMMANDS = qw( listLibraries renderProblem ); #listLib readFile tex2pdf
Expand Down
8 changes: 0 additions & 8 deletions lib/WeBWorK/PG.pm
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,8 @@ use constant DISPLAY_MODES => {
# display name # mode name
tex => "TeX",
plainText => "HTML",
formattedText => "HTML_tth",
images => "HTML_dpng",
jsMath => "HTML_jsMath",
MathJax => "HTML_MathJax",
asciimath => "HTML_asciimath",
LaTeXMathML => "HTML_LaTeXMathML",
};

sub new {
Expand Down Expand Up @@ -192,7 +188,6 @@ sub defineProblemEnvir {
# ADDED: externalLaTeXPath, externalDvipngPath,
# externalGif2EpsPath, externalPng2EpsPath

$envir{externalTTHPath} = $ce->{externalPrograms}->{tth};
$envir{externalLaTeXPath} = $ce->{externalPrograms}->{latex};
$envir{externalDvipngPath} = $ce->{externalPrograms}->{dvipng};
$envir{externalGif2EpsPath} = $ce->{externalPrograms}->{gif2eps};
Expand Down Expand Up @@ -225,10 +220,7 @@ sub defineProblemEnvir {
$envir{scriptDirectory} = undef;
$envir{webworkDocsURL} = $ce->{webworkURLs}->{docs}."/";
$envir{localHelpURL} = $ce->{webworkURLs}->{local_help}."/";
$envir{jsMathURL} = $ce->{webworkURLs}->{jsMath};
$envir{MathJaxURL} = $ce->{webworkURLs}->{MathJax};
$envir{asciimathURL} = $ce->{webworkURLs}->{asciimath};
$envir{LaTeXMathMLURL} = $ce->{webworkURLs}->{LaTeXMathML};
$envir{server_root_url} = $ce->{apache_root_url}|| '';

# Information for sending mail
Expand Down
11 changes: 0 additions & 11 deletions lib/WebworkWebservice.pm
Original file line number Diff line number Diff line change
Expand Up @@ -685,17 +685,6 @@ sub pretty_print_rh {
}


sub tth {shift if UNIVERSAL::isa($_[0] => __PACKAGE__);
my $in = shift;
my $tthpath = "/usr/local/bin/tth";
# $tthpath -L -f5 -r 2>/dev/null " . $inputString;
return $in;

}




package WWd;

#use lib '/home/gage/webwork/xmlrpc/daemon';
Expand Down
13 changes: 3 additions & 10 deletions lib/WebworkWebservice/RenderProblem.pm
Original file line number Diff line number Diff line change
Expand Up @@ -95,26 +95,19 @@ use constant DISPLAY_MODES => {
# display name # mode name
tex => "TeX",
plainText => "HTML",
formattedText => "HTML_tth",
images => "HTML_dpng",
jsMath => "HTML_jsMath",
MathJax => "HTML_MathJax",
asciimath => "HTML_asciimath",
};

use constant DISPLAY_MODE_FAILOVER => {
TeX => [],
HTML => [],
HTML_tth => [ "HTML", ],
HTML_dpng => [ "HTML_tth", "HTML", ],
HTML_jsMath => [ "HTML_dpng", "HTML_tth", "HTML", ],
HTML_MathJax => [ "HTML_dpng", "HTML_tth", "HTML", ],
HTML_asciimath => [ "HTML_dpng", "HTML_tth", "HTML", ],
HTML_dpng => [ "HTML", ],
HTML_MathJax => [ "HTML_dpng", "HTML", ],
# legacy modes -- these are not supported, but some problems might try to
# set the display mode to one of these values manually and some macros may
# provide rendered versions for these modes but not the one we want.
Latex2HTML => [ "TeX", "HTML", ],
HTML_img => [ "HTML_dpng", "HTML_tth", "HTML", ],
HTML_img => [ "HTML_dpng", "HTML", ],
};


Expand Down

0 comments on commit 7e5fe6f

Please sign in to comment.