lib/kramdown/parser/kramdown/paragraph.rb in kramdown-0.11.0 vs lib/kramdown/parser/kramdown/paragraph.rb in kramdown-0.12.0
- old
+ new
@@ -19,11 +19,11 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#++
#
require 'kramdown/parser/kramdown/blank_line'
-require 'kramdown/parser/kramdown/attribute_list'
+require 'kramdown/parser/kramdown/extensions'
require 'kramdown/parser/kramdown/eob'
require 'kramdown/parser/kramdown/list'
require 'kramdown/parser/kramdown/html'
module Kramdown
@@ -37,15 +37,16 @@
PARAGRAPH_START = /^#{OPT_SPACE}[^ \t].*?\n/
PARAGRAPH_MATCH = /(?:^.*\n)+?(?=#{BLANK_LINE}|#{IAL_BLOCK_START}|#{EOB_MARKER}|#{DEFINITION_LIST_START}|^#{OPT_SPACE}#{LAZY_END_HTML_STOP}|^#{OPT_SPACE}#{LAZY_END_HTML_START}|\Z)/
# Parse the paragraph at the current location.
def parse_paragraph
- result = @src.scan(PARAGRAPH_MATCH)
+ result = @src.scan(self.class::PARAGRAPH_MATCH).chomp!
if @tree.children.last && @tree.children.last.type == :p
- @tree.children.last.children.first.value << "\n" << result.chomp
+ @tree.children.last.children.first.value << "\n" << result
else
@tree.children << new_block_el(:p)
- @tree.children.last.children << Element.new(@text_type, result.lstrip.chomp)
+ result.lstrip!
+ @tree.children.last.children << Element.new(@text_type, result)
end
true
end
define_parser(:paragraph, PARAGRAPH_START)