lib/vcard.rb in vcard-0.2.8 vs lib/vcard.rb in vcard-0.2.9
- old
+ new
@@ -24,19 +24,24 @@
# lines to be inserted for readability - it does this by dropping zero-length
# lines.
def self.unfold(card) #:nodoc:
unfolded = []
+ prior_line = nil
card.lines do |line|
line.chomp!
# If it's a continuation line, add it to the last.
# If it's an empty line, drop it from the input.
if line =~ /^[ \t]/
unfolded[-1] << line[1, line.size-1]
+ elsif prior_line && (prior_line =~ Bnf::UNTERMINATED_QUOTED_PRINTABLE)
+ # Strip the trailing = off prior line, then append current line
+ unfolded[-1] = prior_line[0, prior_line.length-1] + line
elsif line =~ /^$/
else
unfolded << line
end
+ prior_line = unfolded[-1]
end
unfolded
end