[Tkabber-dev] r1972 - in trunk/tkabber-plugins: . latex

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Wed Dec 1 11:59:50 MSK 2010


Author: sergei
Date: 2010-12-01 11:59:49 +0300 (Wed, 01 Dec 2010)
New Revision: 1972

Modified:
   trunk/tkabber-plugins/ChangeLog
   trunk/tkabber-plugins/latex/latex.tcl
Log:
	* latex/latex.tcl: Fixed processing blacklisted words.


Modified: trunk/tkabber-plugins/ChangeLog
===================================================================
--- trunk/tkabber-plugins/ChangeLog	2010-11-18 20:43:20 UTC (rev 1971)
+++ trunk/tkabber-plugins/ChangeLog	2010-12-01 08:59:49 UTC (rev 1972)
@@ -1,3 +1,7 @@
+2010-12-01  Sergei Golovan <sgolovan at nes.ru>
+
+	* latex/latex.tcl: Fixed processing blacklisted words.
+
 2010-11-18  Sergei Golovan <sgolovan at nes.ru>
 
 	* stripes/msgs/de.msg: Added German translation (thanks to Roger

Modified: trunk/tkabber-plugins/latex/latex.tcl
===================================================================
--- trunk/tkabber-plugins/latex/latex.tcl	2010-11-18 20:43:20 UTC (rev 1971)
+++ trunk/tkabber-plugins/latex/latex.tcl	2010-12-01 08:59:49 UTC (rev 1972)
@@ -49,15 +49,15 @@
     }
 
     # Blacklist is taken from KopeTeX. Not all of them are dengerous though
-    variable blacklist {\def \let \futurelet \newcommand \renewcommand
-			\else \fi \write \input \include \chardef
-			\catcode \makeatletter \noexpand \toksdef
-			\every \errhelp \errorstopmode \scrollmode
-			\nonstopmode \batchmode \read \csname
-			\newhelp \relax \afterground \afterassignment
-			\expandafter \noexpand \special \command \loop
-			\repeat \toks \output \line \mathcode \name
-			\item \section \DeclareRobustCommand}
+    variable blacklist {\\def \\let \\futurelet \\newcommand \\renewcommand
+			\\else \\fi \\write \\input \\include \\chardef
+			\\catcode \\makeatletter \\noexpand \\toksdef
+			\\every \\errhelp \\errorstopmode \\scrollmode
+			\\nonstopmode \\batchmode \\read \\csname
+			\\newhelp \\relax \\afterground \\afterassignment
+			\\expandafter \\noexpand \\special \\command \\loop
+			\\repeat \\toks \\output \\line \\mathcode \\name
+			\\item \\section \\DeclareRobustCommand}
 
     hook::add draw_message_hook [namespace current]::find_formulas 10
 }
@@ -78,7 +78,11 @@
     init_colors $chatid
 
     foreach {str formula} [regexp -all -inline {\$\$([^$]+)\$\$} $body] {
-	if {[lsearch -exact [image names] latex/$str] >= 0} continue
+	debugmsg plugins "found formula: $str -> $formula"
+	if {[lsearch -exact [image names] latex/$str] >= 0} {
+	    debugmsg plugins "formula $str already exists"
+	    continue
+	}
 
 	set bl 0
 	foreach csname $blacklist {
@@ -87,13 +91,17 @@
 		break
 	    }
 	}
-	if {$bl} continue
+	if {$bl} {
+	    debugmsg plugins "blacklisted word: $csname"
+	    continue
+	}
 
 	if {[catch {convert_formula latex/$str $formula} msg]} {
 	    debugmsg plugins "latex error: $msg"
 	    continue
 	}
 
+	debugmsg plugins "adding formula: $str"
 	plugins::emoticons::add $str latex/$str
     }
 }



More information about the Tkabber-dev mailing list