--- loncom/xml/lontexconvert.pm 2009/12/09 23:02:43 1.99
+++ loncom/xml/lontexconvert.pm 2010/04/27 20:29:20 1.103
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# TeX Conversion Module
#
-# $Id: lontexconvert.pm,v 1.99 2009/12/09 23:02:43 faziophi Exp $
+# $Id: lontexconvert.pm,v 1.103 2010/04/27 20:29:20 faziophi Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -326,6 +326,7 @@ sub converted {
sub to_convert {
my ($string) = @_;
+ &init_tth();
$string=~s/\
/ /gs;
# $string=~s/\s/ /gs;
$string=&HTML::Entities::decode($string);
@@ -337,21 +338,21 @@ sub smiley {
if ($env{'browser.imagesuppress'} eq 'on') { return $expression; }
my %smileys=(
'\:\-*\)' => 'face-smile.png',
- '8\-*\)' => 'face-cool.png',
- '8\-*(I|\|)' => 'face-glasses.png',
- ':\-*(I|\|)' => 'face-plain.png',
+ '8\-\)' => 'face-cool.png',
+ '8\-(I|\|)' => 'face-glasses.png',
+ '\:\-(I|\|)' => 'face-plain.png',
'\:\-(o|O|\(\))' => 'face-surprise.png',
- ':\-*\(' => 'face-sad.png',
- '\;\-*\)' => 'face-wink.png',
- '\:\-*(P|p)' => 'face-raspberry.png',
- '\:\-*(\\\|\\/)' => 'face-uncertain.png',
- '\:\-*D' => 'face-smile-big.png',
- '\:\-*(C|\@)' => 'face-angry.png',
+ ':\-\(' => 'face-sad.png',
+ '\;\-\)' => 'face-wink.png',
+ '\:\-(P|p)' => 'face-raspberry.png',
+ '\:\-(\\\|\\/)' => 'face-uncertain.png',
+ '\:\-D' => 'face-smile-big.png',
+ '\:\-(C|\@)' => 'face-angry.png',
'\:(\'|\`)\-*\(' => 'face-crying.png',
- '\:\-*(X|x|\#)' => 'face-quiet.png',
- '\:\-*(s|S)' => 'face-uncertain.png',
- '\:\-*\$' => 'face-embarrassed.png',
- '\:\-*\*' => 'face-kiss.png',
+ '\:\-(X|x|\#)' => 'face-quiet.png',
+ '\:\-(s|S)' => 'face-uncertain.png',
+ '\:\-\$' => 'face-embarrassed.png',
+ '\:\-\*' => 'face-kiss.png',
'\+O\(' => 'face-sick.png',
'(\<\;3|\(heart\))' => 'heart.png',
'\(rose\)' => 'rose.png',
@@ -361,7 +362,7 @@ sub smiley {
'\(pirate\)' => 'face-pirate.png',
'\((agree|yes)\)' => 'opinion-agree.png',
'\((disagree|nay)\)' => 'opinion-disagree.png',
- '(o|O)\-*\)' => 'face-angel.png',
+ '(o|O)\-\)' => 'face-angel.png',
);
my $iconpath=$Apache::lonnet::perlvar{'lonIconsURL'};
foreach my $smiley (keys(%smileys)) {
@@ -373,7 +374,6 @@ sub smiley {
sub msgtexconverted {
my ($message,$email) = @_;
$errorstring='';
- &init_tth();
my $outmessage='';
my $tex=0;
foreach my $fragment (split(/(?:\<\;|\<)\/*m\s*(?:\>\;|\>)/i,$message)) {
@@ -394,15 +394,16 @@ sub msgtexconverted {
foreach my $fragment (split(/(?:\<\;|\<)\/*algebra\s*(?:\>\;|\>)/i,
$message)) {
if ($tex) {
+ my $algebra = &algebra($fragment, 'web', undef, undef, undef, undef, 'tth');
if ($email) {
- $outmessage.=''.&algebra($fragment,'web').'
'; + $outmessage.=''.$algebra.'
'; $tex=0; } else { - $outmessage.=&algebra($fragment,'web'); + $outmessage.=$algebra; $tex=0; } } else { - $outmessage.=$fragment; + $outmessage.=$fragment; $tex=1; } } @@ -415,9 +416,9 @@ sub msgtexconverted { sub algebra { use AlgParser; - - my ($string,$target,$style,$parstack,$safeeval)=@_; + my ($string,$target,$style,$parstack,$safeeval,$tth)=@_; my $parser = new AlgParserWithImplicitExpand; + if ($tth eq 'tth') {&init_tth();} $string=&prepare_algebra($string); my $ret = $parser->parse($string); my $result='['.&mt('Algebra unconverted due to previous errors').']';