Granted I don't know Cosmo, so I don't know if the functions have more involved semantics, but the beauty of Lua is you can do something like this:

functions = {"fill"} -- and every other function you need to escape with

for _, name in pairs(functions) do
  local original = cosmo[name]
  cosmo[name] = function(...)
    return original(string.gsub(...,"%$",%$%$"))
  end
end

On Tue, 06 Apr 2010 13:49:23 -0600, Ignacio Burgueño <ignac...@inconcertcc.com> wrote:

On Tue, Apr 6, 2010 at 3:28 PM, Fabio Mascarenhas <mascaren...@acm.org>wrote:

2010/4/6 Ignacio Burgueño <ignac...@inconcertcc.com>

Hi. Is it possible to turn off the new behaviour of Cosmo (expressions in
selectors) ?
Since I use Cosmo to spit out some Javascript that uses jQuery, all
instances of
  $("#foo")
turns to
  foo


You can escape it with another $: $$("#foo")


Good. But... Could you reconsider that? People writing Javascript are
usually using some library like jQuery, Mootools or Prototype. They'll have
to change all occurrences of $ to $$.

What's more, if they're using Prototype instead, they'll have to do this:

(cosmo.fill([[$$$$("div")]], {}))

See http://api.prototypejs.org/language/dollardollar/


regards,
Ignacio


_______________________________________________
Kepler-Project mailing list
Kepler-Project@lists.luaforge.net
http://lists.luaforge.net/cgi-bin/mailman/listinfo/kepler-project
http://www.keplerproject.org/

Reply via email to