better-html
better-html copied to clipboard
Incorrect documentation in README for `template_exclusion_filter`?
In the README, the documentation has this:
template_exclusion_filter: This is called when determining whether to apply runtime checks on a.erbtemplate. When thisProcreturns false, no safety checks are applied and parsing is done using the default Rails erubi engine. For example, to exclude erb templates provided by libraries, use:Proc.new { |filename| !filename.start_with?(Rails.root.to_s) }. Defaults tonil(all html.erb templates are parsed).
Is this the case? I think it should be that if the Proc returns true, it will use the Rails parser. This is based on my understanding of how the following three lines would execute depending on the return value of the filter:
https://github.com/Shopify/better-html/blob/fffc29c9f9c5b9c5d25b64932685b5d672005c9e/lib/better_html/better_erb.rb#L50-L52
The example proc is a valid proc for checking whether the template should be parsed.