yard-api 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e7c2eba4abe4ecd107cc9cc902e36c05e5816e9
|
4
|
+
data.tar.gz: bc34644b9a32d557a6863d6e316d2e1c9bfd70b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d0abfc99e7f6d40e331219a96f5813b8a716d0fb7c78d0fc683543c6231053991833fec5450ca604deafa0ce7b55ec2618acd01336ec3480df3e250d2cb792e4
|
7
|
+
data.tar.gz: 3324e947fa1ed339a7cc8f9ca90d019a561fca7a4a6b2e3cbc099d2645112cb1a354549e18ebe6269d8a2cc89d1dee78f314293595b69311ae5926cd92217e27
|
@@ -71,12 +71,13 @@ module YARD::Templates::Helpers::BaseHelper
|
|
71
71
|
|
72
72
|
def lookup_topic(controller_name)
|
73
73
|
controller = nil
|
74
|
-
topic = options[:resources].find
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
74
|
+
topic = options[:resources].find do |resource, controllers|
|
75
|
+
controllers.detect do |_controller|
|
76
|
+
if _controller.path.to_s == controller_name
|
77
|
+
controller = _controller
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
80
81
|
|
81
82
|
[ topic, controller ]
|
82
83
|
end
|
@@ -84,7 +85,7 @@ module YARD::Templates::Helpers::BaseHelper
|
|
84
85
|
def lookup_appendix(title)
|
85
86
|
appendix = nil
|
86
87
|
|
87
|
-
puts "
|
88
|
+
puts "Looking up appendix: #{title}" if api_options.verbose
|
88
89
|
|
89
90
|
if object
|
90
91
|
# try in the object scope
|
@@ -12,6 +12,8 @@ module YARD::Templates::Helpers::HtmlHelper
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def static_pages()
|
15
|
+
return @static_pages if @static_pages
|
16
|
+
|
15
17
|
options = YARD::APIPlugin.options
|
16
18
|
|
17
19
|
paths = Array(options.static).map do |entry|
|
@@ -37,8 +39,6 @@ module YARD::Templates::Helpers::HtmlHelper
|
|
37
39
|
end
|
38
40
|
end.flatten.compact.uniq.map { |path| File.join(options.source, path) }
|
39
41
|
|
40
|
-
puts "Static pages: #{paths}" if options.verbose
|
41
|
-
|
42
42
|
markdown_exts = YARD::Templates::Helpers::MarkupHelper::MARKUP_EXTENSIONS[:markdown]
|
43
43
|
readme_page = options.readme
|
44
44
|
pages = Dir.glob(paths)
|
@@ -47,7 +47,7 @@ module YARD::Templates::Helpers::HtmlHelper
|
|
47
47
|
pages.delete_if { |page| page.match(readme_page) }
|
48
48
|
end
|
49
49
|
|
50
|
-
pages.map do |page|
|
50
|
+
@static_pages = pages.map do |page|
|
51
51
|
filename = 'file.' + File.split(page).last.sub(/\..*$/, '.html')
|
52
52
|
|
53
53
|
# extract page title if it's a markdown document; title is expected to
|
@@ -73,22 +73,30 @@ module YARD::Templates::Helpers::HtmlHelper
|
|
73
73
|
|
74
74
|
# override yard-appendix link_appendix
|
75
75
|
def link_appendix(ref)
|
76
|
-
|
76
|
+
puts "Linking appendix: #{ref}" if api_options.verbose
|
77
77
|
|
78
|
-
puts "looking up appendix: #{ref}"
|
79
78
|
unless appendix = lookup_appendix(ref.to_s)
|
80
|
-
raise
|
79
|
+
raise "Unable to locate referenced appendix '#{ref}'"
|
81
80
|
end
|
82
81
|
|
83
|
-
|
82
|
+
html_file = if options[:all_resources] && api_options.one_file
|
83
|
+
'index.html'
|
84
|
+
elsif options[:all_resources]
|
85
|
+
'all_resources.html'
|
86
|
+
else
|
87
|
+
topic, controller = *lookup_topic(appendix.namespace.to_s)
|
84
88
|
|
85
|
-
|
86
|
-
|
89
|
+
unless topic
|
90
|
+
raise "Unable to locate topic for appendix: #{ref}"
|
91
|
+
end
|
92
|
+
|
93
|
+
"#{topicize(topic.first)}.html"
|
87
94
|
end
|
88
95
|
|
89
|
-
html_file = "#{topicize topic.first}.html"
|
90
96
|
bookmark = "#{appendix.name.to_s.gsub(' ', '+')}-appendix"
|
91
|
-
link_url("#{html_file}##{bookmark}", appendix.title)
|
97
|
+
link_url("#{html_file}##{bookmark}", appendix.title).tap do |link|
|
98
|
+
puts "\tAppendix link: #{link}" if api_options.verbose
|
99
|
+
end
|
92
100
|
end
|
93
101
|
|
94
102
|
def sidebar_link(title, href, options={})
|
data/lib/yard-api/version.rb
CHANGED
@@ -7,13 +7,19 @@ end
|
|
7
7
|
def appendix
|
8
8
|
controllers = options[:controllers]
|
9
9
|
|
10
|
+
if options[:all_resources]
|
11
|
+
controllers = options[:resources].flatten.select { |o|
|
12
|
+
o.is_a?(YARD::CodeObjects::NamespaceObject)
|
13
|
+
}
|
14
|
+
end
|
15
|
+
|
10
16
|
unless controllers && controllers.is_a?(Array)
|
11
17
|
return
|
12
18
|
end
|
13
19
|
|
14
|
-
@appendixes = controllers.collect
|
15
|
-
|
16
|
-
|
20
|
+
@appendixes = controllers.collect do |controller|
|
21
|
+
controller.children.select { |tag| :appendix == tag.type }
|
22
|
+
end.flatten.uniq
|
17
23
|
|
18
24
|
super
|
19
25
|
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
<article>
|
2
|
-
<%=
|
2
|
+
<%= htmlify(@docstring) %>
|
3
3
|
</article>
|
4
4
|
|
5
5
|
<% c = options[:controllers].detect { |c| c.has_tag?(:note) } %>
|
6
6
|
<% c && c.tags(:note).each do |tag| %>
|
7
7
|
<blockquote class="note">
|
8
8
|
<p><strong>Note</strong></p>
|
9
|
-
<%=
|
9
|
+
<%= htmlify tag.text %>
|
10
10
|
</blockquote>
|
11
11
|
<% end %>
|
12
12
|
|