Module: RDoc::Generator::Markdown::CrossrefExtension
- Defined in:
- lib/rdoc/generator/markdown/crossref.rb
Overview
Prevents RDoc from linking to code objects omitted from Markdown output.
Instance Method Summary collapse
-
#link(name, text, code = true, rdoc_ref: false) ⇒ String
Renders a cross-reference only when its owning object is emitted.
-
#with_markdown_cross_references(cross_reference, output_object_ids) ⇒ Object
Applies Markdown cross-reference state while rendering a description.
Instance Method Details
#link(name, text, code = true, rdoc_ref: false) ⇒ String
Renders a cross-reference only when its owning object is emitted.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/rdoc/generator/markdown/crossref.rb', line 27 def link(name, text, code = true, rdoc_ref: false) return super unless @markdown_cross_reference ref = @markdown_cross_reference.resolve(name) if name return super unless RDoc::CodeObject === ref context = ref context = context.parent until RDoc::ClassModule === context || RDoc::TopLevel === context return super if @markdown_output_object_ids.include?(context.object_id) return text if RDoc::TopLevel === ref || !code "<code>#{text}</code>" end |
#with_markdown_cross_references(cross_reference, output_object_ids) ⇒ Object
Applies Markdown cross-reference state while rendering a description.
11 12 13 14 15 16 17 |
# File 'lib/rdoc/generator/markdown/crossref.rb', line 11 def with_markdown_cross_references(cross_reference, output_object_ids) @markdown_cross_reference = cross_reference @markdown_output_object_ids = output_object_ids yield ensure @markdown_cross_reference = nil end |