forked from Homebrew/brew
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Homebrew#10969 from reitermarkus/yard
Move YARD config into `Library/Homebrew`.
- Loading branch information
Showing
10 changed files
with
93 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--title "Homebrew Ruby API" | ||
--main README.md | ||
--markup markdown | ||
--no-private | ||
--load yard/ignore_directives.rb | ||
--template-path yard/templates | ||
--exclude test/ | ||
--exclude vendor/ | ||
--exclude compat/ | ||
**/*.rb | ||
- | ||
*.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# typed: false | ||
# frozen_string_literal: true | ||
|
||
# from https://github.com/lsegal/yard/issues/484#issuecomment-442586899 | ||
class IgnoreDirectiveDocstringParser < YARD::DocstringParser | ||
def parse_content(content) | ||
super(content&.sub(/(\A(typed|.*rubocop)|TODO):.*/m, "")) | ||
end | ||
end | ||
|
||
YARD::Docstring.default_parser = IgnoreDirectiveDocstringParser |
5 changes: 5 additions & 0 deletions
5
Library/Homebrew/yard/templates/default/docstring/html/internal.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<p class="note private"> | ||
<strong>This <%= object.type %> is part of an internal API.</strong> | ||
This <%= object.type %> may only be used internally in repositories owned by <a href="https://github.com/Homebrew">Homebrew</a>, except in casks or formulae. | ||
Third parties should avoid using this <%= object.type %> if possible, as it may be removed or be changed without warning. | ||
</p> |
5 changes: 5 additions & 0 deletions
5
Library/Homebrew/yard/templates/default/docstring/html/private.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<p class="note private"> | ||
<strong>This <%= object.type %> is part of a private API.</strong> | ||
This <%= object.type %> may only be used in the <a href="https://github.com/Homebrew/brew">Homebrew/brew</a> repository. | ||
Third parties should avoid using this <%= object.type %> if possible, as it may be removed or be changed without warning. | ||
</p> |
14 changes: 14 additions & 0 deletions
14
Library/Homebrew/yard/templates/default/docstring/html/setup.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# typed: false | ||
# frozen_string_literal: true | ||
|
||
def init | ||
super | ||
|
||
return if sections.empty? | ||
|
||
sections[:index].place(:internal).before(:private) | ||
end | ||
|
||
def internal | ||
erb(:internal) if object.has_tag?(:api) && object.tag(:api).text == "internal" | ||
end |
39 changes: 39 additions & 0 deletions
39
Library/Homebrew/yard/templates/default/module/html/item_summary.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
|
||
<li class="<%= @item.visibility %> <%= @item.has_tag?(:deprecated) ? 'deprecated' : '' %>"> | ||
<span class="summary_signature"> | ||
<% if @item.tags(:overload).size == 1 %> | ||
<%= signature(@item.tag(:overload), true, false, !@item.attr_info) %> | ||
<% else %> | ||
<%= signature(@item, true, false, !@item.attr_info) %> | ||
<% end %> | ||
<% if @item.aliases.size > 0 %> | ||
(also: <%= @item.aliases.map {|o| h(o.name(true)) }.join(", ") %>) | ||
<% end %> | ||
</span> | ||
<% if object != @item.namespace %> | ||
<span class="note title not_defined_here"> | ||
<%= @item.namespace.type == :class ? 'inherited' : (@item.scope == :class ? 'extended' : 'included') %> | ||
from <%= linkify @item, object.relative_path(@item.namespace) %> | ||
</span> | ||
<% end %> | ||
<% if @item.constructor? %> | ||
<span class="note title constructor">constructor</span> | ||
<% end %> | ||
<% if rw = @item.attr_info %> | ||
<% if !run_verifier([rw[:read]].compact).empty? && run_verifier([rw[:write]].compact).empty? %> | ||
<span class="note title readonly">readonly</span> | ||
<% end %> | ||
<% if !run_verifier([rw[:write]].compact).empty? && run_verifier([rw[:read]].compact).empty? %> | ||
<span class="note title writeonly">writeonly</span> | ||
<% end %> | ||
<% end %> | ||
<% 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 != 'public' %><span class="private note title"><%= @item.tag(:api).text %></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> |