Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions lib/rdoc/markdown.kpeg
Original file line number Diff line number Diff line change
Expand Up @@ -1234,10 +1234,12 @@ InlineNote = &{ notes? }
@StartList:a
( !"]" Inline:l { a << l } )+
"]"
{ ref = [:inline, @note_order.length]
@footnotes[ref] = paragraph a
{ if @note_order
ref = [:inline, @note_order.length]
@footnotes[ref] = paragraph a

note_for ref
note_for ref
end
}

Notes = ( Note | SkipBlock )*
Expand Down
12 changes: 7 additions & 5 deletions lib/rdoc/markdown.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15476,7 +15476,7 @@ def _Note
return _tmp
end

# InlineNote = &{ notes? } "^[" @StartList:a (!"]" Inline:l { a << l })+ "]" { ref = [:inline, @note_order.length] @footnotes[ref] = paragraph a note_for ref }
# InlineNote = &{ notes? } "^[" @StartList:a (!"]" Inline:l { a << l })+ "]" { if @note_order ref = [:inline, @note_order.length] @footnotes[ref] = paragraph a note_for ref end }
def _InlineNote

_save = self.pos
Expand Down Expand Up @@ -15567,10 +15567,12 @@ def _InlineNote
self.pos = _save
break
end
@result = begin; ref = [:inline, @note_order.length]
@footnotes[ref] = paragraph a
@result = begin; if @note_order
ref = [:inline, @note_order.length]
@footnotes[ref] = paragraph a

note_for ref
note_for ref
end
; end
_tmp = true
unless _tmp
Expand Down Expand Up @@ -16841,7 +16843,7 @@ def _DefinitionListDefinition
Rules[:_NoteReference] = rule_info("NoteReference", "&{ notes? } RawNoteReference:ref { note_for ref }")
Rules[:_RawNoteReference] = rule_info("RawNoteReference", "\"[^\" < (!@Newline !\"]\" .)+ > \"]\" { text }")
Rules[:_Note] = rule_info("Note", "&{ notes? } @NonindentSpace RawNoteReference:ref \":\" @Sp @StartList:a RawNoteBlock:i { a.concat i } (&Indent RawNoteBlock:i { a.concat i })* { @footnotes[ref] = paragraph a nil }")
Rules[:_InlineNote] = rule_info("InlineNote", "&{ notes? } \"^[\" @StartList:a (!\"]\" Inline:l { a << l })+ \"]\" { ref = [:inline, @note_order.length] @footnotes[ref] = paragraph a note_for ref }")
Rules[:_InlineNote] = rule_info("InlineNote", "&{ notes? } \"^[\" @StartList:a (!\"]\" Inline:l { a << l })+ \"]\" { if @note_order ref = [:inline, @note_order.length] @footnotes[ref] = paragraph a note_for ref end }")
Rules[:_Notes] = rule_info("Notes", "(Note | SkipBlock)*")
Rules[:_RawNoteBlock] = rule_info("RawNoteBlock", "@StartList:a (!@BlankLine !RawNoteReference OptionallyIndentedLine:l { a << l })+ < @BlankLine* > { a << text } { a }")
Rules[:_CodeFence] = rule_info("CodeFence", "&{ github? } Ticks3 (@Sp StrChunk:format)? @Sp @Newline? < ((!\"`\" Nonspacechar)+ | !Ticks3 /`+/ | Spacechar | @Newline)+ > Ticks3 @Sp @Newline* { verbatim = RDoc::Markup::Verbatim.new text verbatim.format = format.intern if format.instance_of?(String) verbatim }")
Expand Down
6 changes: 6 additions & 0 deletions test/rdoc/rdoc_markdown_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1002,6 +1002,12 @@ def test_parse_note_inline
assert_equal expected, doc
end

def test_parse_note_inline_in_reference_label
@parser.notes = true

assert_kind_of RDoc::Markup::Document, parse("[foo ^[note]]: /url\n")
end

def test_parse_note_no_notes
@parser.notes = false

Expand Down