Defeat haml-spec

This commit is contained in:
Takashi Kokubun 2015-10-15 23:01:51 +09:00
parent de9392ff10
commit c97f17d7ed
4 changed files with 15 additions and 6 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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}