yard-web-plugin 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. data/.document +5 -0
  2. data/.gitignore +21 -0
  3. data/LICENSE +20 -0
  4. data/README.rdoc +17 -0
  5. data/Rakefile +53 -0
  6. data/VERSION +1 -0
  7. data/lib/yard-web-plugin.rb +23 -0
  8. data/lib/yard-web-plugin/base_helper.rb +41 -0
  9. data/templates/rest/class/html/header.erb +39 -0
  10. data/templates/rest/class/html/method_details_list.erb +8 -0
  11. data/templates/rest/class/html/setup.rb +9 -0
  12. data/templates/rest/disqus/html/disqus.erb +24 -0
  13. data/templates/rest/disqus/setup.rb +9 -0
  14. data/templates/rest/docstring/html/setup.rb +4 -0
  15. data/templates/rest/docstring/html/text.erb +1 -0
  16. data/templates/rest/fulldoc/html/css/common.css +1 -0
  17. data/templates/rest/fulldoc/html/css/full_list.css +78 -0
  18. data/templates/rest/fulldoc/html/css/style.css +235 -0
  19. data/templates/rest/fulldoc/html/full_list.erb +29 -0
  20. data/templates/rest/fulldoc/html/full_list_files.erb +5 -0
  21. data/templates/rest/fulldoc/html/full_list_resource.erb +8 -0
  22. data/templates/rest/fulldoc/html/full_list_topic.erb +14 -0
  23. data/templates/rest/fulldoc/html/js/app.js +42 -0
  24. data/templates/rest/fulldoc/html/js/full_list.js +117 -0
  25. data/templates/rest/fulldoc/html/js/jquery.js +19 -0
  26. data/templates/rest/fulldoc/html/setup.rb +102 -0
  27. data/templates/rest/layout/html/footer.erb +3 -0
  28. data/templates/rest/layout/html/headers.erb +13 -0
  29. data/templates/rest/layout/html/index.erb +60 -0
  30. data/templates/rest/layout/html/layout.erb +22 -0
  31. data/templates/rest/layout/html/search.erb +5 -0
  32. data/templates/rest/layout/html/setup.rb +69 -0
  33. data/templates/rest/method_details/html/header.erb +3 -0
  34. data/templates/rest/method_details/html/method_signature.erb +28 -0
  35. data/templates/rest/method_details/html/setup.rb +7 -0
  36. data/templates/rest/module/setup.rb +4 -0
  37. data/templates/rest/tags/html/example_request.erb +9 -0
  38. data/templates/rest/tags/html/example_response.erb +9 -0
  39. data/templates/rest/tags/html/generic_tag.erb +17 -0
  40. data/templates/rest/tags/html/index.erb +3 -0
  41. data/templates/rest/tags/setup.rb +41 -0
  42. metadata +123 -0
@@ -0,0 +1,5 @@
1
+ <div id="search">
2
+ <!-- <a id="topic_list_link" href="#">Topic List</a> -->
3
+ <a id="resource_list_link" href="#">Resource List</a>
4
+ <a id="file_list_link" href="#">File List</a>
5
+ </div>
@@ -0,0 +1,69 @@
1
+ include Helpers::FilterHelper
2
+
3
+ def init
4
+ @breadcrumb = []
5
+
6
+ @page_title = options[:title]
7
+
8
+ if @file
9
+ @contents = File.read_binary(@file)
10
+ @file = File.basename(@file)
11
+ sections :layout, [:diskfile]
12
+ elsif object
13
+ case object
14
+ when '_index.html'
15
+ sections :layout, [:index, [T('class')]]
16
+ when CodeObjects::Base
17
+ type = object.root? ? :module : object.type
18
+ sections :layout, [T(type)]
19
+ end
20
+ else
21
+ sections :layout, [:contents]
22
+ end
23
+ end
24
+
25
+ def contents
26
+ @contents
27
+ end
28
+
29
+ def index
30
+
31
+ legitimate_objects = index_objects(@objects).reject {|o| o.root? }
32
+ @topics = {}
33
+
34
+ legitimate_objects.each do |object|
35
+ object.tags('topic').each { |topic| (@topics[topic.text] ||= []) << object }
36
+ end
37
+
38
+ @resources = legitimate_objects.sort_by {|o| o.tags('url').first.text }
39
+
40
+ @overall_objects = @objects.find_all {|o| o.has_tag?('overall')}.sort_by {|o| o.tag('overall').text}
41
+
42
+ erb(:index)
43
+ end
44
+
45
+ def diskfile
46
+ "<div id='filecontents'>" +
47
+ case (File.extname(@file)[1..-1] || '').downcase
48
+ when 'htm', 'html'
49
+ @contents
50
+ when 'txt'
51
+ "<pre>#{@contents}</pre>"
52
+ when 'textile', 'txtile'
53
+ htmlify(@contents, :textile)
54
+ when 'markdown', 'md', 'mdown', 'mkd'
55
+ htmlify(@contents, :markdown)
56
+ else
57
+ htmlify(@contents, diskfile_shebang_or_default)
58
+ end +
59
+ "</div>"
60
+ end
61
+
62
+ def diskfile_shebang_or_default
63
+ if @contents =~ /\A#!(\S+)\s*$/ # Shebang support
64
+ @contents = $'
65
+ $1.to_sym
66
+ else
67
+ options[:markup]
68
+ end
69
+ end
@@ -0,0 +1,3 @@
1
+ <div class="method_details <%= @index == 0 ? 'first' : '' %>">
2
+ <%= yieldall %>
3
+ </div>
@@ -0,0 +1,28 @@
1
+ <ul class="signature <%= 'first' if @index == 0 %>" id="<%= anchor_for(object) %>">
2
+ <li>
3
+ <% if object.tags(:overload).size == 1 %>
4
+ <%= signature(object.tag(:overload), false) %>
5
+ <% elsif object.tags(:overload).size > 1 %>
6
+ <% object.tags(:overload).each do |overload| %>
7
+ <span class="overload"><%= signature(overload, false) %></span>
8
+ <% end %>
9
+ <% else %>
10
+ <%= signature(object, false) %>
11
+ <% end %>
12
+
13
+ <% if object.aliases.size > 0 %>
14
+ <span class="aliases">Also known as:
15
+ <span class="names"><%= object.aliases.map {|o|
16
+ "<span id='#{anchor_for(o)}'>" + h(o.name.to_s) + "</span>" }.join(", ") %></span>
17
+ </span>
18
+ <% end %>
19
+ </li>
20
+ </ul>
21
+ <% if object.tags(:url).size > 0 %>
22
+ <h3>Url:</h3>
23
+ <ul id="<%= anchor_for(object) %>">
24
+ <% object.tags(:url).each do |url| %>
25
+ <li><%= url.text %></li>
26
+ <% end %>
27
+ </ul>
28
+ <% end %>
@@ -0,0 +1,7 @@
1
+ def init
2
+ sections :header, [:method_signature, T('docstring')]
3
+ end
4
+
5
+ def header
6
+ erb(:header)
7
+ end
@@ -0,0 +1,4 @@
1
+ def init
2
+
3
+ end
4
+
@@ -0,0 +1,9 @@
1
+ <% if object.has_tag?(:example_request) %>
2
+ <div class="examples">
3
+ <h3>Example Request:</h3>
4
+ <% object.tags(:example_request).each do |tag| %>
5
+ <h4><%= htmlify_line(tag.name) %></h4>
6
+ <pre class="example code"><%= html_syntax_highlight(tag.text, :plain) %></pre>
7
+ <% end %>
8
+ </div>
9
+ <% end %>
@@ -0,0 +1,9 @@
1
+ <% if object.has_tag?(:example_response) %>
2
+ <div class="examples">
3
+ <h3>Example Response:</h3>
4
+ <% object.tags(:example_response).each do |tag| %>
5
+ <h4><%= htmlify_line(tag.name) %></h4>
6
+ <pre class="example code"><%= html_syntax_highlight(tag.text, :plain) %></pre>
7
+ <% end %>
8
+ </div>
9
+ <% end %>
@@ -0,0 +1,17 @@
1
+ <h3><%= @label ? @label : YARD::Tags::Library.labels[@name] %>:</h3>
2
+ <ul class="<%= @name %>">
3
+ <% object.tags(@name).each do |tag| %>
4
+ <li>
5
+ <% unless @no_types %>
6
+ <span class='type'><%= format_types(tag.types) %></span>
7
+ <% end %>
8
+ <% unless @no_names %>
9
+ <span class='name'><%= h tag.name %></span>
10
+ <% end %>
11
+ <% if tag.text && !tag.text.empty? %>
12
+ <% unless (@no_types || tag.types.nil? || tag.types.empty?) && @no_names %>&mdash;<% end %>
13
+ <%= htmlify_line(tag.text) %>
14
+ <% end %>
15
+ </li>
16
+ <% end %>
17
+ </ul>
@@ -0,0 +1,3 @@
1
+ <div class="tags">
2
+ <%= yieldall %>
3
+ </div>
@@ -0,0 +1,41 @@
1
+ def init
2
+ super
3
+ sections :index, [:argument,
4
+ :example_request,
5
+ :request_field,
6
+ :example_response,
7
+ :response_field,
8
+ :header,
9
+ :response_code]
10
+ end
11
+
12
+ def request_field
13
+ generic_tag :request_field
14
+ end
15
+
16
+ def response_field
17
+ generic_tag :response_field
18
+ end
19
+
20
+ def argument
21
+ generic_tag :argument, :no_types => false
22
+ end
23
+
24
+ def header
25
+ generic_tag :header
26
+ end
27
+
28
+ def response_code
29
+ generic_tag :response_code
30
+ end
31
+
32
+ def generic_tag(name, opts = {})
33
+ return unless object.has_tag?(name)
34
+ @no_names = true if opts[:no_names]
35
+ @no_types = true if opts[:no_types]
36
+ @name = name
37
+ out = erb('generic_tag')
38
+ @no_names, @no_types = nil, nil
39
+ out
40
+ end
41
+
metadata ADDED
@@ -0,0 +1,123 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: yard-web-plugin
3
+ version: !ruby/object:Gem::Version
4
+ hash: 31
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 2
10
+ version: 0.1.2
11
+ platform: ruby
12
+ authors:
13
+ - Alexey Ilyichev
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-11-15 00:00:00 +03:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: yard
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ hash: 5
30
+ segments:
31
+ - 0
32
+ - 6
33
+ - 1
34
+ version: 0.6.1
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ description: See yard-rest-plugin for more detail
38
+ email: alexey.ilyichev@qik.com
39
+ executables: []
40
+
41
+ extensions: []
42
+
43
+ extra_rdoc_files:
44
+ - LICENSE
45
+ - README.rdoc
46
+ files:
47
+ - .document
48
+ - .gitignore
49
+ - LICENSE
50
+ - README.rdoc
51
+ - Rakefile
52
+ - VERSION
53
+ - lib/yard-web-plugin.rb
54
+ - lib/yard-web-plugin/base_helper.rb
55
+ - templates/rest/class/html/header.erb
56
+ - templates/rest/class/html/method_details_list.erb
57
+ - templates/rest/class/html/setup.rb
58
+ - templates/rest/disqus/html/disqus.erb
59
+ - templates/rest/disqus/setup.rb
60
+ - templates/rest/docstring/html/setup.rb
61
+ - templates/rest/docstring/html/text.erb
62
+ - templates/rest/fulldoc/html/css/common.css
63
+ - templates/rest/fulldoc/html/css/full_list.css
64
+ - templates/rest/fulldoc/html/css/style.css
65
+ - templates/rest/fulldoc/html/full_list.erb
66
+ - templates/rest/fulldoc/html/full_list_files.erb
67
+ - templates/rest/fulldoc/html/full_list_resource.erb
68
+ - templates/rest/fulldoc/html/full_list_topic.erb
69
+ - templates/rest/fulldoc/html/js/app.js
70
+ - templates/rest/fulldoc/html/js/full_list.js
71
+ - templates/rest/fulldoc/html/js/jquery.js
72
+ - templates/rest/fulldoc/html/setup.rb
73
+ - templates/rest/layout/html/footer.erb
74
+ - templates/rest/layout/html/headers.erb
75
+ - templates/rest/layout/html/index.erb
76
+ - templates/rest/layout/html/layout.erb
77
+ - templates/rest/layout/html/search.erb
78
+ - templates/rest/layout/html/setup.rb
79
+ - templates/rest/method_details/html/header.erb
80
+ - templates/rest/method_details/html/method_signature.erb
81
+ - templates/rest/method_details/html/setup.rb
82
+ - templates/rest/module/setup.rb
83
+ - templates/rest/tags/html/example_request.erb
84
+ - templates/rest/tags/html/example_response.erb
85
+ - templates/rest/tags/html/generic_tag.erb
86
+ - templates/rest/tags/html/index.erb
87
+ - templates/rest/tags/setup.rb
88
+ has_rdoc: true
89
+ homepage: http://github.com/alexz77/yard-web-plugin
90
+ licenses: []
91
+
92
+ post_install_message:
93
+ rdoc_options:
94
+ - --charset=UTF-8
95
+ require_paths:
96
+ - lib
97
+ required_ruby_version: !ruby/object:Gem::Requirement
98
+ none: false
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ hash: 3
103
+ segments:
104
+ - 0
105
+ version: "0"
106
+ required_rubygems_version: !ruby/object:Gem::Requirement
107
+ none: false
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ hash: 3
112
+ segments:
113
+ - 0
114
+ version: "0"
115
+ requirements: []
116
+
117
+ rubyforge_project:
118
+ rubygems_version: 1.3.7
119
+ signing_key:
120
+ specification_version: 3
121
+ summary: This is a fork of yard-rest-plugin
122
+ test_files: []
123
+