lib/metaheader.rb in metaheader-1.3beta3 vs lib/metaheader.rb in metaheader-1.3beta4

- old
+ new

@@ -225,33 +225,46 @@ @raw_value = match[:value] value = parse_value @raw_value @last_tag = Tag.new match[:key].freeze, value @line_breaks = 0 + @block_indent = nil # disable implicit values with the alternate syntax register @last_tag unless match[:alt] && match[:value].nil? # ok, give me another line! true end def register(tag) + return if has? tag key = tag.name.downcase.gsub(/[^\w]/, '_').to_sym @data[key] = tag end + # handle multiline tags def append(line) prefix = line.rstrip if prefix == @last_prefix.rstrip @line_breaks += 1 @empty_lines += 1 if prefix.empty? return true # add the line break later elsif line.start_with? @last_prefix mline = line[@last_prefix.size..-1] - stripped = mline.lstrip - indent_level = mline.index stripped - return if indent_level < 1 + + if @block_indent + if mline.start_with? @block_indent + stripped = mline[@block_indent.size..-1] + else + return + end + else + stripped = mline.lstrip + indent_level = mline.index stripped + return if indent_level < 1 + @block_indent = mline[0, indent_level] + end else return end # add the tag if it uses the alternate syntax and has no value