lib/kramdown/parser/kramdown/footnote.rb in kramdown-0.10.0 vs lib/kramdown/parser/kramdown/footnote.rb in kramdown-0.11.0

- old
+ new

@@ -26,20 +26,21 @@ module Kramdown module Parser class Kramdown - FOOTNOTE_DEFINITION_START = /^#{OPT_SPACE}\[\^(#{ALD_ID_NAME})\]:\s*?(.*?\n(?:#{BLANK_LINE}?#{CODEBLOCK_LINE})*)/ + FOOTNOTE_DEFINITION_START = /^#{OPT_SPACE}\[\^(#{ALD_ID_NAME})\]:\s*?(.*?\n#{CODEBLOCK_MATCH})/ # Parse the foot note definition at the current location. def parse_footnote_definition @src.pos += @src.matched_size el = Element.new(:footnote_def) parse_blocks(el, @src[2].gsub(INDENT, '')) warning("Duplicate footnote name '#{@src[1]}' - overwriting") if @doc.parse_infos[:footnotes][@src[1]] (@doc.parse_infos[:footnotes][@src[1]] = {})[:content] = el + @tree.children << Element.new(:eob, :footnote_def) true end define_parser(:footnote_definition, FOOTNOTE_DEFINITION_START) @@ -52,10 +53,10 @@ if fn_def valid = fn_def[:marker] && fn_def[:marker].options[:stack][0..-2].zip(fn_def[:marker].options[:stack][1..-1]).all? do |par, child| par.children.include?(child) end if !fn_def[:marker] || !valid - fn_def[:marker] = Element.new(:footnote, nil, :name => @src[1]) + fn_def[:marker] = Element.new(:footnote, nil, nil, :name => @src[1]) fn_def[:marker].options[:stack] = [@stack.map {|s| s.first}, @tree, fn_def[:marker]].flatten.compact @tree.children << fn_def[:marker] else warning("Footnote marker '#{@src[1]}' already appeared in document, ignoring newly found marker") add_text(@src.matched)