lib/kramdown/parser/kramdown/emphasis.rb in kramdown-1.2.0 vs lib/kramdown/parser/kramdown/emphasis.rb in kramdown-1.3.0
- old
+ new
@@ -13,10 +13,11 @@
EMPHASIS_START = /(?:\*\*?|__?)/
# Parse the emphasis at the current location.
def parse_emphasis
+ start_line_number = @src.current_line_number
result = @src.scan(EMPHASIS_START)
element = (result.length == 2 ? :strong : :em)
type = result[0..0]
reset_pos = @src.pos
@@ -25,10 +26,10 @@
add_text(result)
return
end
sub_parse = lambda do |delim, elem|
- el = Element.new(elem)
+ el = Element.new(elem, nil, nil, :location => start_line_number)
stop_re = /#{Regexp.escape(delim)}/
found = parse_spans(el, stop_re) do
(@src.pre_match[-1, 1] !~ /\s/) &&
(elem != :em || !@src.match?(/#{Regexp.escape(delim*2)}(?!#{Regexp.escape(delim)})/)) &&
(type != '_' || !@src.match?(/#{Regexp.escape(delim)}[[:alnum:]]/)) && el.children.size > 0