docrb-html 0.2.5 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/.editorconfig +1 -1
  3. data/.rubocop.yml +32 -15
  4. data/Gemfile +11 -1
  5. data/Gemfile.lock +52 -2
  6. data/assets/breadcrumb.scss +0 -1
  7. data/assets/class_header.scss +1 -0
  8. data/assets/constant_display.scss +16 -0
  9. data/assets/doc_box.scss +34 -4
  10. data/assets/documentation_block.scss +29 -1
  11. data/assets/field_block.scss +46 -0
  12. data/assets/js/filtering.js +3 -3
  13. data/assets/links.scss +0 -2
  14. data/assets/method_argument.scss +2 -8
  15. data/assets/method_display.scss +4 -0
  16. data/assets/method_list.scss +40 -0
  17. data/assets/reference.scss +1 -1
  18. data/assets/style.scss +3 -0
  19. data/assets/svg.scss +37 -0
  20. data/assets/symbol.scss +1 -1
  21. data/assets/text_block.scss +9 -9
  22. data/bin/smoke +5 -0
  23. data/{renderer.gemspec → docrb-html.gemspec} +2 -0
  24. data/exe/docrb-html +1 -1
  25. data/lib/docrb-html.rb +165 -0
  26. data/lib/renderer/component/attribute.rb +9 -0
  27. data/lib/renderer/component/attribute_display.rb +17 -0
  28. data/lib/renderer/component/constant_display.rb +9 -0
  29. data/lib/renderer/component/doc_box.rb +26 -18
  30. data/lib/renderer/component/documentation_comment.rb +9 -0
  31. data/lib/renderer/component/field_block.rb +9 -0
  32. data/lib/renderer/component/method_argument.rb +19 -63
  33. data/lib/renderer/component/method_display.rb +1 -1
  34. data/lib/renderer/component/method_list.rb +1 -1
  35. data/lib/renderer/component/reference.rb +23 -12
  36. data/lib/renderer/component/text_block.rb +1 -7
  37. data/lib/renderer/component.rb +4 -4
  38. data/lib/renderer/core_extensions.rb +12 -1
  39. data/lib/renderer/entities/attribute.rb +17 -0
  40. data/lib/renderer/entities/attribute_definition.rb +23 -0
  41. data/lib/renderer/entities/base.rb +58 -0
  42. data/lib/renderer/entities/class.rb +17 -0
  43. data/lib/renderer/entities/container.rb +52 -0
  44. data/lib/renderer/entities/method.rb +18 -0
  45. data/lib/renderer/entities/method_argument.rb +27 -0
  46. data/lib/renderer/entities/method_definition.rb +25 -0
  47. data/lib/renderer/entities/module.rb +29 -0
  48. data/lib/renderer/entities/reference.rb +103 -0
  49. data/lib/renderer/entities/source_definition.rb +17 -0
  50. data/lib/renderer/entities.rb +30 -0
  51. data/lib/renderer/helpers.rb +77 -19
  52. data/lib/renderer/markdown.rb +62 -0
  53. data/lib/renderer/metadata.rb +10 -26
  54. data/lib/renderer/template.rb +4 -6
  55. data/lib/renderer/version.rb +1 -1
  56. data/script/makecomponent +1 -1
  57. data/templates/attribute.erb +10 -0
  58. data/templates/attribute_display.erb +22 -0
  59. data/templates/breadcrumb.erb +9 -9
  60. data/templates/class_header.erb +6 -7
  61. data/templates/component_list.erb +14 -8
  62. data/templates/constant_display.erb +13 -0
  63. data/templates/doc_box.erb +40 -31
  64. data/templates/documentation_block.erb +2 -11
  65. data/templates/documentation_comment.erb +23 -0
  66. data/templates/field_block.erb +15 -0
  67. data/templates/method_argument.erb +4 -4
  68. data/templates/method_display.erb +14 -21
  69. data/templates/method_list.erb +52 -8
  70. data/templates/reference.erb +10 -7
  71. data/templates/text_block.erb +13 -14
  72. metadata +60 -8
  73. data/lib/renderer/defs/specialized_object.rb +0 -172
  74. data/lib/renderer/defs/specialized_projection.rb +0 -31
  75. data/lib/renderer/defs.rb +0 -180
  76. data/lib/renderer.rb +0 -131
@@ -3,8 +3,8 @@
3
3
  <a href="/">
4
4
  <%= svg("home") %>
5
5
  <span class="padded">
6
- <%= project_name %>
7
- </span>
6
+ <%= project_name %>
7
+ </span>
8
8
  </a>
9
9
  </div>
10
10
  <% items.each.with_index do |i, idx| %>
@@ -12,16 +12,16 @@
12
12
  <div class="link">
13
13
  <% if i[:parents].empty? && idx == 0 %>
14
14
  <a href="components.html">
15
- <span class="padded">
16
- <%= i[:name] %>
17
- </span>
18
- </a>
19
- <% else %>
20
- <a href="<%= (i[:parents] + [idx == 0 ? nil : i[:name]]).flatten.compact.join("/") %>.html">
21
15
  <span class="padded">
22
16
  <%= i[:name] %>
23
17
  </span>
24
- </a>
18
+ </a>
19
+ <% else %>
20
+ <a href="<%= (i[:parents] + [idx == 0 ? nil : i[:name]]).flatten.compact.join("/") %>.html">
21
+ <span class="padded">
22
+ <%= i[:name] %>
23
+ </span>
24
+ </a>
25
25
  <% end %>
26
26
  </div>
27
27
  <% end %>
@@ -5,20 +5,19 @@
5
5
  <% def_link = Proc.new do |item, extra = nil| %>
6
6
  <span class="def-link">
7
7
  <%= extra %>
8
- <a href="<%= item[:href] %>"
9
- class="dashed"><%= item[:name] %>
8
+ <a href="<%= item[:git_url] %>" class="dashed"><%= item[:filename] %>
10
9
  </a>
11
10
  </span>
12
11
  <% end %>
13
12
  <% if definitions.length > 0 %>
14
13
  <div class="defs">
15
14
  Defined in
16
- <% if def_collection.length == 1 %>
17
- <% def_link.call def_collection.first %>
15
+ <% if definitions.length == 1 %>
16
+ <% def_link.call definitions.first %>
18
17
  <% else %>
19
- <% last_item = def_collection.pop %>
20
- <% def_collection.each do |item| %>
21
- <% def_link item %>
18
+ <% last_item = definitions.pop %>
19
+ <% definitions.each do |item| %>
20
+ <% def_link.call item %>,
22
21
  <% end %>
23
22
  <% def_link.call last_item, " and " %>
24
23
  <% end %>
@@ -1,18 +1,24 @@
1
1
  <% div("component-list-base", id:, class_name: class_name) do %>
2
2
  <% list.each do |item| %>
3
3
  <%
4
- base_path = (parents + ["#{item[:name]}.html"]).join("/")
5
- new_parents = parents + [item[:name]]
4
+ obj = item[:object]
5
+ base_path = (parents + ["#{obj.name}.html"]).join("/")
6
+ new_parents = parents + [obj.name]
6
7
  %>
7
8
  <div class="level" style="padding-left: <%= item[:level] * 20 %>px">
8
- <%= type_definition(type: item[:type], href: "#{base_path}", name: item[:name]) %>
9
+ <%= type_definition(type: obj.kind, href: "#{base_path}", name: obj.name) %>
9
10
  <div class="level" style="padding-left: <%= (item[:level] + 1) * 20 %>px">
10
- <% item[:attributes]&.each do |att| %>
11
- <%= method_display(type: att[:type], name: att[:name], visibility: att[:visibility], decoration: att[:decoration], href: "#{base_path}#attr-#{att[:name]}") %>
12
- <% end %>
13
- <% item[:defs]&.each do |met| %>
14
- <%= method_display(href: "#{base_path}##{met[:short_type]}-#{met[:name]}", **met) %>
11
+ <%= obj.constants.map { constant_display(item: _1) }.join("") %>
12
+ <% obj.kind == :class && obj.instance_attributes.each do |i| %>
13
+ <%= attribute_display(item: i, kind: :instance) %>
15
14
  <% end %>
15
+ <% obj.class_attributes
16
+ .map { attribute_display(item: _1, kind: :class) }
17
+ .join("") %>
18
+ <%= (obj.all_class_methods + obj.all_instance_methods)
19
+ .map { method_display(item: _1, parent: obj) }
20
+ .join("")
21
+ %>
16
22
  </div>
17
23
  <%= component_list(list: item[:modules], parents: new_parents, class_name: "no-margin") %>
18
24
  <%= component_list(list: item[:classes], parents: new_parents, class_name: "no-margin") %>
@@ -0,0 +1,13 @@
1
+ <% div("constant-display-base", id:) do %>
2
+ <%= typedef(name: "Constant") %>
3
+ <% base = capture do %>
4
+ <div class="container">
5
+ <div class="constant-name"><%= item.name %></div>
6
+ </div>
7
+ <% end %>
8
+ <% if omit_link %>
9
+ <%= base %>
10
+ <% else %>
11
+ <a class="dashed" href="<%= link_for(item) %>"><%= base %></a>
12
+ <% end %>
13
+ <% end %>
@@ -4,13 +4,7 @@
4
4
  <h3 class="heading"><%= name %></h3>
5
5
  <div class="link-column">
6
6
  <% list.each do |item| %>
7
- <div>
8
- <% if item.is_a? String %>
9
- <%= reference(ref: { contents: item }) %>
10
- <% else %>
11
- <%= reference(ref: { ref_type: item.type, ref_path: item.path, contents: item.name }) %>
12
- <% end %>
13
- </div>
7
+ <div><%= reference(object: item) %></div>
14
8
  <% end %>
15
9
  </div>
16
10
  </div>
@@ -19,11 +13,11 @@
19
13
 
20
14
  <% div("doc-box-base", id:) do %>
21
15
  <div class="left">
22
- <%= has_class_docs && documentation_block(doc: item[:doc]) %>
16
+ <%= has_class_docs ? documentation_block(doc: item.doc) : nil %>
23
17
  <% if has_class_details %>
24
18
  <div class="section-container" id="class-details">
25
19
  <div class="horizontal-container">
26
- <% child_structure.call("Inherits", [item.inherits].compact) %>
20
+ <% child_structure.call("Inherits", [item.kind == :class && item.inherits || nil].compact) %>
27
21
  <% child_structure.call("Extends", item.extends) %>
28
22
  <% child_structure.call("Includes", item.includes) %>
29
23
  <% child_structure.call("Child Modules", item.modules) %>
@@ -31,41 +25,56 @@
31
25
  </div>
32
26
  </div>
33
27
  <% end %>
34
- <% if has_attrs %>
35
- <div class="section-container" id="attributes">
36
- <h3 class="heading">Attributes</h3>
37
- <% attrs.each do |att| %>
38
- <div class="attribute-container"
39
- data-origin="<%= att.dig(:origin) %>"
40
- data-type="<%= att[:type].downcase %>"
41
- id="<%= att[:type] %>-<%= att[:name] %>"
42
- >
43
- <% if att[:decoration] %>
44
- <%= svg(att[:decoration], class_name: "decoration", title: att[:decoration] == 'inherited' ? 'Inherited' : 'Override') %>
45
- <% end %>
46
- <span class="name"><%= att[:name] %></span>
47
- <span class="label"><%= att[:visibility] %></span>
48
- <% if att[:doc] %>
49
- <%= markdown(source: att[:doc]) %>
50
- <% else %>
51
- <div class="faded">
52
- (No documentation available)
53
- </div>
28
+
29
+ <% if has_constants %>
30
+ <div class="section-container" id="constants">
31
+ <h3 class="heading">Constants</h3>
32
+ <% constants.each do |const| %>
33
+ <% origin = source_of(const, item) %>
34
+ <div class="constant-container"
35
+ data-origin="<%= origin %>"
36
+ data-type="Constant"
37
+ id="const-<%= const.name %>"
38
+ >
39
+ <% if origin == "inherited" %>
40
+ <%= svg("inheritance", class_name: "decoration", title: 'Inherited') %>
54
41
  <% end %>
42
+ <a class="dashed" href="<%= link_for(const) %>"><span class="name"><%= const.name %></span></a>
43
+ <div class="doc-block">
44
+ <%= documentation_block(doc: const.doc) %>
45
+ </div>
55
46
  </div>
56
47
  <% end %>
57
48
  </div>
58
49
  <% end %>
50
+
51
+ <% if has_class_attributes %>
52
+ <div class="section-container" id="class-attributes">
53
+ <h3 class="heading">Class Attributes</h3>
54
+ <% class_attributes.each do |att| %>
55
+ <%= attribute(item: att, kind: :class, omit_type: true) %>
56
+ <% end %>
57
+ </div>
58
+ <% end %>
59
+
60
+ <% if has_instance_attributes %>
61
+ <div class="section-container" id="instance-attributes">
62
+ <h3 class="heading">Instance Attributes</h3>
63
+ <% instance_attributes.each do |att| %>
64
+ <%= attribute(item: att, kind: :instance, omit_type: true) %>
65
+ <% end %>
66
+ </div>
67
+ <% end %>
59
68
  <% if has_class_methods %>
60
69
  <div class="section-container" id="class-methods">
61
70
  <h3 class="heading">Class Methods</h3>
62
- <%= method_list(list: sdefs) %>
71
+ <%= method_list(list: class_methods, omit_type: true, parent: item) %>
63
72
  </div>
64
73
  <% end %>
65
74
  <% if has_instance_methods %>
66
75
  <div class="section-container" id="instance-methods">
67
76
  <h3 class="heading">Instance Methods</h3>
68
- <%= method_list(list: defs) %>
77
+ <%= method_list(list: instance_methods, omit_type: true, parent: item) %>
69
78
  </div>
70
79
  <% end %>
71
80
  </div>
@@ -2,17 +2,8 @@
2
2
  <% if doc.nil? || doc.empty? %>
3
3
  <div class="faded">(No documentation available)</div>
4
4
  <% else %>
5
- <% items = (doc[:contents].is_a?(Array) ? doc[:contents] : [doc[:contents]]).compact %>
6
-
7
- <% items.map.each do |i| %>
8
- <% if i[:type] == 'text_block' %>
9
- <%= text_block list: i[:contents] %>
10
- <% elsif i[:type] == 'code_example' %>
11
- <%= markdown(source: i[:contents]) %>
12
- <% elsif i[:type] == 'field_block' %>
13
- <% else %>
14
- <span class="text">!Unexpected item <%= i[:type] %></span>
15
- <% end %>
5
+ <% doc[:value].each do |block| %>
6
+ <%= documentation_comment(doc: block) %>
16
7
  <% end %>
17
8
  <% end %>
18
9
  <% end %>
@@ -0,0 +1,23 @@
1
+ <% div("documentation-comment-base", id:) do %>
2
+ <% if doc[:type] == :block %>
3
+ <%= text_block contents: doc[:value] %>
4
+ <% elsif doc[:type] == :code_example %>
5
+ <%= markdown(source: doc[:contents]) %>
6
+ <% elsif doc[:type] == :fields %>
7
+ <%= field_block(fields: doc[:value]) %>
8
+ <% elsif doc[:type] == :neutral_identifier || doc[:type] == :unresolved_identifier %>
9
+ <code><%= doc[:value] %></code>
10
+ <% elsif doc[:type] == :reference %>
11
+ <%= reference(object: i) %>
12
+ <% elsif doc[:type] == :symbol %>
13
+ <%= symbol(name: doc[:value]) %>
14
+ <% elsif doc[:type] == :method_ref %>
15
+ <a class="method-ref dashed" href="<%= link_for(doc[:object]) %>"><%= doc[:value] %></a>
16
+ <!-- <%= doc.to_json %> -->
17
+ <% else %>
18
+ <div class="unknown-object">
19
+ Unknown object <%= doc[:type] %>
20
+ <!-- <%= doc.to_json %> -->
21
+ </div>
22
+ <% end %>
23
+ <% end %>
@@ -0,0 +1,15 @@
1
+ <% div("field-block-base", id:) do %>
2
+ <h3>Arguments</h3>
3
+ <table>
4
+ <tbody>
5
+ <% fields.each do |name, value| %>
6
+ <tr>
7
+ <td class="name"><%= name %></td>
8
+ <td class="value">
9
+ <%= documentation_comment(doc: value) %>
10
+ </td>
11
+ </tr>
12
+ <% end %>
13
+ </tbody>
14
+ </table>
15
+ <% end %>
@@ -9,9 +9,8 @@
9
9
  <span class="continuation <%= computed[:continuation] %>"></span>
10
10
  <% end %>
11
11
 
12
- <% if computed.dig(:value, :kind) == :method_call_argument %>
13
- <% elsif computed.dig(:value, :kind) == :const
14
- last = computed.dig(:value, :value).pop
12
+ <% if computed.dig(:value, :kind) == :const
13
+ last = computed.dig(:value, :value).pop
15
14
  %>
16
15
  <% computed.dig(:value, :value).each do |val| %>
17
16
  <% if val[:kind] == :continuation %>
@@ -22,8 +21,9 @@
22
21
  </span>
23
22
  <% end %>
24
23
  <% end %>
25
- <span class="simple-argument plain"><%= last[:value] %></span>
24
+ <span class="simple-argument plain"><%= last %></span>
26
25
  <% elsif computed.dig(:value, :kind) %>
27
26
  <span class="simple-argument <%= computed[:value][:kind] %>"><%= computed[:value][:value] %></span>
27
+ <% else %>
28
28
  <% end %>
29
29
  <% end %>
@@ -1,28 +1,21 @@
1
1
  <% div("method-display-base", id:) do %>
2
- <%= decoration && !decoration.empty? && svg(decoration, class_name: "decoration", title: decoration == "inherited" ? "Inherited" : "Override") || "" %>
3
- <%= type && typedef(name: type) %>
4
- <% base = capture do %>
2
+ <% if (dec = source_of(item, parent)) %>
3
+ <%= svg(dec.to_s.downcase, class_name: "decoration", title: dec.to_s.capitalize) %>
4
+ <% end %>
5
+ <% unless omit_type %>
6
+ <%= typedef(name: "#{item.type.capitalize} Method") %>
7
+ <% end %>
8
+ <a class="dashed" href="<%= link_for(item) %>">
5
9
  <div class="container">
6
- <div class="method-name"><%= name %></div>
7
- <% if args %>
8
- <div class="argument-container<%= args.empty? ? "" : " not-empty" %>">
9
- <% args.map do |i| %>
10
- <%= method_argument(**i) %>
10
+ <div class="method-name"><%= item.name %></div>
11
+ <% if item.parameters %>
12
+ <div class="argument-container<%= item.parameters.empty? ? "" : " not-empty" %>">
13
+ <% item.parameters.map do |i| %>
14
+ <%= method_argument(arg: i) %>
11
15
  <% end %>
12
16
  </div>
13
17
  <% end %>
14
18
  </div>
15
- <% end %>
16
- <% if href && !href.empty? %>
17
- <a class="dashed" href="<%= href %>">
18
- <%= base %>
19
- </a>
20
- <% else %>
21
- <%= base %>
22
- <% end %>
23
- <% if visibility&.downcase != 'public' %>
24
- <div class="label"><%= visibility %></div>
25
- <% elsif ![nil, 'public'].include? doc&.dig(:doc_visibility_annotation) %>
26
- <div class="label"><%= doc.dig(:doc_visibility_annotation) %></div>
27
- <% end %>
19
+ </a>
20
+ <div class="label"><%= item.doc&.dig(:meta, :visibility_annotation) || item.visibility %></div>
28
21
  <% end %>
@@ -1,23 +1,67 @@
1
1
  <% div("method-list-base", id:) do %>
2
- <% list && list.length > 0 && list.each do |i| %>
2
+ <% !list&.empty? && list.each do |i| %>
3
3
  <div class="method-definition"
4
- id="<%= i[:type] %>-<%= i[:name] %>"
5
- data-visibility="<%= i.dig(:doc, :doc_visibility_annotation) || '' %>"
6
- data-origin="<%= i.dig(:origin) %>">
4
+ id="<%= i.type %>-method-<%= i.name %>"
5
+ data-visibility="<%= i.doc&.dig(:meta, :visibility_annotation) || '' %>"
6
+ data-origin="<%= source_of(i, parent) %>">
7
7
  <div class="method-block">
8
- <%= method_display(**i.merge(type: nil).slice(*Renderer::Component::MethodDisplay.instance_variable_get(:@props))) %>
8
+ <%= method_display(item: i, omit_type:, parent:) %>
9
9
  </div>
10
+ <% if (o = i.override_target) %>
11
+ <div class="override-info-box">
12
+ Overrides
13
+ <%
14
+ override_path = o.full_path(relative_to: parent)
15
+ if override_path.length > 1
16
+ method = override_path.pop
17
+ %>
18
+ <a href="<%= link_for(method) %>" class="dashed">
19
+ <%= override_path.map(&:name).join("::") %><%= method.instance? ? "#" : "::" %><%= method.name %>
20
+ </a>
21
+ <% else %>
22
+ <a href="<%= link_for(override_path.first) %>" class="dashed">
23
+ <%= override_path.first.name %>
24
+ </a>
25
+ <% end %>
26
+ </div>
27
+ <% end %>
28
+ <% if (list = i.overriders) && !list.empty? %>
29
+ <div class="overridden-by-block">
30
+ <details>
31
+ <summary>
32
+ Overridden by
33
+ <span><%= list.first.full_path(relative_to: parent).map(&:name).join("::") %></span><% if list.length > 1 %>, and
34
+ <%= list.length - 1 %> other<%= list.length - 1 == 1 ? "" : "s" %>
35
+ <% end %>
36
+ </summary>
37
+ <ul>
38
+ <%
39
+ list.each do |override|
40
+ source = i.instance? ? override.instance_methods : override.class_methods
41
+ target = source.named!(i.name)
42
+ target_path = target.full_path(relative_to: parent).tap(&:pop).map(&:name).join("::")
43
+ %>
44
+ <li><a href="<%= link_for(target) %>" class="dashed">
45
+ <span><%= target_path %><%= i.instance? ? "#" : "::" %><%= i.name %></span>
46
+ </a></li>
47
+ <% end %>
48
+ </ul>
49
+ </details>
50
+ </div>
51
+ <% end %>
10
52
  <div class="doc-block">
11
- <%= documentation_block(doc: i[:doc]) %>
53
+ <%= documentation_block(doc: i.doc) %>
12
54
  </div>
13
55
  <details class="source-block">
14
56
  <summary>
15
57
  <span class="expanded">Hide Source</span>
16
58
  <span class="collapsed">Show Source</span>
17
59
  </summary>
18
- <%= markdown(source: i[:defined_by][:markdown_source]) %>
60
+ <%= markdown(source: Renderer::Markdown.render_source(i.location.source)) %>
19
61
  <div class="from">
20
- Defined in <a href="<%= git_url(i[:defined_by]) %>" class="dotted"><%= clean_file_path(i[:defined_by]) %>, <%= line_range(i[:defined_by]) %></a>
62
+ Defined in
63
+ <a href="<%= git_url(i.location) %>" class="dotted"><%= clean_file_path(i.location) %>
64
+ , <%= line_range(i.location) %></a>
21
65
  </div>
22
66
  </details>
23
67
  </div>
@@ -1,14 +1,17 @@
1
1
  <% div("reference-base", id:) do %>
2
2
  <% if unresolved %>
3
- <span class="unresolved" title="Docrb could not resolve this reference. It may be from an external library or dynamically-generated method.">
4
- <%= svg('questionmark') %>
5
- <span><%= ref[:contents] %></span>
3
+ <span><%= value || path.last %></span>
4
+ <% elsif ref_type == :pure %>
5
+ <a href="<%= link_for(object) %>">
6
+ <span class="resolved <%= ref_type %>">
7
+ <span><%= value %></span>
6
8
  </span>
9
+ </a>
7
10
  <% else %>
8
- <a href="<%= path.join('/') %>">
9
- <span class="resolved <%= ref[:ref_type] %>">
10
- <span><%= ref[:contents] %></span>
11
+ <a href="<%= path.join('/') %>.html">
12
+ <span class="resolved <%= ref_type %>">
13
+ <span><%= value || path.last %></span>
11
14
  </span>
12
- </a>
15
+ </a>
13
16
  <% end %>
14
17
  <% end %>
@@ -1,16 +1,15 @@
1
- <% div("text-block-base", id:) do %>
2
- <% list.each do |i| %>
3
- <% if i[:type] == 'span' %>
4
- <div class="html inline"><%= i[:contents] %></div>
5
- <% elsif i[:type] == 'ref' %>
6
- <%= reference(ref: i) %>
7
- <% elsif i[:type] == 'html' %>
8
- <div class="html"><%= i[:contents] %></div>
9
- <% elsif i[:type] == 'sym_ref' %>
10
- <%= symbol(name: i[:contents]) %>
11
- <% else %>
12
- Unknown textblock item <%= i[:kind] %><br/>
13
- <%= i.to_json %>
14
- <% end %>
1
+ <% div("text-block-base#{inline ? " inline" : ""}", id:) do %>
2
+ <% if contents.is_a? String %>
3
+ <div class="html"><%= Renderer::Markdown.inline(contents) %></div>
4
+ <% else %>
5
+ <div class="html">
6
+ <% contents.each do |block| %>
7
+ <% if block[:type] == :span %>
8
+ <span><%= Renderer::Markdown.inline(block[:value]).gsub("\n", ' ').gsub(/\s{2,}/, ' ') %></span>
9
+ <% else %>
10
+ <%= documentation_comment(doc: block) %>
11
+ <% end %>
12
+ <% end %>
13
+ </div>
15
14
  <% end %>
16
15
  <% end %>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docrb-html
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Gama
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-02-21 00:00:00.000000000 Z
11
+ date: 2023-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -24,6 +24,34 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.14'
27
+ - !ruby/object:Gem::Dependency
28
+ name: redcarpet
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.6'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.6'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rouge
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '4.1'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '4.1'
27
55
  - !ruby/object:Gem::Dependency
28
56
  name: sassc
29
57
  requirement: !ruby/object:Gem::Requirement
@@ -56,10 +84,12 @@ files:
56
84
  - assets/class_header.scss
57
85
  - assets/class_mod_name.scss
58
86
  - assets/component_list.scss
87
+ - assets/constant_display.scss
59
88
  - assets/container.scss
60
89
  - assets/doc_box.scss
61
90
  - assets/documentation_block.scss
62
91
  - assets/favicon.ico
92
+ - assets/field_block.scss
63
93
  - assets/fonts.scss
64
94
  - assets/footer.scss
65
95
  - assets/images/balance.svg
@@ -85,6 +115,7 @@ files:
85
115
  - assets/reference.scss
86
116
  - assets/shared.scss
87
117
  - assets/style.scss
118
+ - assets/svg.scss
88
119
  - assets/symbol.scss
89
120
  - assets/tab_bar.scss
90
121
  - assets/text_block.scss
@@ -92,16 +123,23 @@ files:
92
123
  - assets/typedef.scss
93
124
  - bin/console
94
125
  - bin/setup
126
+ - bin/smoke
127
+ - docrb-html.gemspec
95
128
  - exe/docrb-html
96
- - lib/renderer.rb
129
+ - lib/docrb-html.rb
97
130
  - lib/renderer/component.rb
131
+ - lib/renderer/component/attribute.rb
132
+ - lib/renderer/component/attribute_display.rb
98
133
  - lib/renderer/component/breadcrumb.rb
99
134
  - lib/renderer/component/checkbox.rb
100
135
  - lib/renderer/component/class_header.rb
101
136
  - lib/renderer/component/class_mod_name.rb
102
137
  - lib/renderer/component/component_list.rb
138
+ - lib/renderer/component/constant_display.rb
103
139
  - lib/renderer/component/doc_box.rb
104
140
  - lib/renderer/component/documentation_block.rb
141
+ - lib/renderer/component/documentation_comment.rb
142
+ - lib/renderer/component/field_block.rb
105
143
  - lib/renderer/component/footer.rb
106
144
  - lib/renderer/component/markdown.rb
107
145
  - lib/renderer/component/method_argument.rb
@@ -115,27 +153,41 @@ files:
115
153
  - lib/renderer/component/type_definition.rb
116
154
  - lib/renderer/component/typedef.rb
117
155
  - lib/renderer/core_extensions.rb
118
- - lib/renderer/defs.rb
119
- - lib/renderer/defs/specialized_object.rb
120
- - lib/renderer/defs/specialized_projection.rb
156
+ - lib/renderer/entities.rb
157
+ - lib/renderer/entities/attribute.rb
158
+ - lib/renderer/entities/attribute_definition.rb
159
+ - lib/renderer/entities/base.rb
160
+ - lib/renderer/entities/class.rb
161
+ - lib/renderer/entities/container.rb
162
+ - lib/renderer/entities/method.rb
163
+ - lib/renderer/entities/method_argument.rb
164
+ - lib/renderer/entities/method_definition.rb
165
+ - lib/renderer/entities/module.rb
166
+ - lib/renderer/entities/reference.rb
167
+ - lib/renderer/entities/source_definition.rb
121
168
  - lib/renderer/helpers.rb
169
+ - lib/renderer/markdown.rb
122
170
  - lib/renderer/metadata.rb
123
171
  - lib/renderer/page.rb
124
172
  - lib/renderer/template.rb
125
173
  - lib/renderer/version.rb
126
- - renderer.gemspec
127
174
  - script/makecomponent
128
175
  - script/reload.js
129
176
  - script/serve
130
177
  - script/watch
178
+ - templates/attribute.erb
179
+ - templates/attribute_display.erb
131
180
  - templates/base.erb
132
181
  - templates/breadcrumb.erb
133
182
  - templates/checkbox.erb
134
183
  - templates/class_header.erb
135
184
  - templates/class_mod_name.erb
136
185
  - templates/component_list.erb
186
+ - templates/constant_display.erb
137
187
  - templates/doc_box.erb
138
188
  - templates/documentation_block.erb
189
+ - templates/documentation_comment.erb
190
+ - templates/field_block.erb
139
191
  - templates/footer.erb
140
192
  - templates/markdown.erb
141
193
  - templates/method_argument.erb
@@ -171,7 +223,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
171
223
  - !ruby/object:Gem::Version
172
224
  version: '0'
173
225
  requirements: []
174
- rubygems_version: 3.4.2
226
+ rubygems_version: 3.4.10
175
227
  signing_key:
176
228
  specification_version: 4
177
229
  summary: Docrb's HTML Generator