Skip to content

Commit

Permalink
Don't remove last child of root node in haml 4.1+
Browse files Browse the repository at this point in the history
Version 4.1.0.beta.1 of the `haml` gem no longer creates the special
"EOD" (end of document) nodes when parsing the tree.

Thus we need to only trim this node for versions 4.0.5 and earlier.

Change-Id: I46c4e6887e04157936a29866113db3412de43efd
Reviewed-on: http://gerrit.causes.com/44718
Tested-by: jenkins <jenkins@brigade.com>
Reviewed-by: Shane da Silva <shane.dasilva@brigade.com>
  • Loading branch information
Shane da Silva authored and sds committed Nov 21, 2014
1 parent 38027f1 commit b504293
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/haml_lint/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ def build_parse_tree

# Remove the trailing empty HAML comment that the parser creates to signal
# the end of the HAML document
original_tree.children.pop
if Gem.loaded_specs['haml'].version <= Gem::Version.new('4.0.5')
original_tree.children.pop
end

@node_transformer = HamlLint::NodeTransformer.new(self)
@tree = convert_tree(original_tree)
Expand Down

0 comments on commit b504293

Please sign in to comment.