summaryrefslogtreecommitdiffhomepage
path: root/templates
diff options
context:
space:
mode:
authorSeba Gamboa <[email protected]>2015-09-25 13:12:22 -0300
committerSeba Gamboa <[email protected]>2015-09-25 13:12:22 -0300
commit48fb10fef522ab9262061bc612b44d74a8bda17d (patch)
treec48dcb77245e4a6b15af4366e96c31d6eb1cdd93 /templates
parente0e43a79d282d69f2f45d5cf71e0e1154357d181 (diff)
downloadyard-mruby-48fb10fef522ab9262061bc612b44d74a8bda17d.tar.gz
yard-mruby-48fb10fef522ab9262061bc612b44d74a8bda17d.zip
Listing functions
Diffstat (limited to 'templates')
-rw-r--r--templates/default/function_details/html/function_signature.erb10
-rw-r--r--templates/default/function_details/html/header.erb3
-rw-r--r--templates/default/function_details/html/source.erb10
-rw-r--r--templates/default/function_details/setup.rb12
-rw-r--r--templates/default/header/html/function_details_list.erb7
-rw-r--r--templates/default/header/html/function_summary.erb16
-rw-r--r--templates/default/header/html/includes.erb1
-rw-r--r--templates/default/header/html/item_summary.erb19
-rw-r--r--templates/default/header/html/pre_docstring.erb1
-rw-r--r--templates/default/header/html/setup.rb10
10 files changed, 80 insertions, 9 deletions
diff --git a/templates/default/function_details/html/function_signature.erb b/templates/default/function_details/html/function_signature.erb
new file mode 100644
index 0000000..cbd318e
--- /dev/null
+++ b/templates/default/function_details/html/function_signature.erb
@@ -0,0 +1,10 @@
+<h3 class="signature <%= 'first' if @index == 0 %>" id="<%= anchor_for(object) %>">
+ <%= fsignature(object, false) %>
+
+ <% if object.aliases.size > 0 %>
+ <span class="aliases">Also known as:
+ <span class="names"><%= object.aliases.map {|o|
+ "<span id='#{anchor_for(o)}'>" + h(o.name.to_s) + "</span>" }.join(", ") %></span>
+ </span>
+ <% end %>
+</h3>
diff --git a/templates/default/function_details/html/header.erb b/templates/default/function_details/html/header.erb
new file mode 100644
index 0000000..2dd9d11
--- /dev/null
+++ b/templates/default/function_details/html/header.erb
@@ -0,0 +1,3 @@
+<div class="method_details <%= @index == 0 ? 'first' : '' %>">
+ <%= yieldall %>
+</div>
diff --git a/templates/default/function_details/html/source.erb b/templates/default/function_details/html/source.erb
new file mode 100644
index 0000000..12740cb
--- /dev/null
+++ b/templates/default/function_details/html/source.erb
@@ -0,0 +1,10 @@
+<table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines"><%= "\n\n\n" %><%= h format_lines(object) %></pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File '<%= h object.file %>'<% if object.line %>, line <%= object.line %><% end %></span><%= "\n\n" %><%= html_syntax_highlight object.source %></pre>
+ </td>
+ </tr>
+</table>
diff --git a/templates/default/function_details/setup.rb b/templates/default/function_details/setup.rb
new file mode 100644
index 0000000..33cce5d
--- /dev/null
+++ b/templates/default/function_details/setup.rb
@@ -0,0 +1,12 @@
+include YARD::MRuby::Templates::Helpers::HTMLHelper
+
+def init
+ sections :header, [:function_signature, T('docstring'), :source]
+end
+
+def source
+ return if owner != object.namespace
+ return if Tags::OverloadTag === object
+ return if object.source.nil?
+ erb(:source)
+end
diff --git a/templates/default/header/html/function_details_list.erb b/templates/default/header/html/function_details_list.erb
new file mode 100644
index 0000000..37a9cc8
--- /dev/null
+++ b/templates/default/header/html/function_details_list.erb
@@ -0,0 +1,7 @@
+<div id="functions_details" class="method_details_list">
+ <h2>Function Details</h2>
+
+ <% function_listing.each_with_index do |func, i| %>
+ <%= yieldall :object => func, :owner => object, :index => i %>
+ <% end %>
+</div>
diff --git a/templates/default/header/html/function_summary.erb b/templates/default/header/html/function_summary.erb
index 037daa4..f37f075 100644
--- a/templates/default/header/html/function_summary.erb
+++ b/templates/default/header/html/function_summary.erb
@@ -1,6 +1,12 @@
-<ul class="summary">
+<% if function_listing.size > 0 %>
+ <h2>
+ Function Summary
+ <small><a href="#" class="summary_toggle">collapse</a></small>
+ </h2>
- <% function_listing.each do |func| %>
- <%= yieldall :item => func %>
- <% end %>
-</ul>
+ <ul class="summary">
+ <% function_listing.each do |func| %>
+ <%= yieldall :item => func %>
+ <% end %>
+ </ul>
+<% end %>
diff --git a/templates/default/header/html/includes.erb b/templates/default/header/html/includes.erb
new file mode 100644
index 0000000..6731e2b
--- /dev/null
+++ b/templates/default/header/html/includes.erb
@@ -0,0 +1 @@
+Included heaers
diff --git a/templates/default/header/html/item_summary.erb b/templates/default/header/html/item_summary.erb
new file mode 100644
index 0000000..522a3a1
--- /dev/null
+++ b/templates/default/header/html/item_summary.erb
@@ -0,0 +1,19 @@
+<li class="<%= @item.visibility %> <%= @item.has_tag?(:deprecated) ? 'deprecated' : '' %>">
+ <span class="summary_signature">
+ <%= fsignature(@item, true, false) %>
+
+ <% if @item.aliases.size > 0 %>
+ (also: <%= @item.aliases.map {|o| h(o.name(true)) }.join(", ") %>)
+ <% end %>
+ </span>
+ <% if @item.visibility != :public %><span class="note title <%= @item.visibility %>"><%= @item.visibility %></span><% end %>
+ <% if @item.has_tag?(:abstract) %><span class="abstract note title">abstract</span><% end %>
+ <% if @item.has_tag?(:deprecated) %><span class="deprecated note title">deprecated</span><% end %>
+ <% if @item.has_tag?(:api) && @item.tag(:api).text == 'private' %><span class="private note title">private</span><% end %>
+
+ <% if @item.has_tag?(:deprecated) %>
+ <span class="summary_desc"><strong>Deprecated.</strong> <%= htmlify_line @item.tag(:deprecated).text %></span>
+ <% else %>
+ <span class="summary_desc"><%= htmlify_line docstring_summary(@item) %></span>
+ <% end %>
+</li>
diff --git a/templates/default/header/html/pre_docstring.erb b/templates/default/header/html/pre_docstring.erb
new file mode 100644
index 0000000..f3475da
--- /dev/null
+++ b/templates/default/header/html/pre_docstring.erb
@@ -0,0 +1 @@
+<h2>Overview</h2>
diff --git a/templates/default/header/html/setup.rb b/templates/default/header/html/setup.rb
index 6e5f8f9..52eb81c 100644
--- a/templates/default/header/html/setup.rb
+++ b/templates/default/header/html/setup.rb
@@ -1,8 +1,10 @@
-def init
- super
+include T('default/module')
+include YARD::MRuby::Templates::Helpers::HTMLHelper
- sections.push :header
- sections.push :function_summary
+def init
+ sections :header, :pre_docstring, T('docstring'), :includes,
+ :function_summary, [:item_summary],
+ :function_details_list, [T('function_details')]
end