Skip to content

Commit abea74a

Browse files
committed
📝 Add mathjax template for YARD
[ci skip]
1 parent 6c4d1e0 commit abea74a

112 files changed

Lines changed: 2641 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.yardopts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
--markup markdown
2+
--template mathjax
3+
--template-path yard/templates
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
include T('default/module/dot')
2+
3+
def init
4+
super
5+
sections.push :superklass
6+
end
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<% if object.superclass.path != "Object" && object.superclass.path != "BasicObject" %>
2+
<%= format_path object %> -> <%= format_path object.superclass %>;
3+
<% end %>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<div id="constructor_details" class="method_details_list">
2+
<h2>Constructor Details</h2>
3+
<% if @ctor.namespace != object %>
4+
<p class="notice">This class inherits a constructor from <%= linkify @ctor, @ctor.namespace.path %></p>
5+
<% else %>
6+
<%= yieldall :object => @ctor, :index => 0 %>
7+
<% end %>
8+
</div>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include T('default/module/html')
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<div id="subclasses">
2+
<h2>Direct Known Subclasses</h2>
3+
<p class="children"><%= @subclasses.map {|name, child| linkify(child, name) }.join(", ") %></p>
4+
</div>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
include T('default/module')
2+
3+
def init
4+
super
5+
sections.place(:subclasses).before(:children)
6+
sections.place(:constructor_details, [T('method_details')]).before(:methodmissing)
7+
end
8+
9+
def constructor_details
10+
ctors = object.meths(:inherited => true, :included => true)
11+
return unless @ctor = ctors.find {|o| o.constructor? }
12+
return if prune_method_listing([@ctor]).empty?
13+
erb(:constructor_details)
14+
end
15+
16+
def subclasses
17+
return if object.path == "Object" # don't show subclasses for Object
18+
unless globals.subclasses
19+
globals.subclasses = {}
20+
list = run_verifier Registry.all(:class)
21+
list.each do |o|
22+
(globals.subclasses[o.superclass.path] ||= []) << o if o.superclass
23+
end
24+
end
25+
26+
@subclasses = globals.subclasses[object.path]
27+
return if @subclasses.nil? || @subclasses.empty?
28+
@subclasses = @subclasses.sort_by {|o| o.path }.map do |child|
29+
name = child.path
30+
if object.namespace
31+
name = object.relative_path(child)
32+
end
33+
[name, child]
34+
end
35+
erb(:subclasses)
36+
end
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
include T('default/module/text')
2+
3+
def init
4+
super
5+
sections.place(:subclasses).before(:children)
6+
sections.delete(:children)
7+
end
8+
9+
def format_object_title(object)
10+
"Class: #{object.title} < #{object.superclass.title}"
11+
end
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Direct Known Subclasses:
2+
------------------------
3+
4+
<%= indent(wrap(@subclasses.map {|name, child| name }.join(", "))) %>
5+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<%= title_align_right format_object_title(object) %>
2+
3+
4+
<%= object.name %> = <%= object.value.size > 40 ? "\n\n" + indent(object.value) : object.value %>
5+
6+
7+
<%= hr %>
8+
9+
<%= yieldall %>
10+
11+
<%= hr %>

0 commit comments

Comments
 (0)