summaryrefslogtreecommitdiffhomepage
path: root/templates/default/fulldoc/html/setup.rb
diff options
context:
space:
mode:
authorSeba Gamboa <[email protected]>2015-09-24 18:25:12 -0300
committerSeba Gamboa <[email protected]>2015-09-24 18:25:12 -0300
commitc1f2404de71e9a8f73271b05f59a225728212069 (patch)
treeb4f3842661dd6edd38c594579335e1ae5ea61f33 /templates/default/fulldoc/html/setup.rb
parentcc49ade5e7029e4d8d8d62b7c09590042b43d65d (diff)
downloadyard-mruby-c1f2404de71e9a8f73271b05f59a225728212069.tar.gz
yard-mruby-c1f2404de71e9a8f73271b05f59a225728212069.zip
Generating C API HTML Layout
Diffstat (limited to 'templates/default/fulldoc/html/setup.rb')
-rw-r--r--templates/default/fulldoc/html/setup.rb57
1 files changed, 57 insertions, 0 deletions
diff --git a/templates/default/fulldoc/html/setup.rb b/templates/default/fulldoc/html/setup.rb
new file mode 100644
index 0000000..81ac35c
--- /dev/null
+++ b/templates/default/fulldoc/html/setup.rb
@@ -0,0 +1,57 @@
+def init
+ super
+
+ YARD::MRuby::CodeObjects::INCLUDE_DIRECTORY.tap do |root|
+
+ # Generates the requirements splash page with the 'include' template
+ serialize root
+
+ root.headers.each do |header|
+ serialize header
+ end
+ end
+
+end
+
+def generate_header_list
+ puts "generate_header_list"
+ headers = Registry.all(:header)
+ headers_ordered_by_name = headers.sort {|x,y| x.value.to_s <=> y.value.to_s }
+ generate_full_list headers_ordered_by_name, :headers
+end
+
+# Helpler method to generate a full_list page of the specified objects with the
+# specified type.
+def generate_full_list(objects,type,options = {})
+ defaults = { :list_title => "#{type.to_s.capitalize} List",
+ :css_class => "class",
+ :list_filename => "#{type.to_s.gsub(/s$/,'')}_list.html" }
+
+ options = defaults.merge(options)
+
+ @items = objects
+ @list_type = type
+ @list_title = options[:list_title]
+ @list_class = options[:css_class]
+ asset options[:list_filename], erb(:full_list)
+end
+
+#
+# @note This method overrides YARD's default template class_list method.
+#
+# The existing YARD 'Class List' search field contains all the YARD namespace objects.
+# We, however, do not want the Include Namespace YARD Object (which holds the headers)
+# as it is a meta-object.
+#
+# This method removes the namespace from the root node, generates the class list,
+# and then adds it back into the root node.
+#
+def class_list(root = Registry.root)
+ return super unless root == Registry.root
+
+ include_namespace = YARD::MRuby::CodeObjects::INCLUDE_DIRECTORY
+ root.instance_eval { children.delete include_namespace }
+ out = super(root)
+ root.instance_eval { children.push include_namespace }
+ out
+end