diff --git a/lib/puppetx/yardoc/yard/templates/default/fulldoc/html/full_list_class.erb b/lib/puppetx/yardoc/yard/templates/default/fulldoc/html/full_list_class.erb new file mode 100644 index 0000000..38081a0 --- /dev/null +++ b/lib/puppetx/yardoc/yard/templates/default/fulldoc/html/full_list_class.erb @@ -0,0 +1,2 @@ +
  • <%= link_object(Registry.root, Registry.root.title, nil, false) %>
  • +<%= namespace_list %> diff --git a/lib/puppetx/yardoc/yard/templates/default/fulldoc/html/full_list_puppet_manifest.erb b/lib/puppetx/yardoc/yard/templates/default/fulldoc/html/full_list_puppet_manifest.erb new file mode 100644 index 0000000..6ba286e --- /dev/null +++ b/lib/puppetx/yardoc/yard/templates/default/fulldoc/html/full_list_puppet_manifest.erb @@ -0,0 +1 @@ +<%= namespace_list(:namespace_types => [:hostclass, :definedtype]) %> diff --git a/lib/puppetx/yardoc/yard/templates/default/fulldoc/html/setup.rb b/lib/puppetx/yardoc/yard/templates/default/fulldoc/html/setup.rb new file mode 100644 index 0000000..ba90602 --- /dev/null +++ b/lib/puppetx/yardoc/yard/templates/default/fulldoc/html/setup.rb @@ -0,0 +1,50 @@ +def generate_class_list + @items = options.objects.select{|o| [:module, :class, :root].include? o.type} if options.objects + @list_title = "Class List" + @list_type = "class" + generate_list_contents +end + +def generate_puppet_manifest_list + @items = options.objects.select{|o| [:hostclass, :definedtype].include? o.type} if options.objects + @list_title = "Puppet Manifest List" + # This is important. It causes some YARD JavaScript bits to hook in and + # perform the correct formatting. + @list_class = "class" + @list_type = "puppet_manifest" + generate_list_contents +end + +# A hacked version of class_list that can be instructed to only display certain +# namespace types. This allows us to separate Puppet bits from Ruby bits. +def namespace_list(opts = {}) + o = { + :root => Registry.root, + :namespace_types => [:module, :class] + }.merge(opts) + + root = o[:root] + namespace_types = o[:namespace_types] + + out = "" + children = run_verifier(root.children) + if root == Registry.root + children += @items.select {|o| o.namespace.is_a?(CodeObjects::Proxy) } + end + children.reject {|c| c.nil? }.sort_by {|child| child.path }.map do |child| + if namespace_types.include? child.type + name = child.namespace.is_a?(CodeObjects::Proxy) ? child.path : child.name + has_children = run_verifier(child.children).any? {|o| o.is_a?(CodeObjects::NamespaceObject) } + out << "
  • " + out << " " if has_children + out << linkify(child, name) + out << " < #{child.superclass.name}" if child.is_a?(CodeObjects::ClassObject) && child.superclass + out << "" + out << child.namespace.title + out << "" + out << "
  • " + out << "" if has_children + end + end + out +end diff --git a/lib/puppetx/yardoc/yard/templates/default/layout/html/setup.rb b/lib/puppetx/yardoc/yard/templates/default/layout/html/setup.rb index a53bfbd..79d3f44 100644 --- a/lib/puppetx/yardoc/yard/templates/default/layout/html/setup.rb +++ b/lib/puppetx/yardoc/yard/templates/default/layout/html/setup.rb @@ -7,3 +7,9 @@ def index objects.each {|o| (@objects_by_letter[o.name.to_s[0,1].upcase] ||= []) << o } erb(:index) end + +def menu_lists + [ + {:type => 'puppet_manifest', :title => 'Puppet Manifests', :search_title => "Puppet Manifest List"} + ] + super +end