Module: RDoc::Generator::Markup

Included in:
CodeObject, Context::Section
Defined in:
lib/rdoc/generator/markup.rb

Overview

Handle common RDoc::Markup tasks for various CodeObjects

This module is loaded by generators. It allows RDoc’s CodeObject tree to avoid loading generator code to improve startup time for ri.

Instance Method Summary collapse

Instance Method Details

#aref_to(target_path) ⇒ Object

Generates a relative URL from this object’s path to target_path



13
14
15
# File 'lib/rdoc/generator/markup.rb', line 13

def aref_to(target_path)
  RDoc::Markup::ToHtml.gen_relative_url path, target_path
end

#as_href(from_path) ⇒ Object

Generates a relative URL from from_path to this object’s path



20
21
22
# File 'lib/rdoc/generator/markup.rb', line 20

def as_href(from_path)
  RDoc::Markup::ToHtml.gen_relative_url from_path, path
end

#cvs_url(url, full_path) ⇒ Object

Build a webcvs URL starting for the given url with full_path appended as the destination path. If url contains ‘%s’ full_path will be will replace the %s using sprintf on the url.



50
51
52
53
54
55
56
# File 'lib/rdoc/generator/markup.rb', line 50

def cvs_url(url, full_path)
  if /%s/ =~ url then
    sprintf url, full_path
  else
    url + full_path
  end
end

#descriptionObject

Handy wrapper for marking up this object’s comment



27
28
29
# File 'lib/rdoc/generator/markup.rb', line 27

def description
  markup @comment
end

#formatterObject

Creates an RDoc::Markup::ToHtmlCrossref formatter



34
35
36
37
38
39
40
41
42
43
# File 'lib/rdoc/generator/markup.rb', line 34

def formatter
  return @formatter if defined? @formatter

  options = @store.rdoc.options
  this = RDoc::Context === self ? self : @parent

  @formatter = RDoc::Markup::ToHtmlCrossref.new options, this.path, this
  @formatter.code_object = self
  @formatter
end