Mange / roadie

Making HTML emails comfortable for the Ruby rockstars

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Handle CDATA and comments in CSS

k3rni opened this issue · comments

Gist with failing spec: https://gist.github.com/3930767

Basically, if the included CSS is wrapped in CDATA and HTML comments (TinyMCE does that), Roadie chokes and spits out an unhelpful error message.

Nokogiri::CSS::SyntaxError (unexpected '<' after ''):
  app/mailers/doodad_mailer.rb:24:in `doodad' # location of the 'mail' method call
  app/models/doodad.rb:23:in `deliver_test'
  app/controllers/doodads_controller.rb:79:in `email'

Ugh. I'm confirming this bug just to be pragmatic.

TinyMCE should fix this as well. Have you reported this to them too? :-)

I just released 2.3.3 containing this fix.

While annoying, TinyMCE's behavior is valid - in HTML4 style and script elements are CDATA, XHTML has them as PCDATA, and therefore needs escaping less-than, greater-than and amp characters. Which have no business in CSS other than in urls and IE conditional comments.

However, a toggle option at their end would be nice too.

I was actually referring to the HTML comments. Those are invalid AFAIK. :-)
Den 22 okt 2012 12:19 skrev "k3rni" notifications@github.com:

Gist with failing spec: https://gist.github.com/3930767

Basically, if the included CSS is wrapped in CDATA and HTML comments
(TinyMCE does that), Roadie chokes and spits out an unhelpful error message.

Nokogiri::CSS::SyntaxError (unexpected '<' after ''):
app/mailers/doodad_mailer.rb:24:in doodad' # location of the 'mail' method call app/models/doodad.rb:23:indeliver_test'
app/controllers/doodads_controller.rb:79:in `email'


Reply to this email directly or view it on GitHub.