yard-go 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +22 -0
- data/README.md +5 -0
- data/lib/yard-go.rb +14 -0
- data/lib/yard-go/code_objects.rb +86 -0
- data/lib/yard-go/extensions.rb +64 -0
- data/lib/yard-go/handlers.rb +186 -0
- data/lib/yard-go/helpers.rb +94 -0
- data/lib/yard-go/parser.rb +194 -0
- data/lib/yard-go/version.rb +3 -0
- data/templates/default/bare_struct/html/fields.erb +15 -0
- data/templates/default/bare_struct/html/inherited_fields.erb +15 -0
- data/templates/default/bare_struct/html/method_signature.erb +18 -0
- data/templates/default/bare_struct/html/setup.rb +11 -0
- data/templates/default/field/html/method_signature.erb +4 -0
- data/templates/default/field/html/setup.rb +1 -0
- data/templates/default/fulldoc/html/css/common.css +33 -0
- data/templates/default/fulldoc/html/css/highlight.github.css +123 -0
- data/templates/default/fulldoc/html/full_list_package.erb +2 -0
- data/templates/default/fulldoc/html/setup.rb +10 -0
- data/templates/default/interface/html/implemented_by.erb +5 -0
- data/templates/default/interface/html/setup.rb +6 -0
- data/templates/default/layout/html/layout.erb +29 -0
- data/templates/default/layout/html/setup.rb +33 -0
- data/templates/default/method_details/html/source.erb +10 -0
- data/templates/default/module/html/box_info.erb +3 -0
- data/templates/default/module/html/constant_summary.erb +22 -0
- data/templates/default/module/html/inherited_methods.erb +18 -0
- data/templates/default/module/html/item_summary.erb +23 -0
- data/templates/default/module/html/method_details_list.erb +9 -0
- data/templates/default/module/html/packages.erb +4 -0
- data/templates/default/module/html/setup.rb +33 -0
- data/templates/default/package/html/list_summary.erb +12 -0
- data/templates/default/package/html/setup.rb +22 -0
- data/templates/default/package/html/type_details.erb +9 -0
- data/templates/default/struct/html/fields_details.erb +9 -0
- data/templates/default/struct/html/fields_summary.erb +12 -0
- data/templates/default/struct/html/implemented_interfaces.erb +5 -0
- data/templates/default/struct/html/inherited_fields.erb +15 -0
- data/templates/default/struct/html/setup.rb +9 -0
- data/yard-go.gemspec +15 -0
- metadata +83 -0
@@ -0,0 +1,29 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<%= erb(:headers) %>
|
5
|
+
</head>
|
6
|
+
<body>
|
7
|
+
<div class="nav_wrap">
|
8
|
+
<iframe id="nav" src="<%= @nav_url %>"></iframe>
|
9
|
+
<div id="resizer"></div>
|
10
|
+
</div>
|
11
|
+
|
12
|
+
<div id="main" tabindex="-1">
|
13
|
+
<div id="header">
|
14
|
+
<%= erb(:breadcrumb) %>
|
15
|
+
<%= erb(:search) %>
|
16
|
+
<div class="clear"></div>
|
17
|
+
</div>
|
18
|
+
|
19
|
+
<iframe id="search_frame"></iframe>
|
20
|
+
|
21
|
+
<div id="content">
|
22
|
+
<!--REGION_DISCLAIMER_DO_NOT_REMOVE-->
|
23
|
+
<%= yieldall %>
|
24
|
+
</div>
|
25
|
+
|
26
|
+
<%= erb(:footer) %>
|
27
|
+
</div>
|
28
|
+
</body>
|
29
|
+
</html>
|
@@ -0,0 +1,33 @@
|
|
1
|
+
def stylesheets
|
2
|
+
super + %w(css/highlight.github.css)
|
3
|
+
end
|
4
|
+
|
5
|
+
def menu_lists
|
6
|
+
[ { :type => 'package', :title => 'Packages', :search_title => 'Package List' },
|
7
|
+
{ :type => 'method', :title => 'Methods', :search_title => 'Method List' },
|
8
|
+
{ :type => 'file', :title => 'Files', :search_title => 'File List' } ]
|
9
|
+
end
|
10
|
+
|
11
|
+
def index
|
12
|
+
@objects_by_letter = {}
|
13
|
+
objects = Registry.all(:struct).sort_by {|o| o.name.to_s }
|
14
|
+
objects = run_verifier(objects)
|
15
|
+
objects.each {|o| (@objects_by_letter[o.name.to_s[0,1].upcase] ||= []) << o }
|
16
|
+
erb(:index)
|
17
|
+
end
|
18
|
+
|
19
|
+
def layout
|
20
|
+
@nav_url = url_for_list(!@file || options.index ? 'package' : 'file')
|
21
|
+
|
22
|
+
if !object || object.is_a?(String)
|
23
|
+
@path = nil
|
24
|
+
elsif @file
|
25
|
+
@path = @file.path
|
26
|
+
elsif !object.is_a?(YARD::CodeObjects::NamespaceObject)
|
27
|
+
@path = object.parent.path
|
28
|
+
else
|
29
|
+
@path = object.path
|
30
|
+
end
|
31
|
+
|
32
|
+
erb(:layout)
|
33
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<table class="source_code">
|
2
|
+
<tr>
|
3
|
+
<td>
|
4
|
+
<pre class="lines"><%= "\n\n\n" %><%= h format_lines(object) %></pre>
|
5
|
+
</td>
|
6
|
+
<td>
|
7
|
+
<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, :go %></pre>
|
8
|
+
</td>
|
9
|
+
</tr>
|
10
|
+
</table>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<% {"Constants" => constant_listing, "Variables" => variable_listing}.each do |title, cnsts| %>
|
2
|
+
<% if cnsts.size > 0 %>
|
3
|
+
<h2><%= title %></h2>
|
4
|
+
<% if cnsts.size > 0 %>
|
5
|
+
<dl class="constants">
|
6
|
+
<% cnsts.each do |cnst| %>
|
7
|
+
<dt id="<%= anchor_for(cnst) %>" class="<%= cnst.has_tag?(:deprecated) ? 'deprecated' : '' %>">
|
8
|
+
<div class="defn"><%= cnst.tag(:constant_type).text %> <strong><%= cnst.name %></strong> <%= signature_types cnst %> =
|
9
|
+
<% if cnst.has_tag?(:readonly) %><span class="note title readonly">readonly</span>
|
10
|
+
<% else %><span class="note title writeonly">writable</span><% end %>
|
11
|
+
</div>
|
12
|
+
<%= yieldall :object => cnst %>
|
13
|
+
</dt>
|
14
|
+
<dd>
|
15
|
+
<h3>Value:</h3>
|
16
|
+
<pre class="code"><%= link_types(format_constant(cnst.value)) %></pre>
|
17
|
+
</dd>
|
18
|
+
<% end %>
|
19
|
+
</dl>
|
20
|
+
<% end %>
|
21
|
+
<% end %>
|
22
|
+
<% end %>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<% found_method = false %>
|
2
|
+
<% object.inheritance_tree(true)[1..-1].each do |superclass| %>
|
3
|
+
<% next if superclass.is_a?(YARD::CodeObjects::Proxy) %>
|
4
|
+
<% next if options.embed_mixins.size > 0 && options.embed_mixins_match?(superclass) != false %>
|
5
|
+
<% meths = prune_method_listing(superclass.meths(:included => false, :inherited => false)) %>
|
6
|
+
<% meths.reject! {|m| object.child(:scope => m.scope, :name => m.name) != nil } %>
|
7
|
+
<% meths.reject! {|m| m.is_alias? || m.is_attribute? } %>
|
8
|
+
<% meths.reject! {|m| m.scope == :class } %>
|
9
|
+
<% next if meths.size == 0 %>
|
10
|
+
<% if method_listing.size == 0 && !found_method %><h2>Method Summary</h2><% end %>
|
11
|
+
<% found_method = true %>
|
12
|
+
<h3 class="inherited">Methods <%= superclass.type == :class ? 'inherited' : 'included' %> from <%= linkify superclass %></h3>
|
13
|
+
<p class="inherited"><%=
|
14
|
+
meths.sort_by {|o| o.name.to_s }.map do |m|
|
15
|
+
linkify(m)
|
16
|
+
end.join(", ")
|
17
|
+
%></p>
|
18
|
+
<% end %>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<li class="<%= @item.visibility %> <%= @item.has_tag?(:deprecated) ? 'deprecated' : '' %>">
|
2
|
+
<span class="summary_signature"><%= signature(@item) %></span>
|
3
|
+
<% if object != @item.namespace %>
|
4
|
+
<span class="note title not_defined_here">
|
5
|
+
<%= @item.namespace.type == :class ? 'inherited' : (@item.scope == :class ? 'extended' : 'included') %>
|
6
|
+
from <%= linkify @item, object.relative_path(@item.namespace) %>
|
7
|
+
</span>
|
8
|
+
<% end %>
|
9
|
+
<% if @item.type == :bare_struct || @item.type == :struct %><span class="note title readonly">struct</span><% end %>
|
10
|
+
<% if @item.type == :interface %><span class="note title interface">interface</span><% end %>
|
11
|
+
<% if @item.has_tag?(:readonly) %><span class="note title readonly">readonly</span><% end %>
|
12
|
+
<% if @item.has_tag?(:writeonly) %><span class="note title writeonly">writeonly</span><% end %>
|
13
|
+
<% if @item.visibility != :public %><span class="note title <%= @item.visibility %>"><%= @item.visibility %></span><% end %>
|
14
|
+
<% if @item.has_tag?(:abstract) %><span class="abstract note title">interface</span><% end %>
|
15
|
+
<% if @item.has_tag?(:deprecated) %><span class="deprecated note title">deprecated</span><% end %>
|
16
|
+
<% if @item.has_tag?(:api) && @item.tag(:api).text == 'private' %><span class="private note title">private</span><% end %>
|
17
|
+
|
18
|
+
<% if @item.has_tag?(:deprecated) %>
|
19
|
+
<span class="summary_desc"><strong>Deprecated.</strong> <%= htmlify_line @item.tag(:deprecated).text %></span>
|
20
|
+
<% else %>
|
21
|
+
<span class="summary_desc"><%= htmlify_line docstring_summary(@item) %></span>
|
22
|
+
<% end %>
|
23
|
+
</li>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<% scopes(method_listing(false)) do |list, scope| %>
|
2
|
+
<div id="<%= scope %>_method_details" class="method_details_list">
|
3
|
+
<h2><%= scope.to_s %> Details</h2>
|
4
|
+
|
5
|
+
<% list.each_with_index do |meth, i| %>
|
6
|
+
<%= yieldall :object => meth, :owner => object, :index => i %>
|
7
|
+
<% end %>
|
8
|
+
</div>
|
9
|
+
<% end %>
|
@@ -0,0 +1,33 @@
|
|
1
|
+
def init
|
2
|
+
super
|
3
|
+
sections.place(:packages).before(:constant_summary)
|
4
|
+
end
|
5
|
+
|
6
|
+
alias orig_constant_listing constant_listing
|
7
|
+
|
8
|
+
def constant_listing
|
9
|
+
@go_constant_listing ||= orig_constant_listing.select {|o| o.tag(:constant_type).text == "const" }
|
10
|
+
end
|
11
|
+
|
12
|
+
def variable_listing
|
13
|
+
@go_variable_listing ||= orig_constant_listing.select {|o| o.tag(:constant_type).text == "var" }
|
14
|
+
end
|
15
|
+
|
16
|
+
def scopes(list)
|
17
|
+
[:class, :instance].each do |scope|
|
18
|
+
items = list.select {|m| m.scope == scope }
|
19
|
+
yield(items, items.first.scope_name) unless items.empty?
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def groups(list, type = "")
|
24
|
+
super(list, "") do |items, scope|
|
25
|
+
yield(items, scope.gsub(/\b[a-z]/) {|m| m.upcase })
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def packages
|
30
|
+
@packages = object.children.select {|c| c.type == :package }.sort_by {|c| c.name.to_s }
|
31
|
+
return if @packages.size == 0
|
32
|
+
erb :packages
|
33
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
include T('default/module/html')
|
2
|
+
include YARDGo::CodeObjects
|
3
|
+
|
4
|
+
def init
|
5
|
+
super
|
6
|
+
sections.place(:type_summary, [:item_summary], :interface_summary, [:item_summary]).before(:method_summary)
|
7
|
+
sections.place(:type_details, [T('bare_struct')]).before(:method_details_list)
|
8
|
+
|
9
|
+
@types = object.children.select {|c| c.type == :bare_struct }.sort_by {|c| c.name.to_s }
|
10
|
+
end
|
11
|
+
|
12
|
+
def type_summary
|
13
|
+
@items = object.children.select {|c| c.type == :bare_struct || c.type == :struct }.sort_by {|c| c.name.to_s }
|
14
|
+
@name = "Type"
|
15
|
+
erb :list_summary
|
16
|
+
end
|
17
|
+
|
18
|
+
def interface_summary
|
19
|
+
@items = object.children.select {|c| c.type == :interface }.sort_by {|c| c.name.to_s }
|
20
|
+
@name = "Interface"
|
21
|
+
erb :list_summary
|
22
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<% found_method = false %>
|
2
|
+
<% object.inheritance_tree(true)[1..-1].each do |superclass| %>
|
3
|
+
<% next if superclass.is_a?(YARD::CodeObjects::Proxy) %>
|
4
|
+
<% next if options.embed_mixins.size > 0 && options.embed_mixins_match?(superclass) != false %>
|
5
|
+
<% meths = superclass.children.select {|c| c.type == :field } %>
|
6
|
+
<% next if meths.size == 0 %>
|
7
|
+
<% if method_listing.size == 0 && !found_method %><h2>Method Summary</h2><% end %>
|
8
|
+
<% found_method = true %>
|
9
|
+
<h3 class="inherited">Fields <%= superclass.type == :class ? 'inherited' : 'included' %> from <%= linkify superclass %></h3>
|
10
|
+
<p class="inherited"><%=
|
11
|
+
meths.sort_by {|o| o.name.to_s }.map do |m|
|
12
|
+
linkify(m)
|
13
|
+
end.join(", ")
|
14
|
+
%></p>
|
15
|
+
<% end %>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
include T('default/class/html')
|
2
|
+
|
3
|
+
def init
|
4
|
+
super
|
5
|
+
sections.place(:implemented_interfaces).before(:constant_summary)
|
6
|
+
sections.place(:fields_summary, [:item_summary], :inherited_fields).before(:method_summary)
|
7
|
+
sections.place(:fields_details, [T('field')]).before(:method_details_list)
|
8
|
+
@fields = object.children.select {|t| t.type == :field }.sort_by {|t| t.name.to_s }
|
9
|
+
end
|
data/yard-go.gemspec
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require File.expand_path('../lib/yard-go/version', __FILE__)
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = "yard-go"
|
5
|
+
s.summary = "YARD plugin for documenting Go source code"
|
6
|
+
s.version = YARDGo::VERSION
|
7
|
+
s.date = Time.now.strftime('%Y-%m-%d')
|
8
|
+
s.author = "Loren Segal"
|
9
|
+
s.email = "lsegal@soen.ca"
|
10
|
+
s.homepage = "http://github.com/lsegal/yard-go"
|
11
|
+
s.platform = Gem::Platform::RUBY
|
12
|
+
s.files = Dir.glob("{lib,templates}/**/*") +
|
13
|
+
['LICENSE.txt', 'README.md', __FILE__]
|
14
|
+
s.require_paths = ['lib']
|
15
|
+
end
|
metadata
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: yard-go
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.5.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Loren Segal
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-07-01 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description:
|
14
|
+
email: lsegal@soen.ca
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/yard-go/code_objects.rb
|
20
|
+
- lib/yard-go/extensions.rb
|
21
|
+
- lib/yard-go/handlers.rb
|
22
|
+
- lib/yard-go/helpers.rb
|
23
|
+
- lib/yard-go/parser.rb
|
24
|
+
- lib/yard-go/version.rb
|
25
|
+
- lib/yard-go.rb
|
26
|
+
- templates/default/bare_struct/html/fields.erb
|
27
|
+
- templates/default/bare_struct/html/inherited_fields.erb
|
28
|
+
- templates/default/bare_struct/html/method_signature.erb
|
29
|
+
- templates/default/bare_struct/html/setup.rb
|
30
|
+
- templates/default/field/html/method_signature.erb
|
31
|
+
- templates/default/field/html/setup.rb
|
32
|
+
- templates/default/fulldoc/html/css/common.css
|
33
|
+
- templates/default/fulldoc/html/css/highlight.github.css
|
34
|
+
- templates/default/fulldoc/html/full_list_package.erb
|
35
|
+
- templates/default/fulldoc/html/setup.rb
|
36
|
+
- templates/default/interface/html/implemented_by.erb
|
37
|
+
- templates/default/interface/html/setup.rb
|
38
|
+
- templates/default/layout/html/layout.erb
|
39
|
+
- templates/default/layout/html/setup.rb
|
40
|
+
- templates/default/method_details/html/source.erb
|
41
|
+
- templates/default/module/html/box_info.erb
|
42
|
+
- templates/default/module/html/constant_summary.erb
|
43
|
+
- templates/default/module/html/inherited_methods.erb
|
44
|
+
- templates/default/module/html/item_summary.erb
|
45
|
+
- templates/default/module/html/method_details_list.erb
|
46
|
+
- templates/default/module/html/packages.erb
|
47
|
+
- templates/default/module/html/setup.rb
|
48
|
+
- templates/default/package/html/list_summary.erb
|
49
|
+
- templates/default/package/html/setup.rb
|
50
|
+
- templates/default/package/html/type_details.erb
|
51
|
+
- templates/default/struct/html/fields_details.erb
|
52
|
+
- templates/default/struct/html/fields_summary.erb
|
53
|
+
- templates/default/struct/html/implemented_interfaces.erb
|
54
|
+
- templates/default/struct/html/inherited_fields.erb
|
55
|
+
- templates/default/struct/html/setup.rb
|
56
|
+
- LICENSE.txt
|
57
|
+
- README.md
|
58
|
+
- yard-go.gemspec
|
59
|
+
homepage: http://github.com/lsegal/yard-go
|
60
|
+
licenses: []
|
61
|
+
metadata: {}
|
62
|
+
post_install_message:
|
63
|
+
rdoc_options: []
|
64
|
+
require_paths:
|
65
|
+
- lib
|
66
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - '>='
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
requirements: []
|
77
|
+
rubyforge_project:
|
78
|
+
rubygems_version: 2.0.14
|
79
|
+
signing_key:
|
80
|
+
specification_version: 4
|
81
|
+
summary: YARD plugin for documenting Go source code
|
82
|
+
test_files: []
|
83
|
+
has_rdoc:
|