spree/deface — pull request #105 by jhawthorn (2013-09-03 02:25:59+00:00)
Title: Use <erb> instead of <code> when parsing templates

This changes the ERB template parser to use `` rather than `` to designate code blocks in a template. This is a somewhat large change to functionality, but fixes several important issues which I can't imagine a better way to fix.

For example:

<%= render template: 'foo/bar' %>

Used to parse as:

render template: 'foo/bar'

But now parses as:

render template: 'foo/bar'

This fixes a number of problems that result from using ``:

* There may be `` tags in the original ERB, which would be turned into `%>` (#101)
* Any `` tags in the `

` of a document would be moved to the body. Since `` is a real HTML tag, and isn't allowed in the head, it will be moved into the body of the document. This happens in nokogiri under jRuby or libXML 2.9.0 (#84, #100). ``, being an invented tag, does not have this issue.

Unfortunately, **this breaks any existing deface selectors looking for code**, which are somewhat common. Selectors would need to be updated to cover both code and erb:

selector: "code:contains('my_method'), erb:contains('my_method')"