[TxMt] GTDAlt bug

Charilaos Skiadas cskiadas at uchicago.edu
Fri Jul 28 22:24:01 UTC 2006


Should have included the code for the escaping. Here it is:

def e_sh(str)
	str.to_s.gsub(/[^a-zA-Z0-9_.\/]/, "\\\\\\0")
end
# first escape for use in the shell, then escape for use in a JS string
def e_js_sh(str)
   (e_sh str).gsub("\\", "\\\\\\\\")
end

> Here is the code that creates the link, which is what causes the  
> problem:
>
>   def mark_completed_link(attributes={})
>     s = "<input type=\"checkbox\" href=\"\#\""
>     attributes.each do |key,value|
>       s << " #{key.to_s}=\"#{value.to_s}\""
>     end
>     pathToScript = File.join(ENV 
> ['TM_BUNDLE_SUPPORT'],"bin","mark_completed.rb")
>     string_to_execute = (e_js_sh pathToScript) + " #{e_js_sh  
> self.name} #{e_js_sh self.file.to_s} #{e_js_sh self.line}"
>     s << " onClick='TextMate.system(\"2>/dev/console # 
> {string_to_execute}\", null); return false;'"
>     s << ">Mark!</a>"
>   end
>
>
> Haris
>
>
>
> ______________________________________________________________________
> For new threads USE THIS: textmate at lists.macromates.com
> (threading gets destroyed and the universe will collapse if you don't)
> http://lists.macromates.com/mailman/listinfo/textmate

Haris





More information about the textmate mailing list