lib/kramdown/parser/base.rb in kramdown-2.1.0 vs lib/kramdown/parser/base.rb in kramdown-2.2.0
- old
+ new
@@ -91,10 +91,12 @@
def adapt_source(source)
unless source.valid_encoding?
raise "The source text contains invalid characters for the used encoding #{source.encoding}"
end
source = source.encode('UTF-8')
- source.gsub(/\r\n?/, "\n").chomp + "\n"
+ source.gsub!(/\r\n?/, "\n")
+ source.chomp!
+ source << "\n"
end
# This helper method adds the given +text+ either to the last element in the +tree+ if it is a
# +type+ element or creates a new text element with the given +type+.
def add_text(text, tree = @tree, type = @text_type)