class Haml::Parser
def parse_new_attributes(text)
-
(Integer)
- last_line -
(String)
- rest -
(Array
- - [static_attributs (Hash), dynamic_attributes (nil or String starting with `{` and ending with `}`)])
def parse_new_attributes(text) scanner = StringScanner.new(text) last_line = @line.index + 1 attributes = {} scanner.scan(/\(\s*/) loop do name, value = parse_new_attribute(scanner) break if name.nil? if name == false scanned = Haml::Util.balance(text, ?(, ?)) text = scanned ? scanned.first : text raise Haml::SyntaxError.new(Error.message(:invalid_attribute_list, text.inspect), last_line - 1) end attributes[name] = value scanner.scan(/\s*/) if scanner.eos? text << " #{@next_line.text}" last_line += 1 next_line scanner.scan(/\s*/) end end static_attributes = {} dynamic_attributes = "{" attributes.each do |name, (type, val)| if type == :static static_attributes[name] = val else dynamic_attributes << "#{inspect_obj(name)} => #{val}," end end dynamic_attributes << "}" dynamic_attributes = nil if dynamic_attributes == "{}" return [static_attributes, dynamic_attributes], scanner.rest, last_line end