lib/hamlit/compilers/script.rb in hamlit-1.2.1 vs lib/hamlit/compilers/script.rb in hamlit-1.3.0
- old
+ new
@@ -1,12 +1,21 @@
+require 'hamlit/concerns/escapable'
+require 'hamlit/concerns/included'
+
module Hamlit
module Compilers
module Script
+ extend Concerns::Included
+
+ included do
+ include Concerns::Escapable
+ end
+
def on_haml_script(code, options, *exps)
variable = result_identifier
assign = [:code, "#{variable} = #{code}"]
- result = [:escape, true, [:dynamic, variable]]
+ result = escape_html([:dynamic, variable], options[:force_escape])
result = [:dynamic, variable] if options[:disable_escape]
[:multi, assign, *exps.map { |exp| compile(exp) }, compile(result)]
end
private