Skip to content

Commit a7f2901

Browse files
committed
Allow multiple footnotes without in-between blank lines
ruby/ruby@e4e054e used four footnotes without blank lines. And the ChangeLog generated from that commit resulted in ``undefined method `parts' for nil`` error. For now, let a footnote terminated by the next footnote mark. Also refined the error message when undefined footnote is used.
1 parent 4e44c9c commit a7f2901

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

lib/rdoc/markdown.kpeg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@
449449

450450
@note_order.each_with_index do |ref, index|
451451
label = index + 1
452-
note = @footnotes[ref]
452+
note = @footnotes[ref] or raise ParseError, "footnote [^#{ref}] not found"
453453

454454
link = "{^#{label}}[rdoc-label:footmark-#{label}:foottext-#{label}] "
455455
note.parts.unshift link
@@ -1179,7 +1179,7 @@ InlineNote = &{ notes? }
11791179
Notes = ( Note | SkipBlock )*
11801180

11811181
RawNoteBlock = @StartList:a
1182-
( !@BlankLine OptionallyIndentedLine:l { a << l } )+
1182+
( !@BlankLine !RawNoteReference OptionallyIndentedLine:l { a << l } )+
11831183
( < @BlankLine* > { a << text } )
11841184
{ a }
11851185

test/rdoc/test_rdoc_markdown.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,6 @@ def test_parse_note_multiple
761761
and an extra note.[^2]
762762
763763
[^1]: With a footnote
764-
765764
[^2]: Which should be numbered correctly
766765
MD
767766

0 commit comments

Comments
 (0)