pdoc 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. data/README.markdown +34 -0
  2. data/Rakefile +46 -0
  3. data/bin/pdoc +58 -0
  4. data/lib/pdoc.rb +32 -0
  5. data/lib/pdoc/error.rb +4 -0
  6. data/lib/pdoc/generators.rb +6 -0
  7. data/lib/pdoc/generators/abstract_generator.rb +16 -0
  8. data/lib/pdoc/generators/html.rb +8 -0
  9. data/lib/pdoc/generators/html/helpers.rb +256 -0
  10. data/lib/pdoc/generators/html/page.rb +71 -0
  11. data/lib/pdoc/generators/html/syntax_highlighter.rb +41 -0
  12. data/lib/pdoc/generators/html/template.rb +37 -0
  13. data/lib/pdoc/generators/html/website.rb +194 -0
  14. data/lib/pdoc/generators/json.rb +15 -0
  15. data/lib/pdoc/generators/pythonesque.rb +105 -0
  16. data/lib/pdoc/models.rb +47 -0
  17. data/lib/pdoc/models/argument.rb +37 -0
  18. data/lib/pdoc/models/base.rb +107 -0
  19. data/lib/pdoc/models/callable.rb +19 -0
  20. data/lib/pdoc/models/class.rb +28 -0
  21. data/lib/pdoc/models/class_method.rb +18 -0
  22. data/lib/pdoc/models/class_property.rb +9 -0
  23. data/lib/pdoc/models/constant.rb +9 -0
  24. data/lib/pdoc/models/constructor.rb +14 -0
  25. data/lib/pdoc/models/container.rb +114 -0
  26. data/lib/pdoc/models/entity.rb +54 -0
  27. data/lib/pdoc/models/instance_method.rb +18 -0
  28. data/lib/pdoc/models/instance_property.rb +9 -0
  29. data/lib/pdoc/models/mixin.rb +10 -0
  30. data/lib/pdoc/models/namespace.rb +10 -0
  31. data/lib/pdoc/models/root.rb +27 -0
  32. data/lib/pdoc/models/section.rb +19 -0
  33. data/lib/pdoc/models/signature.rb +27 -0
  34. data/lib/pdoc/models/utility.rb +11 -0
  35. data/lib/pdoc/parser.rb +109 -0
  36. data/lib/pdoc/parser/argument_description_nodes.rb +21 -0
  37. data/lib/pdoc/parser/basic_nodes.rb +31 -0
  38. data/lib/pdoc/parser/description_nodes.rb +42 -0
  39. data/lib/pdoc/parser/documentation_nodes.rb +483 -0
  40. data/lib/pdoc/parser/ebnf_arguments_nodes.rb +58 -0
  41. data/lib/pdoc/parser/ebnf_expression_nodes.rb +227 -0
  42. data/lib/pdoc/parser/fragment.rb +55 -0
  43. data/lib/pdoc/parser/section_content_nodes.rb +19 -0
  44. data/lib/pdoc/parser/tags_nodes.rb +14 -0
  45. data/lib/pdoc/parser/treetop_files/argument_description.treetop +31 -0
  46. data/lib/pdoc/parser/treetop_files/basic.treetop +41 -0
  47. data/lib/pdoc/parser/treetop_files/description.treetop +7 -0
  48. data/lib/pdoc/parser/treetop_files/documentation.treetop +75 -0
  49. data/lib/pdoc/parser/treetop_files/ebnf_arguments.treetop +33 -0
  50. data/lib/pdoc/parser/treetop_files/ebnf_expression.treetop +70 -0
  51. data/lib/pdoc/parser/treetop_files/ebnf_javascript.treetop +54 -0
  52. data/lib/pdoc/parser/treetop_files/events.treetop +17 -0
  53. data/lib/pdoc/parser/treetop_files/section_content.treetop +8 -0
  54. data/lib/pdoc/parser/treetop_files/tags.treetop +31 -0
  55. data/lib/pdoc/runner.rb +110 -0
  56. data/lib/pdoc/treemaker.rb +94 -0
  57. data/pdoc.gemspec +31 -0
  58. data/templates/html/assets/images/pdoc/alias.png +0 -0
  59. data/templates/html/assets/images/pdoc/class.png +0 -0
  60. data/templates/html/assets/images/pdoc/class_deprecated.png +0 -0
  61. data/templates/html/assets/images/pdoc/class_method.png +0 -0
  62. data/templates/html/assets/images/pdoc/class_property.png +0 -0
  63. data/templates/html/assets/images/pdoc/constant.png +0 -0
  64. data/templates/html/assets/images/pdoc/constructor.png +0 -0
  65. data/templates/html/assets/images/pdoc/deprecated.png +0 -0
  66. data/templates/html/assets/images/pdoc/description.png +0 -0
  67. data/templates/html/assets/images/pdoc/information.png +0 -0
  68. data/templates/html/assets/images/pdoc/instance_method.png +0 -0
  69. data/templates/html/assets/images/pdoc/instance_property.png +0 -0
  70. data/templates/html/assets/images/pdoc/method.png +0 -0
  71. data/templates/html/assets/images/pdoc/method_deprecated.png +0 -0
  72. data/templates/html/assets/images/pdoc/mixin.png +0 -0
  73. data/templates/html/assets/images/pdoc/namespace.png +0 -0
  74. data/templates/html/assets/images/pdoc/property.png +0 -0
  75. data/templates/html/assets/images/pdoc/related_to.png +0 -0
  76. data/templates/html/assets/images/pdoc/search-background.png +0 -0
  77. data/templates/html/assets/images/pdoc/section-background.png +0 -0
  78. data/templates/html/assets/images/pdoc/section.png +0 -0
  79. data/templates/html/assets/images/pdoc/selected-section-background.png +0 -0
  80. data/templates/html/assets/images/pdoc/subclass.png +0 -0
  81. data/templates/html/assets/images/pdoc/superclass.png +0 -0
  82. data/templates/html/assets/images/pdoc/utility.png +0 -0
  83. data/templates/html/assets/javascripts/pdoc/application.js +478 -0
  84. data/templates/html/assets/javascripts/pdoc/prototype.js +4874 -0
  85. data/templates/html/assets/javascripts/pdoc/tabs.js +506 -0
  86. data/templates/html/assets/stylesheets/pdoc/api.css +677 -0
  87. data/templates/html/assets/stylesheets/pdoc/pygments.css +62 -0
  88. data/templates/html/helpers.rb +35 -0
  89. data/templates/html/index.erb +18 -0
  90. data/templates/html/item_index.js.erb +6 -0
  91. data/templates/html/layout.erb +67 -0
  92. data/templates/html/leaf.erb +22 -0
  93. data/templates/html/node.erb +30 -0
  94. data/templates/html/partials/class_relationships.erb +19 -0
  95. data/templates/html/partials/classes.erb +7 -0
  96. data/templates/html/partials/constructor.erb +5 -0
  97. data/templates/html/partials/description.erb +5 -0
  98. data/templates/html/partials/link_list.erb +1 -0
  99. data/templates/html/partials/method_signatures.erb +14 -0
  100. data/templates/html/partials/methodized_note.erb +9 -0
  101. data/templates/html/partials/mixins.erb +7 -0
  102. data/templates/html/partials/namespaces.erb +7 -0
  103. data/templates/html/partials/related_utilities.erb +5 -0
  104. data/templates/html/partials/relationships.erb +11 -0
  105. data/templates/html/partials/short_description_list.erb +7 -0
  106. data/templates/html/partials/title.erb +22 -0
  107. data/templates/html/section.erb +18 -0
  108. data/test/unit/parser/argument_description_test.rb +40 -0
  109. data/test/unit/parser/basic_test.rb +55 -0
  110. data/test/unit/parser/description_test.rb +34 -0
  111. data/test/unit/parser/documentation_test.rb +520 -0
  112. data/test/unit/parser/ebnf_arguments_test.rb +81 -0
  113. data/test/unit/parser/ebnf_expression_test.rb +382 -0
  114. data/test/unit/parser/ebnf_javascript_test.rb +37 -0
  115. data/test/unit/parser/events_test.rb +27 -0
  116. data/test/unit/parser/section_content_test.rb +44 -0
  117. data/test/unit/parser/tags_test.rb +39 -0
  118. data/test/unit/parser/test_fragment.rb +80 -0
  119. data/test/unit/parser_test_helper.rb +62 -0
  120. data/test/unit/runner/basic_test.rb +14 -0
  121. data/test/unit/templates/html_helpers_test.rb +25 -0
  122. metadata +222 -0
@@ -0,0 +1,62 @@
1
+ .highlight .hll { background-color: #ffffcc }
2
+ .highlight { background: #f8f8f8; }
3
+ .highlight .c { color: #408080; font-style: italic } /* Comment */
4
+ .highlight .err { border: 1px solid #FF0000 } /* Error */
5
+ .highlight .k { color: #008000; font-weight: bold } /* Keyword */
6
+ .highlight .o { color: #666666 } /* Operator */
7
+ .highlight .cm { color: #408080; font-style: italic } /* Comment.Multiline */
8
+ .highlight .cp { color: #BC7A00 } /* Comment.Preproc */
9
+ .highlight .c1 { color: #408080; font-style: italic } /* Comment.Single */
10
+ .highlight .cs { color: #408080; font-style: italic } /* Comment.Special */
11
+ .highlight .gd { color: #A00000 } /* Generic.Deleted */
12
+ .highlight .ge { font-style: italic } /* Generic.Emph */
13
+ .highlight .gr { color: #FF0000 } /* Generic.Error */
14
+ .highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */
15
+ .highlight .gi { color: #00A000 } /* Generic.Inserted */
16
+ .highlight .go { color: #808080 } /* Generic.Output */
17
+ .highlight .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
18
+ .highlight .gs { font-weight: bold } /* Generic.Strong */
19
+ .highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
20
+ .highlight .gt { color: #0040D0 } /* Generic.Traceback */
21
+ .highlight .kc { color: #008000; font-weight: bold } /* Keyword.Constant */
22
+ .highlight .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */
23
+ .highlight .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */
24
+ .highlight .kp { color: #008000 } /* Keyword.Pseudo */
25
+ .highlight .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */
26
+ .highlight .kt { color: #B00040 } /* Keyword.Type */
27
+ .highlight .m { color: #666666 } /* Literal.Number */
28
+ .highlight .s { color: #BA2121 } /* Literal.String */
29
+ .highlight .na { color: #7D9029 } /* Name.Attribute */
30
+ .highlight .nb { color: #008000 } /* Name.Builtin */
31
+ .highlight .nc { color: #0000FF; font-weight: bold } /* Name.Class */
32
+ .highlight .no { color: #880000 } /* Name.Constant */
33
+ .highlight .nd { color: #AA22FF } /* Name.Decorator */
34
+ .highlight .ni { color: #999999; font-weight: bold } /* Name.Entity */
35
+ .highlight .ne { color: #D2413A; font-weight: bold } /* Name.Exception */
36
+ .highlight .nf { color: #0000FF } /* Name.Function */
37
+ .highlight .nl { color: #A0A000 } /* Name.Label */
38
+ .highlight .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
39
+ .highlight .nt { color: #008000; font-weight: bold } /* Name.Tag */
40
+ .highlight .nv { color: #19177C } /* Name.Variable */
41
+ .highlight .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
42
+ .highlight .w { color: #bbbbbb } /* Text.Whitespace */
43
+ .highlight .mf { color: #666666 } /* Literal.Number.Float */
44
+ .highlight .mh { color: #666666 } /* Literal.Number.Hex */
45
+ .highlight .mi { color: #666666 } /* Literal.Number.Integer */
46
+ .highlight .mo { color: #666666 } /* Literal.Number.Oct */
47
+ .highlight .sb { color: #BA2121 } /* Literal.String.Backtick */
48
+ .highlight .sc { color: #BA2121 } /* Literal.String.Char */
49
+ .highlight .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */
50
+ .highlight .s2 { color: #BA2121 } /* Literal.String.Double */
51
+ .highlight .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */
52
+ .highlight .sh { color: #BA2121 } /* Literal.String.Heredoc */
53
+ .highlight .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */
54
+ .highlight .sx { color: #008000 } /* Literal.String.Other */
55
+ .highlight .sr { color: #BB6688 } /* Literal.String.Regex */
56
+ .highlight .s1 { color: #BA2121 } /* Literal.String.Single */
57
+ .highlight .ss { color: #19177C } /* Literal.String.Symbol */
58
+ .highlight .bp { color: #008000 } /* Name.Builtin.Pseudo */
59
+ .highlight .vc { color: #19177C } /* Name.Variable.Class */
60
+ .highlight .vg { color: #19177C } /* Name.Variable.Global */
61
+ .highlight .vi { color: #19177C } /* Name.Variable.Instance */
62
+ .highlight .il { color: #666666 } /* Literal.Number.Integer.Long */
@@ -0,0 +1,35 @@
1
+ module PDoc
2
+ module Generators
3
+ module Html
4
+ module Helpers
5
+ module BaseHelper
6
+ def layout_section(title, classname = title.downcase)
7
+ <<-EOS
8
+ <div class="section section-#{classname}">
9
+ <div class="section-title">
10
+ <h3>#{title}</h3>
11
+ </div> <!-- .section-title -->
12
+ <div class="section-content">
13
+ EOS
14
+ end
15
+
16
+ def end_layout_section
17
+ <<-EOS
18
+ </div> <!-- .section-content -->
19
+ </div> <!-- .section -->
20
+ EOS
21
+ end
22
+ end
23
+
24
+ module LinkHelper
25
+ end
26
+
27
+ module CodeHelper
28
+ end
29
+
30
+ module MenuHelper
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,18 @@
1
+ <% @title = "Home" %>
2
+
3
+ <div class="page-introduction">
4
+ <%= @index_page_content %>
5
+ </div> <!-- .section -->
6
+
7
+ <%= layout_section('Sections') %>
8
+ <ul class="section-list">
9
+ <% @root.sections.each do |section| %>
10
+ <li>
11
+ <h4>
12
+ <a href="<%= path_to(section) %>"><%= section.name %></a>
13
+ </h4>
14
+ <p><%= htmlize(section.short_description) %></p>
15
+ </li>
16
+ <% end %>
17
+ </ul>
18
+ <%= end_layout_section %>
@@ -0,0 +1,6 @@
1
+ if (!window.PDoc) window.PDoc = {};
2
+ PDoc.elements = {
3
+ <%= @root.registry.map do |k, v|
4
+ "'#{k}': { 'name': '#{k}', 'type': '#{v.type}', 'path': '#{path_to(v)}' }"
5
+ end.join(",\n") %>
6
+ };
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title><%= @short_name %> v<%= @version %> API documentation | <%= @title %></title>
7
+ <meta name="generator" content="PDoc" />
8
+
9
+ <%= javascript_include_tag "pdoc/prototype" %>
10
+ <%= javascript_include_tag "pdoc/application", "pdoc/tabs" %>
11
+ <%= javascript_include_tag "pdoc/item_index" %>
12
+
13
+ <%= stylesheet_link_tag "pdoc/api", "pdoc/pygments" %>
14
+
15
+ <script type="text/javascript">
16
+ PDoc.pathPrefix = '<%= path_prefix %>';
17
+ </script>
18
+ </head>
19
+ <body>
20
+
21
+ <div id="sidebar">
22
+ <ul id="sidebar_tabs" class="sidebar-tabs">
23
+ <li>
24
+ <a href="#menu_pane">Menu</a>
25
+ </li>
26
+ <li>
27
+ <a href="#search_pane">Search</a>
28
+ </li>
29
+ </ul> <!-- .sidebar-tabs -->
30
+
31
+ <form class="search-ribbon">
32
+ <label>
33
+ <span class="hidden">Search</span>
34
+ <input type="text" id="search" size="20" title="Search" />
35
+ </label>
36
+ </form>
37
+
38
+ <div class="sidebar-pane scrollable" id="menu_pane">
39
+ <%= menu(@root) %><!--- #api_menu =-->
40
+ </div> <!-- .sidebar-pane -->
41
+ <div class="sidebar-pane" id="search_pane">
42
+ <ul id="search_results" class="search-results menu-items scrollable"></ul>
43
+ </div> <!-- .sidebar-pane -->
44
+ </div> <!-- #sidebar -->
45
+
46
+ <div id="page">
47
+ <%= @home ? @index_header : @header %>
48
+
49
+ <div id="main" class="page-content">
50
+ <%= @content_for_layout %>
51
+ </div> <!-- #main -->
52
+
53
+ <div id="footer">
54
+ <p><a href="<%= @home_url %>"><%= @name %></a> v<%= @version %> API documentation.</p>
55
+ <p>
56
+ <% if @timestamp %>
57
+ Last updated on <%= @timestamp.strftime('%B %d, %Y at %H:%M UTC') %>.
58
+ <% end %>
59
+ Generated by <a href="http://pdoc.org">PDoc</a>.
60
+ Uses <a href="http://famfamfam.com/lab/icons/silk/" title="famfamfam.com: Silk Icons">Silk Icons</a> and portions of <a href="http://github.com/280north/aristo/tree/master" title="280north's aristo at master - GitHub">Aristo</a>.
61
+ </p>
62
+ <%= @footer %>
63
+ </div> <!-- #footer -->
64
+
65
+ </div> <!-- #page -->
66
+ </body>
67
+ </html>
@@ -0,0 +1,22 @@
1
+ <% @title = "#{@doc_instance.full_name} #{@doc_instance.type}" %>
2
+
3
+ <%= include "partials/title", :object => @doc_instance %>
4
+
5
+ <div class="section">
6
+ <div class="section-title">
7
+ </div> <!-- .section-title -->
8
+ <div class="section-content">
9
+ <div class="method-description">
10
+ <% if @doc_instance.respond_to?(:signatures) %>
11
+ <%= include "partials/method_signatures", :object => @doc_instance %>
12
+ <% else %>
13
+ <pre class="syntax"><code class="ebnf"><%= @doc_instance.signature.name %> &rarr; <%= auto_link_types(@doc_instance.signature.return_value, :name => :long).join(' | ') %></code></pre>
14
+ <% end %>
15
+
16
+ <%= htmlize(@doc_instance.description) %>
17
+
18
+ <%= include "partials/relationships", :object => @doc_instance %>
19
+ <%= include "partials/methodized_note", :object => @doc_instance %>
20
+ </div>
21
+ </div> <!-- .section-content -->
22
+ </div> <!-- .section -->
@@ -0,0 +1,30 @@
1
+ <% d = @doc_instance %>
2
+
3
+ <%= include "partials/title", :object => @doc_instance %>
4
+ <%= include "partials/description", :object => @doc_instance %>
5
+
6
+ <%= include "partials/namespaces", :object => @doc_instance %>
7
+ <%= include "partials/classes", :object => @doc_instance %>
8
+
9
+ <%= include "partials/class_relationships", :object => @doc_instance %>
10
+ <%= include "partials/related_utilities", :object => @doc_instance %>
11
+ <%= include "partials/constructor", :object => @doc_instance %>
12
+
13
+ <%
14
+ types = [
15
+ [:class_methods, 'Class methods'],
16
+ [:class_properties, 'Class properties'],
17
+ [:instance_methods, 'Instance methods'],
18
+ [:instance_properties, 'Instance properties'],
19
+ [:constants, 'Constants']
20
+ ].each do |a| %>
21
+ <% method, title = a %>
22
+ <% methods = @doc_instance.send(method) %>
23
+ <% unless methods.empty? %>
24
+ <%= layout_section(title, method) %>
25
+ <ul class="method-list">
26
+ <%= include "partials/link_list", :collection => methods.sort! %>
27
+ </ul>
28
+ <%= end_layout_section %>
29
+ <% end %>
30
+ <% end %>
@@ -0,0 +1,19 @@
1
+ <% if object.is_a?(Models::Class) %>
2
+ <% if object.superclass %>
3
+ <%= layout_section('Superclass') %>
4
+ <p><%= auto_link_code(object.superclass, :name => :long) %></p>
5
+ <%= end_layout_section %>
6
+ <% end %>
7
+
8
+ <% if object.subclasses? %>
9
+ <%= layout_section('Subclasses') %>
10
+ <p><%= object.subclasses.sort!.map { |s| auto_link_code(s, :name => :long) }.join(', ') %></p>
11
+ <%= end_layout_section %>
12
+ <% end %>
13
+ <% end %>
14
+
15
+ <% if object.included_mixins? %>
16
+ <%= layout_section('Includes', :mixins) %>
17
+ <p><%= object.included_mixins.sort!.map { |m| auto_link_code(m, :name => :long) }.join(', ') %></p>
18
+ <%= end_layout_section %>
19
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <% if object.classes? %>
2
+ <%= layout_section('Classes') %>
3
+ <ul class="method-details-list">
4
+ <%= include "partials/short_description_list", :collection => object.classes.sort! %>
5
+ </ul>
6
+ <%= end_layout_section %>
7
+ <% end %>
@@ -0,0 +1,5 @@
1
+ <% if object.respond_to?(:constructor) && object.constructor %>
2
+ <%= layout_section('Constructor') %>
3
+ <p><%= auto_link_code(object.constructor, :name => :long) %></p>
4
+ <%= end_layout_section %>
5
+ <% end %>
@@ -0,0 +1,5 @@
1
+ <% if object.description && !object.description.empty? %>
2
+ <%= layout_section('Description') %>
3
+ <%= htmlize(object.description) %>
4
+ <%= end_layout_section %>
5
+ <% end %>
@@ -0,0 +1 @@
1
+ <li><%= auto_link_code(object, :name => :short, :class => class_names_for(object)) %></li>
@@ -0,0 +1,14 @@
1
+ <pre class="syntax"><code class="ebnf"><%= method_synopsis(object).join('<br />') %></code></pre>
2
+ <% if object.respond_to?(:arguments) && object.arguments? %>
3
+ <ul class="argument-list">
4
+ <% object.arguments.each do |arg| %>
5
+ <li>
6
+ <code class="argument-name"><%= arg.name %></code>
7
+ <% unless arg.types.empty? %>
8
+ <span class="argument-types">(<%= auto_link_types(arg.types).map { |t| "<code>#{t}</code>"}.join(' | ') %>)</span>
9
+ <% end %>
10
+ <%= ' &ndash; ' + inline_htmlize(arg.description) unless arg.description.empty? %>
11
+ </li>
12
+ <% end %>
13
+ </ul> <!-- .argument-list -->
14
+ <% end %>
@@ -0,0 +1,9 @@
1
+ <% if object.methodized? %>
2
+ <p class="note">
3
+ <% if object.respond_to?(:methodized_self) %>
4
+ This method can be called <em>either</em> as an <a href="<%= path_to(object.methodized_self) %>">instance method</a> <em>or</em> as a generic method.
5
+ <% else %>
6
+ This method can be called <em>either</em> as an instance method <em>or</em> as a <a href="<%= path_to(object.functionalized_self) %>">generic method</a>.
7
+ <% end %>
8
+ If calling as a generic, pass the instance in as the first argument.<p>
9
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <% if object.mixins? %>
2
+ <%= layout_section('Mixins') %>
3
+ <ul class="method-details-list">
4
+ <%= include "partials/short_description_list", :collection => object.mixins.sort! %>
5
+ </ul>
6
+ <%= end_layout_section %>
7
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <% if object.namespaces? %>
2
+ <%= layout_section('Namespaces') %>
3
+ <ul class="method-details-list">
4
+ <%= include "partials/short_description_list", :collection => object.namespaces %>
5
+ </ul>
6
+ <%= end_layout_section %>
7
+ <% end %>
@@ -0,0 +1,5 @@
1
+ <% if object.respond_to?(:utilities) && object.utilities? %>
2
+ <%= layout_section('Related utilities', :utilities) %>
3
+ <p><%= object.utilities.map { |u| auto_link_code(u, :name => :long) }.join(', ') %></p>
4
+ <%= end_layout_section %>
5
+ <% end %>
@@ -0,0 +1,11 @@
1
+ <% if object.aliases? %>
2
+ <p class="alias aliases">Aliased as: <%= object.aliases.map.map { |a| auto_link_code(a, :name => :long) }.join(', ') %></p>
3
+ <% end %>
4
+
5
+ <% if object.alias? %>
6
+ <p class="alias alias-of">Alias of: <%= auto_link_code(object.alias, :name => :long) %></p>
7
+ <% end %>
8
+
9
+ <% if object.respond_to?(:related_to) && related_to = object.related_to %>
10
+ <p class="related-to">Related to: <%= auto_link_code(related_to, :name => :long) %></p>
11
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <li class="method-description">
2
+ <h4><a href="<%= path_to(object) %>"><%= object.full_name %></a></h4>
3
+
4
+ <% unless object.short_description.nil? %>
5
+ <p><%= htmlize(object.short_description) %></p>
6
+ <% end %>
7
+ </li>
@@ -0,0 +1,22 @@
1
+ <% @title = object.full_name %>
2
+
3
+ <% if object.deprecated? %>
4
+ <div id="deprecated"><%= img_tag('pdoc/deprecated.png', :alt => "Deprecated", :width => 150, :height => 150) %></div>
5
+ <% end %>
6
+
7
+ <ul class="breadcrumbs clearfix">
8
+ <li><a href="<%= path_prefix %>">Home</a></li>
9
+ <% breadcrumb(object).each do |crumb| %>
10
+ <li>&rarr; <%= crumb %></li>
11
+ <% end %>
12
+ </ul>
13
+
14
+ <% if object.respond_to?(:src_code_href) && object.src_code_href %>
15
+ <p id="src_code_href"><a href="<%= object.src_code_href %>">src code</a></p>
16
+ <% end %>
17
+
18
+ <h2 class="page-title">
19
+ <span class="type"><%= object.type %></span> <%= object.full_name %>
20
+ </h2>
21
+
22
+
@@ -0,0 +1,18 @@
1
+ <% @title = "#{@doc_instance.full_name} " %>
2
+
3
+ <%= include "partials/title", :object => @doc_instance %>
4
+ <%= include "partials/description", :object => @doc_instance %>
5
+
6
+ <% if @doc_instance.respond_to?(:utilities) && @doc_instance.utilities? %>
7
+ <%= layout_section('Utilities') %>
8
+ <ul class="method-list">
9
+ <% @doc_instance.utilities.each do |utility| %>
10
+ <li><%= auto_link_code(utility) %></li>
11
+ <% end %>
12
+ </ul>
13
+ <%= end_layout_section %>
14
+ <% end %>
15
+
16
+ <%= include "partials/namespaces", :object => @doc_instance %>
17
+ <%= include "partials/classes", :object => @doc_instance %>
18
+ <%= include "partials/mixins", :object => @doc_instance %>
@@ -0,0 +1,40 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), "..", "parser_test_helper"))
2
+
3
+ class ArgumentDescriptionTest < Test::Unit::TestCase
4
+ include PDocTestHelper
5
+ include Basic
6
+ include ArgumentDescription
7
+
8
+ def setup
9
+ @parser = ArgumentDescriptionParser.new
10
+ end
11
+
12
+ def test_argument_with_no_type
13
+ fixture = parse("\n * - foo: a definition#{blank_line}")
14
+ assert_equal "foo", fixture.name
15
+ assert_equal [], fixture.types
16
+ assert_equal "a definition", fixture.description
17
+
18
+ fixture = parse("\n * - @foo: a definition#{blank_line}")
19
+ assert_equal "foo", fixture.name
20
+ assert_equal [], fixture.types
21
+ assert_equal "a definition", fixture.description
22
+
23
+ fixture = parse("\n * - foo: a rather long definition \n* that extends to a second line. #{blank_line}")
24
+ assert_equal "a rather long definition that extends to a second line.", fixture.description
25
+ end
26
+
27
+ def test_argument_with_single_type
28
+ fixture = parse("\n * - foo (String): a definition#{blank_line}")
29
+ assert_equal "foo", fixture.name
30
+ assert_equal %w[String], fixture.types
31
+ end
32
+
33
+ def test_argument_with_multiple_types
34
+ fixture = parse("\n * - foo (String | Number): a definition#{blank_line}")
35
+ assert_equal "foo", fixture.name
36
+ assert_equal %w[String Number], fixture.types
37
+ fixture = parse("\n * - foo (String | Number | Object): a definition#{blank_line}")
38
+ assert_equal %w[String Number Object], fixture.types
39
+ end
40
+ end