File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 403403 # the note order list for proper display at the end of the document.
404404
405405 def note_for ref
406+ raise ParseError, "invalid note reference: #{ref}" unless @note_order
407+
406408 @note_order << ref
407409
408410 label = @note_order.length
Original file line number Diff line number Diff line change @@ -788,6 +788,8 @@ def note label
788788 # the note order list for proper display at the end of the document.
789789
790790 def note_for ref
791+ raise ParseError , "invalid note reference: #{ ref } " unless @note_order
792+
791793 @note_order << ref
792794
793795 label = @note_order . length
Original file line number Diff line number Diff line change @@ -1002,6 +1002,16 @@ def test_parse_note_inline
10021002 assert_equal expected , doc
10031003 end
10041004
1005+ def test_parse_note_invalid_reference
1006+ @parser . notes = true
1007+
1008+ error = assert_raise RDoc ::Markdown ::ParseError do
1009+ parse "[[^0]\n "
1010+ end
1011+
1012+ assert_equal "invalid note reference: 0" , error . message
1013+ end
1014+
10051015 def test_parse_note_no_notes
10061016 @parser . notes = false
10071017
You can’t perform that action at this time.
0 commit comments