Defeat haml-spec
This commit is contained in:
parent
de9392ff10
commit
c97f17d7ed
|
@ -26,7 +26,7 @@ module Hamlit
|
|||
register :preserve, Preserve
|
||||
|
||||
def initialize(options = {})
|
||||
@format = options[:format]
|
||||
@options = options
|
||||
end
|
||||
|
||||
def compile(node)
|
||||
|
@ -40,7 +40,7 @@ module Hamlit
|
|||
compiler = Filters.registered[name]
|
||||
raise NotFound.new("FilterCompiler for '#{name}' was not found") unless compiler
|
||||
|
||||
compilers[name] ||= compiler.new(@format)
|
||||
compilers[name] ||= compiler.new(@options)
|
||||
end
|
||||
|
||||
def compilers
|
||||
|
|
|
@ -3,8 +3,8 @@ require 'haml/util'
|
|||
module Hamlit
|
||||
class Filters
|
||||
class Base
|
||||
def initialize(format)
|
||||
@format = format
|
||||
def initialize(options = {})
|
||||
@format = options[:format]
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -3,10 +3,20 @@ require 'haml/util'
|
|||
module Hamlit
|
||||
class Filters
|
||||
class Plain < Base
|
||||
def initialize(options = {})
|
||||
super
|
||||
@pretty = options[:pretty]
|
||||
end
|
||||
|
||||
def compile(node)
|
||||
text = node.value[:text].rstrip
|
||||
if Haml::Util.contains_interpolation?(text)
|
||||
[:dynamic, Haml::Util.unescape_interpolation(text + "\n")]
|
||||
# FIXME: Confirm whether this is correct or not
|
||||
if @pretty
|
||||
[:dynamic, Haml::Util.unescape_interpolation(text)]
|
||||
else
|
||||
[:dynamic, Haml::Util.unescape_interpolation(text + "\n")]
|
||||
end
|
||||
else
|
||||
[:static, text]
|
||||
end
|
||||
|
|
|
@ -959,7 +959,6 @@ class PrettyTest < MiniTest::Test
|
|||
end
|
||||
|
||||
def test_interpolation_inside_filtered_content
|
||||
skip
|
||||
haml = %q{:plain
|
||||
#{var} interpolated: #{var}}
|
||||
html = %q{value interpolated: value}
|
||||
|
|
Loading…
Reference in New Issue