README.markdown in deface-0.5.0 vs README.markdown in deface-0.5.1
- old
+ new
@@ -39,14 +39,19 @@
* <tt>:partial</tt> - Relative path to a partial
* <tt>:template</tt> - Relative path to a template
+
Optional
--------
* <tt>:name</tt> - Unique name for override so it can be identified and modified later. This needs to be unique within the same `:virtual_path`
+* <tt>:disabled</tt> - When set to true the override will not be applied.
+
+* <tt>:original</tt> - String containing original markup that is being overridden. If supplied Deface will log when the original markup changes, which helps highlight overrides that need attention when upgrading versions of the source application. Only really warranted for :replace overrides. NB: All whitespace is stripped before comparsion.
+
Examples
========
Replaces all instances of _h1_ in the `posts/_form.html.erb` partial with `<h1>New Post</h1>`
@@ -67,15 +72,16 @@
Deface::Override.new(:virtual_path => "posts/show",
:name => "example-3",
:insert_after => "div#comment_21",
:partial => "shared/comment")
-Removes any instance of `<%= helper_method %>` in the `posts/new.html.erb" template:
+Removes any ERB block containing the string `helper_method` in the `posts/new.html.erb` template, will also log if markup being removed does not match `<%= helper_method %>`
Deface::Override.new(:virtual_path => "posts/new",
:name => "example-4",
- :remove => "code[erb-loud]:contains('helper_method')" )
+ :remove => "code[erb-loud]:contains('helper_method')",
+ :original => "<%= helper_method %>")
Implementation
==============
@@ -105,14 +111,14 @@
Deface overrides have full access to all variables accessible to the view being customized.
Caveats
======
+Deface uses the amazing Nokogiri library (and in turn libxml) for parsing HTML / view files, in some circumstances either Deface's own pre-parser or libxml's will fail to correctly parse a template. You can avoid such issues by ensuring your templates contain valid HTML. Some other caveats include:
-Due to the use of the Nokogiri library for parsing HTML / view files you need to ensure that your layout views include doctype, html, head and body tags in a single file, as Nokogiri will create such elements if it detects any of these tags have been incorrectly nested.
+1. Ensure that your layout views include doctype, html, head and body tags in a single file, as Nokogiri will create such elements if it detects any of these tags have been incorrectly nested.
-Parsing will fail and result in invalid output if ERB blocks are responsible for closing a HTML tag what was opened normally, i.e. don't do this:
+2. Parsing will fail and result in invalid output if ERB blocks are responsible for closing a HTML tag what was opened normally, i.e. don't do this:
<div <%= ">" %>
-