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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4bd7bd1e1ff89ebc50fb101145f1f36d51802c8c2c958e300b19964371218338
4
- data.tar.gz: e6d10631f1f07e47cb21d0a4910a197c68f618195946d88e22e22e91187dbfcb
3
+ metadata.gz: 46ab65a6bab83355b8532920f7dfa26d9f9e05d99fbe6cdbe1677a9b75695861
4
+ data.tar.gz: e69e29e51b3e4bc491e058259be007910032607cce30e0e7223a4a1adad23c01
5
5
  SHA512:
6
- metadata.gz: 8e59abc7fa98961e6afc70c56566b4ec0386f8f1ebd1dd9120bbcc3ea0592021fca8a230801d560d588111621d9d9549143b4f6e53b5d877e7da61f726abb14e
7
- data.tar.gz: 2a1756a7e031b484c8cfe09af1fbf6897c3211cf8fedd35983f22df2e111796c3135a111c6d944f2a0aa049ea2155cbbdd144adb0b2ef0af7a00f4181cea08dc
6
+ metadata.gz: 935815ac11006ab359e5c489f57266d8de17691bc9035a45cd7564e8b3142e927313cef65e41401e1e713422ad77d3c3f7653c9cf0d9167eb8f3cb77c285ff05
7
+ data.tar.gz: 9e57cd852acb2f6bc459206e81088088bd85be92600a973e911c6cddb0e266c384e08b978cb53c7e0b364778358ec515cf21c7d86ede85b91a501c38b5e11103
data/.editorconfig CHANGED
@@ -17,5 +17,5 @@ indent_size = 2
17
17
  [*.yml]
18
18
  indent_size = 2
19
19
 
20
- [./bin/*]
20
+ [bin/*]
21
21
  indent_size = 2
data/.rubocop.yml CHANGED
@@ -1,5 +1,6 @@
1
1
  AllCops:
2
2
  TargetRubyVersion: 3.2
3
+ SuggestExtensions: false
3
4
  NewCops: enable
4
5
 
5
6
  Style/StringLiterals:
@@ -13,40 +14,56 @@ Style/StringLiteralsInInterpolation:
13
14
  Layout/LineLength:
14
15
  Max: 120
15
16
 
16
- Metrics/ClassLength:
17
- Enabled: false
17
+ Layout/FirstHashElementIndentation:
18
+ EnforcedStyle: consistent
18
19
 
19
- Metrics/MethodLength:
20
- Enabled: false
20
+ Layout/EndAlignment:
21
+ EnforcedStyleAlignWith: start_of_line
21
22
 
22
- Metrics/BlockLength:
23
- Enabled: false
23
+ Layout/MultilineMethodCallIndentation:
24
+ EnforcedStyle: indented
24
25
 
25
- Metrics/PerceivedComplexity:
26
+ Style/Documentation:
26
27
  Enabled: false
27
28
 
28
- Metrics/CyclomaticComplexity:
29
+ Layout/CaseIndentation:
30
+ EnforcedStyle: end
31
+
32
+ Layout/FirstArgumentIndentation:
33
+ EnforcedStyle: consistent_relative_to_receiver
34
+
35
+ Layout/ArgumentAlignment:
36
+ EnforcedStyle: with_fixed_indentation
37
+
38
+ Style/EmptyCaseCondition:
29
39
  Enabled: false
30
40
 
31
- Lint/ShadowingOuterLocalVariable:
32
- Exclude:
33
- - bin/*
41
+ Metrics/BlockLength:
42
+ Enabled: false
34
43
 
35
- Metrics/AbcSize:
44
+ Metrics/ClassLength:
36
45
  Enabled: false
37
46
 
38
47
  Metrics/ModuleLength:
39
48
  Enabled: false
40
49
 
41
- Lint/BooleanSymbol:
50
+ Metrics/MethodLength:
42
51
  Enabled: false
43
52
 
44
- Style/Documentation:
53
+ Metrics/AbcSize:
45
54
  Enabled: false
46
55
 
47
- Naming/MethodParameterName:
56
+ Metrics/CyclomaticComplexity:
57
+ Enabled: false
58
+
59
+ Metrics/PerceivedComplexity:
48
60
  Enabled: false
49
61
 
50
62
  Style/FrozenStringLiteralComment:
51
63
  Exclude:
52
64
  - lib/renderer/helpers.rb
65
+ - lib/renderer/template.rb
66
+
67
+ Naming/FileName:
68
+ Exclude:
69
+ - lib/docrb-html.rb
data/Gemfile CHANGED
@@ -4,4 +4,14 @@ source "https://rubygems.org"
4
4
 
5
5
  gemspec
6
6
 
7
- gem "byebug", "~> 11.1"
7
+ group :development do
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "rspec", "~> 3.0"
11
+
12
+ gem "rubocop", "~> 1.21"
13
+
14
+ gem "byebug"
15
+
16
+ gem "awesome_print"
17
+ end
data/Gemfile.lock CHANGED
@@ -1,33 +1,83 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- docrb-html (0.2.5)
4
+ docrb-html (0.3.0)
5
5
  nokogiri (~> 1.14)
6
+ redcarpet (~> 3.6)
7
+ rouge (~> 4.1)
6
8
  sassc (~> 2.4)
7
9
 
8
10
  GEM
9
11
  remote: https://rubygems.org/
10
12
  specs:
13
+ ast (2.4.2)
14
+ awesome_print (1.9.2)
11
15
  byebug (11.1.3)
16
+ diff-lcs (1.5.0)
12
17
  ffi (1.15.5)
18
+ json (2.6.3)
19
+ language_server-protocol (3.17.0.3)
13
20
  nokogiri (1.14.2-arm64-darwin)
14
21
  racc (~> 1.4)
15
22
  nokogiri (1.14.2-x86_64-darwin)
16
23
  racc (~> 1.4)
17
24
  nokogiri (1.14.2-x86_64-linux)
18
25
  racc (~> 1.4)
26
+ parallel (1.23.0)
27
+ parser (3.2.2.4)
28
+ ast (~> 2.4.1)
29
+ racc
19
30
  racc (1.6.2)
31
+ rainbow (3.1.1)
32
+ rake (13.0.6)
33
+ redcarpet (3.6.0)
34
+ regexp_parser (2.8.2)
35
+ rexml (3.2.6)
36
+ rouge (4.2.0)
37
+ rspec (3.12.0)
38
+ rspec-core (~> 3.12.0)
39
+ rspec-expectations (~> 3.12.0)
40
+ rspec-mocks (~> 3.12.0)
41
+ rspec-core (3.12.2)
42
+ rspec-support (~> 3.12.0)
43
+ rspec-expectations (3.12.3)
44
+ diff-lcs (>= 1.2.0, < 2.0)
45
+ rspec-support (~> 3.12.0)
46
+ rspec-mocks (3.12.6)
47
+ diff-lcs (>= 1.2.0, < 2.0)
48
+ rspec-support (~> 3.12.0)
49
+ rspec-support (3.12.1)
50
+ rubocop (1.57.2)
51
+ json (~> 2.3)
52
+ language_server-protocol (>= 3.17.0)
53
+ parallel (~> 1.10)
54
+ parser (>= 3.2.2.4)
55
+ rainbow (>= 2.2.2, < 4.0)
56
+ regexp_parser (>= 1.8, < 3.0)
57
+ rexml (>= 3.2.5, < 4.0)
58
+ rubocop-ast (>= 1.28.1, < 2.0)
59
+ ruby-progressbar (~> 1.7)
60
+ unicode-display_width (>= 2.4.0, < 3.0)
61
+ rubocop-ast (1.30.0)
62
+ parser (>= 3.2.1.0)
63
+ ruby-progressbar (1.13.0)
20
64
  sassc (2.4.0)
21
65
  ffi (~> 1.9)
66
+ unicode-display_width (2.5.0)
22
67
 
23
68
  PLATFORMS
24
69
  arm64-darwin-22
70
+ arm64-darwin-23
25
71
  x86_64-darwin-22
26
72
  x86_64-linux
27
73
 
28
74
  DEPENDENCIES
29
- byebug (~> 11.1)
75
+ awesome_print
76
+ byebug
30
77
  docrb-html!
78
+ rake (~> 13.0)
79
+ rspec (~> 3.0)
80
+ rubocop (~> 1.21)
31
81
 
32
82
  BUNDLED WITH
33
83
  2.4.2
@@ -4,7 +4,6 @@ div.breadcrumb-base {
4
4
  background-color: #161617;
5
5
  height: 57px;
6
6
  display: flex;
7
- align-items: center;
8
7
  overflow-x: scroll;
9
8
  overflow-y: hidden;
10
9
 
@@ -19,6 +19,7 @@ div.class-header-base {
19
19
  .class-name {
20
20
  @include body($weight: 300, $size: 64);
21
21
  color: white;
22
+ margin-bottom: 8px;
22
23
  }
23
24
 
24
25
  .def-link {
@@ -0,0 +1,16 @@
1
+ div.constant-display-base {
2
+ @include container;
3
+ margin-top: 8px;
4
+ .container {
5
+ @include container;
6
+ }
7
+
8
+ .constant-name {
9
+ @include mono;
10
+ color: #FFAB42;
11
+ }
12
+
13
+ .label {
14
+ @include label;
15
+ }
16
+ }
data/assets/doc_box.scss CHANGED
@@ -13,7 +13,6 @@ div.doc-box-base {
13
13
 
14
14
  .left {
15
15
  flex: 1;
16
- max-width: 100%;
17
16
  flex-wrap: wrap;
18
17
 
19
18
  .section-container {
@@ -53,6 +52,37 @@ div.doc-box-base {
53
52
  .faded {
54
53
  @include faded;
55
54
  }
55
+
56
+ .doc-block {
57
+ margin-top: 8px;
58
+ }
59
+ }
60
+
61
+ .constant-container {
62
+ margin-bottom: 12px;
63
+
64
+ .decoration {
65
+ display: inline-block;
66
+ margin-right: 8px;
67
+ margin-left: -18px;
68
+ }
69
+
70
+ .name {
71
+ @include mono;
72
+ color: #FFAB42;
73
+ }
74
+
75
+ .label {
76
+ @include label;
77
+ }
78
+
79
+ .faded {
80
+ @include faded;
81
+ }
82
+
83
+ .doc-block {
84
+ margin-top: 8px;
85
+ }
56
86
  }
57
87
  }
58
88
 
@@ -71,9 +101,9 @@ div.doc-box-base {
71
101
  }
72
102
 
73
103
  a {
74
- color: #FFF;
75
- @include body;
76
- text-decoration: none;
104
+ color: #FFF;
105
+ @include body;
106
+ text-decoration: none;
77
107
  }
78
108
  }
79
109
  }
@@ -1,5 +1,33 @@
1
- div.documentation-block-base {
1
+
2
+ .documentation-comment-base, div.documentation-block-base {
3
+ line-height: 1.5;
2
4
  .faded {
3
5
  @include faded;
4
6
  }
7
+
8
+ .inline { display: inline-block }
9
+
10
+ .method-ref {
11
+ @include mono;
12
+ }
13
+
14
+ code {
15
+ @include mono;
16
+ font-size: 95%;
17
+ padding: 3px 4px;
18
+ background-color: #29292B;
19
+ border-radius: 3px;
20
+ }
21
+ }
22
+
23
+ .unknown-object {
24
+ @include body;
25
+ display: inline-block;
26
+ padding: 0.2em 0.4em;
27
+ margin: 0;
28
+ font-size: 85%;
29
+ background: #ffd842;
30
+ border-radius: 6px;
31
+ text-shadow: 0 0 1px #988128;
32
+ color: black;
5
33
  }
@@ -0,0 +1,46 @@
1
+ .field-block-base {
2
+ margin-left: 8px;
3
+
4
+ .documentation-comment-base {
5
+ display: inline-block;
6
+ }
7
+
8
+ h3 {
9
+ @include faded;
10
+ text-transform: uppercase;
11
+ margin: 15px 0 0;
12
+ font-size: 0.8em;
13
+ font-weight: 500;
14
+ letter-spacing: 2px;
15
+ line-height: 1;
16
+ }
17
+
18
+ table {
19
+ margin-bottom: 5px;
20
+ border-spacing: 10px 5px;
21
+
22
+ .name {
23
+ @include mono;
24
+ color: white;
25
+ vertical-align: top;
26
+ }
27
+
28
+ .value {
29
+ vertical-align: center;
30
+ .inline > .html {
31
+ margin: 0;
32
+ }
33
+ }
34
+ }
35
+
36
+ code {
37
+ padding: 0.2em 0.4em;
38
+ margin: 0;
39
+ font-size: 85%;
40
+ white-space: break-spaces;
41
+ background: #48484d;
42
+ border-radius: 6px;
43
+ text-shadow: 0 0 3px black;
44
+ color: white;
45
+ }
46
+ }
@@ -20,9 +20,9 @@
20
20
  '[data-visibility="internal"]': !hideInternalCheck.checked,
21
21
  '[data-visibility="private"]': !hidePrivateCheck.checked,
22
22
  '[data-type="attribute"]': !hideAttrsCheck.checked,
23
- '[data-origin="inheritance"]': !hideInheritedCheck.checked,
24
- '[data-origin="inclusion"]': showIncludedCheck.checked,
25
- '[data-origin="extension"]': showExtendedCheck.checked,
23
+ '[data-origin="inherited"]': !hideInheritedCheck.checked,
24
+ '[data-origin="included"]': showIncludedCheck.checked,
25
+ '[data-origin="extended"]': showExtendedCheck.checked,
26
26
  });
27
27
  const attrs = ["data-visibility", "data-type", "data-origin"];
28
28
  const filters = Object.keys(determineVisibility());
data/assets/links.scss CHANGED
@@ -6,11 +6,9 @@ a {
6
6
 
7
7
  &.dotted {
8
8
  border-bottom: white 1px dotted;
9
- padding-bottom: 3px;
10
9
  }
11
10
 
12
11
  &.dashed {
13
12
  border-bottom: white 1px dashed;
14
- padding-bottom: 3px;
15
13
  }
16
14
  }
@@ -1,6 +1,5 @@
1
1
  div.method-argument-base {
2
2
  color: #FFAB42;
3
- display: inline;
4
3
  display: flex;
5
4
 
6
5
  span { display: inline-block; }
@@ -63,13 +62,8 @@ div.method-argument-base {
63
62
  .simple-argument {
64
63
  &.symbol { color: #CF91C9; }
65
64
  &.number { color: #FF724C; }
66
- &.string {
67
- color: #8CC98F;
68
- :before, :after {
69
- content: '"';
70
- color: #39B6B5;
71
- }
72
- }
65
+ &.string { color: #8CC98F; }
73
66
  &.plain { color: white; }
67
+ &.call { color: white; }
74
68
  }
75
69
  }
@@ -5,6 +5,10 @@ div.method-display-base {
5
5
  @include container;
6
6
  }
7
7
 
8
+ a.dashed {
9
+ padding-bottom: 3px;
10
+ }
11
+
8
12
  .method-name {
9
13
  @include mono;
10
14
  color: #39B6B5;
@@ -3,6 +3,46 @@ div.method-list-base {
3
3
  margin-bottom: 23px;
4
4
  }
5
5
 
6
+ .override-info-box {
7
+ @include faded;
8
+ padding-top: 8px;
9
+ font-size: 85%;
10
+ a {
11
+ @include mono;
12
+ font-size: inherit;
13
+ opacity: 80%;
14
+ }
15
+ }
16
+
17
+ .overridden-by-block {
18
+ @include faded;
19
+ font-size: 85%;
20
+ padding-top: 8px;
21
+
22
+ span {
23
+ @include mono;
24
+ font-size: inherit;
25
+ }
26
+
27
+ summary {
28
+ cursor: pointer;
29
+ }
30
+
31
+ a {
32
+ font-size: inherit;
33
+ opacity: 85%;
34
+ }
35
+
36
+ ul {
37
+ padding-top: 5px;
38
+ padding-left: 25px;
39
+
40
+ li {
41
+ padding-bottom: 8px;
42
+ }
43
+ }
44
+ }
45
+
6
46
  .doc-block {
7
47
  margin-top: 8px;
8
48
  }
@@ -1,5 +1,5 @@
1
1
  div.reference-base {
2
- display: inline-flex;
2
+ display: inline-block;
3
3
  cursor: pointer;
4
4
  color: white;
5
5
 
data/assets/style.scss CHANGED
@@ -41,3 +41,6 @@ body {
41
41
  @import './reference';
42
42
  @import './symbol';
43
43
  @import './method_list';
44
+ @import './constant_display';
45
+ @import './field_block';
46
+ @import './svg';
data/assets/svg.scss ADDED
@@ -0,0 +1,37 @@
1
+ .svg-container {
2
+ cursor: help;
3
+ position: relative;
4
+
5
+ .svg-title {
6
+ @include body;
7
+ cursor: default;
8
+ padding: 0.4em 0.8em;
9
+ white-space: break-spaces;
10
+ background: #48484d;
11
+ border-radius: 6px;
12
+ text-shadow: 0 0 3px black;
13
+
14
+ display: none;
15
+ position: absolute;
16
+ font-size: 14px;
17
+ color: white;
18
+ left: 22px;
19
+ top: -5px;
20
+
21
+ &::before {
22
+ content: '';
23
+ display: block;
24
+ background-color: #48484d;
25
+ height: 10px;
26
+ width: 10px;
27
+ position: absolute;
28
+ top: calc(50% - 5px);
29
+ left: -5px;
30
+ transform: rotate(45deg);
31
+ }
32
+ }
33
+
34
+ &:hover {
35
+ .svg-title { display: block; }
36
+ }
37
+ }
data/assets/symbol.scss CHANGED
@@ -1,5 +1,5 @@
1
1
  div.symbol-base {
2
- display: inline;
2
+ display: inline-block;
3
3
  @include mono;
4
4
  color: #CF91C9;
5
5
  }
@@ -1,23 +1,23 @@
1
1
  div.text-block-base {
2
2
  .html {
3
- display: block;
3
+ display: flex;
4
+ flex-wrap: wrap;
5
+
4
6
  &.inline {
5
- display: inline;
7
+ display: inline-block;
6
8
  }
7
9
 
8
- margin-bottom: 12px;
9
10
  &.no-margin {
10
11
  margin-bottom: 0;
11
12
  }
12
13
 
13
14
  @include body;
14
15
  color: #FFFFFF;
15
- p code {
16
- @include mono;
17
- font-size: 95%;
18
- padding: 3px 4px;
19
- background-color: #29292B;
20
- border-radius: 3px;
16
+
17
+ .documentation-comment-base { display: inline-block; }
18
+
19
+ span {
20
+ white-space: pre-wrap;
21
21
  }
22
22
  }
23
23
  }
data/bin/smoke ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "renderer"
@@ -27,5 +27,7 @@ Gem::Specification.new do |spec|
27
27
  spec.require_paths = ["lib"]
28
28
 
29
29
  spec.add_dependency "nokogiri", "~> 1.14"
30
+ spec.add_dependency "redcarpet", "~> 3.6"
31
+ spec.add_dependency "rouge", "~> 4.1"
30
32
  spec.add_dependency "sassc", "~> 2.4"
31
33
  end
data/exe/docrb-html CHANGED
@@ -9,4 +9,4 @@ if ARGV.length != 2
9
9
  exit 1
10
10
  end
11
11
 
12
- Renderer.new(ARGV.shift, ARGV.shift).render
12
+ Renderer.configure(ARGV.shift, ARGV.shift).render