lib/fu/parser.rb in fu-0.0.1 vs lib/fu/parser.rb in fu-0.0.2
- old
+ new
@@ -30,13 +30,13 @@
parent.children << node
# If present, the line must open with tag or script
if element_statement = scanner.scan(/\%[a-zA-Z0-9\-_]+/) # e.g. '%video'
node.type = :element
node.tag = element_statement[1..-1]
- elsif mustache_statement = scanner.scan(/\{\{[^\S\n]*[#\^][^\S\n]*[a-zA-Z0-9_]+[^\S\n]*\}\}/) # e.g. = {{#comments}}
+ elsif mustache_statement = scanner.scan(/\{\{[^\S\n]*[#\^\>][^\S\n]*[a-zA-Z0-9_]+[^\S\n]*\}\}/) # e.g. = {{#comments}}
node.type = :mustache
- node.statement = mustache_statement.scan(/[#\^]\s*[a-zA-Z0-9_]+/).flatten.first
+ node.statement = mustache_statement.scan(/[#\^\>]\s*[a-zA-Z0-9_]+/).flatten.first
end
# Classes and id's may be added, e.g. #my_special_header_id.alert.featured
while scan = scanner.scan(/[\.\#][a-zA-Z0-9\-_]+/) do
unless node.type.nil? || node.type == :element
@@ -80,10 +80,10 @@
else # This very node is teh text!
node.type = :text
node.text = scan.strip
end
end
-
+ node.type ||= :blank
scanner.scan(/\n/) # Consume end of line
node
end
end
end
\ No newline at end of file