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
-
#aref_to(target_path) ⇒ Object
Generates a relative URL from this object's path to
target_path. -
#as_href(from_path) ⇒ Object
Generates a relative URL from
from_pathto this object's path. -
#canonical_url ⇒ Object
The preferred URL for this object.
-
#cvs_url(url, full_path) ⇒ Object
Build a webcvs URL starting for the given
urlwithfull_pathappended as the destination path. -
#description ⇒ Object
Handy wrapper for marking up this object's comment.
-
#formatter ⇒ Object
Creates an RDoc::Markup::ToHtmlCrossref formatter.
Instance Method Details
#aref_to(target_path) ⇒ Object
Generates a relative URL from this object's path to target_path
15 16 17 |
# File 'lib/rdoc/generator/markup.rb', line 15 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
22 23 24 |
# File 'lib/rdoc/generator/markup.rb', line 22 def as_href(from_path) ::RDoc::Markup::ToHtml.gen_relative_url from_path, path end |
#canonical_url ⇒ Object
The preferred URL for this object.
71 72 73 74 75 76 77 78 |
# File 'lib/rdoc/generator/markup.rb', line 71 def canonical_url = @store. if path File.join(.canonical_root, path.to_s) else .canonical_root end 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.
60 61 62 63 64 65 66 |
# File 'lib/rdoc/generator/markup.rb', line 60 def cvs_url(url, full_path) if /%s/ =~ url sprintf url, full_path else url + full_path end end |
#description ⇒ Object
Handy wrapper for marking up this object's comment
29 30 31 |
# File 'lib/rdoc/generator/markup.rb', line 29 def description markup @comment end |
#formatter ⇒ Object
Creates an RDoc::Markup::ToHtmlCrossref formatter
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/rdoc/generator/markup.rb', line 36 def formatter return @formatter if defined? @formatter = @store. this = Context === self ? self : @parent @formatter = ::RDoc::Markup::ToHtmlCrossref.new( this.path, this, pipe: .pipe, output_decoration: .output_decoration, hyperlink_all: .hyperlink_all, show_hash: .show_hash, autolink_excluded_words: .autolink_excluded_words || [], warn_missing_rdoc_ref: .warn_missing_rdoc_ref ) @formatter.code_object = self @formatter end |