class Page
Attributes
root_dir[RW]
Public Class Methods
filter_file_path(elements)
click to toggle source
# File lib/syskit/scripts/doc.rb, line 51 def self.filter_file_path(elements) elements.map { |el| el.gsub(/[^\w]/, "_") } end
make_file_path(object, root_dir)
click to toggle source
# File lib/syskit/scripts/doc.rb, line 55 def self.make_file_path(object, root_dir) if object.kind_of?(Class) && (object <= Typelib::Type) make_type_file_path(object, root_dir) else make_object_file_path(object, root_dir) end end
make_object_file_path(object, root_dir)
click to toggle source
# File lib/syskit/scripts/doc.rb, line 68 def self.make_object_file_path(object, root_dir) path = filter_file_path(object.name.split("::")) File.join(*(root_dir + path)) + ".html" end
make_type_file_path(type, root_dir)
click to toggle source
# File lib/syskit/scripts/doc.rb, line 62 def self.make_type_file_path(type, root_dir) name_elements = type.split_typename path = filter_file_path(name_elements) File.join(*(root_dir + ['types', *path])) + ".html" end
to_html_page(model, renderer, options = Hash.new)
click to toggle source
# File lib/syskit/scripts/doc.rb, line 91 def self.to_html_page(model, renderer, options = Hash.new) options, page_options = Kernel.filter_options options, :root_dir => nil page = new(MetaRuby::GUI::HTML::HTMLPage.new) page.root_dir = options[:root_dir] renderer.new(page).render(model, page_options) page end
Public Instance Methods
link_to(object, text = nil)
click to toggle source
Calls superclass method
# File lib/syskit/scripts/doc.rb, line 73 def link_to(object, text = nil) if object.kind_of?(Orocos::Spec::TaskContext) link_to(Syskit::TaskContext.find_model_from_orogen_name(object.name), text) elsif object.kind_of?(Class) && (object <= Typelib::Type) text = MetaRuby::GUI::HTML.escape_html(text || object.name) relative_path = Page.make_type_file_path(object, root_dir) "<a href=\"#{relative_path}\">#{text}</a>" elsif object.name text = MetaRuby::GUI::HTML.escape_html(text || object.name) relative_path = Page.make_object_file_path(object, root_dir) "<a href=\"#{relative_path}\">#{text}</a>" else super end end