yard-aggredator 1.0.4 → 1.0.7

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7afa8c8bbde7e00df07c5d8d0503c03dc81a503554d27ce08c5cd5037c929070
4
- data.tar.gz: a7727651b4a1a862b32e338a0d38ab5979446c502ad5d96b3232024fa4b13861
3
+ metadata.gz: acb9b52ae6e1c9e98226fa28b988954d3c7da791a5903012c27bdf3de917cc92
4
+ data.tar.gz: eb4ea279130164f026741912bf93ed69a39a014997c6ead0bbe6e2a778f1aac7
5
5
  SHA512:
6
- metadata.gz: c7a136de38037eb861979cadf3e033b0fbdf078585a1e278f8aef0d93ccbe4e88b5e5121e182e1af4eaf8267e8422dc8e3325fabea90596e508ba10109339e3e
7
- data.tar.gz: e01f362d44b71d3e4fee09f59674874ca849dfe68610378a83453fc347cc5809156182999ccf007aeadc29bfad07714d24c5c8410c15a5c0d14a30739b7c1554
6
+ metadata.gz: f4e22b1bafa1fedb7e76e1bae5d72d8b4ecc5b804eb37619f72d068e692ad5bd544a454c3b0b8bd59b407b9988155c80365171f821de788d7299e5142a0f9a8e
7
+ data.tar.gz: 31721db0cdff951fb556e38e9b736ba859404a753b0b83b1f52c5738e77a484e9e2cc399a5d3ae5089fdddc7658c2300a98c43cb8bd526b00ee9883e8774593d
@@ -1,6 +1,4 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2019 Ivan Godko
1
+ Copyright (c) 2014-2025 Рнд Софт
4
2
 
5
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
4
  of this software and associated documentation files (the "Software"), to deal
@@ -9,13 +7,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
7
  copies of the Software, and to permit persons to whom the Software is
10
8
  furnished to do so, subject to the following conditions:
11
9
 
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
14
12
 
15
13
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
14
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
15
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
16
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
17
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
data/README.md CHANGED
@@ -0,0 +1,99 @@
1
+
2
+ # yard-aggredator плагин для YARD
3
+
4
+ <div align="center">
5
+
6
+ [![Gem Version](https://badge.fury.io/rb/yard-aggredator.svg)](https://rubygems.org/gems/yard-aggredator)
7
+ [![Gitlab](https://badgen.net/badge/gitlab/ruby%2Fyard-aggredator/orange?icon=gitlab&label)](https://br.rnds.pro/ruby/yard-aggredator)
8
+ [![YARD](https://badgen.net/badge/YARD/doc/blue)](https://yard.rnds.local)
9
+
10
+ </div>
11
+
12
+ Очень полезные дополнения и справляения для генератор документации YARD.
13
+
14
+ <div align="left">
15
+ <a href="https://rnds.pro/" >
16
+ <img src="https://library.rnds.pro/repository/public-blob/logo/RNDS.svg" alt="Supported by RNDSOFT" height="60">
17
+ </a>
18
+ </div>
19
+
20
+ ## Возможности / Features
21
+
22
+ - Поддержка `mermaid`-диаграмма
23
+ - Корректная работа `include:file` для статических ресурсов во всех режимах `Server`, `Static` и `Gems`
24
+ - Новый тип ссылки `link:file` для указания на статические ресурсы
25
+ - Совместимость `md`-ссылок YARD и Github/Gitlab
26
+ - Корректная работа подсветки синтаксиса в блоках внутри `Markdown` разметки в документировании классов
27
+ - Корректная генерация имён статических ресурсов, таких как множетсвенные `md`-файлы внутри подпапок
28
+
29
+
30
+ ## Примеры
31
+
32
+ ### `mermaid`-диаграммы
33
+
34
+ ```ruby
35
+ # MyClass
36
+ #
37
+ # Диаграмма
38
+ #
39
+ # ```mermaid
40
+ # flowchart LR
41
+ # Start --> Stop
42
+ # ```
43
+ #
44
+ class MyClass
45
+ end
46
+ ```
47
+
48
+ ### `mermaid`-диаграммы
49
+
50
+ ```ruby
51
+ # MyClass
52
+ #
53
+ # @see link:file:schemas/my_class.json JSON-схема
54
+ #
55
+ class MyClass
56
+ end
57
+ ```
58
+
59
+ ### Вложенные `md`-файлы
60
+
61
+ Например для такой стурктуры
62
+
63
+ ```sh
64
+ ├── lib
65
+ │   └── api
66
+ │   ├── v1
67
+ │   │   └── README.md
68
+ │   ├── v2
69
+ │   │ └── README.md
70
+ │   └── v3
71
+ │   └── README.md
72
+ ├── README.md
73
+ ```
74
+
75
+ ```ruby
76
+ - [V3](lib/api/v3/README.md) - asdasdasda
77
+ # MyClass
78
+ #
79
+ # @see file:lib/api/v1/README.md Описание V1
80
+ # @see file:lib/api/v2/README.md Описание V2
81
+ # @see file:lib/api/v3/README.md Описание V3
82
+ #
83
+ # Либо в Markdown синтаксисе для совместимости с Gitlab/Github
84
+ #
85
+ # [Описание V1](lib/api/v1/README.md)
86
+ # [Описание V2](lib/api/v2/README.md)
87
+ # [Описание V3](lib/api/v3/README.md)
88
+ #
89
+ class MyClass
90
+ end
91
+ ```
92
+
93
+ ## Лицензия / License
94
+
95
+ Библиотека доступна с открытым исходным кодом в соответствии с условиями [лицензии MIT](./LICENSE).
96
+
97
+ ---
98
+
99
+ The gem is available as open source under the terms of the [MIT License](./LICENSE).
@@ -1,5 +1,6 @@
1
1
  require 'json'
2
- require 'coderay'
2
+ require 'rouge'
3
+ require 'yard/relative_markdown_links'
3
4
 
4
5
  YARD::Templates::Helpers::MarkupHelper::MARKUP_PROVIDERS[:plain] = []
5
6
  YARD::Templates::Helpers::MarkupHelper::MARKUP_EXTENSIONS[:plain] = %w[json txt text mermaid]
@@ -85,7 +86,7 @@ module YARD
85
86
  string
86
87
  else
87
88
  classes = ['code', language].compact.join(' ')
88
- %(<pre class="#{classes}"><code class="#{language}">#{string}</code></pre>)
89
+ %(<pre class="#{classes} highlight"><code class="#{language}">#{string}</code></pre>)
89
90
  end
90
91
  end
91
92
  end
@@ -101,9 +102,11 @@ module YARD
101
102
  if args.first.is_a?(String) && /^link:file:(\S+)/.match(args.first)
102
103
  file = ::Regexp.last_match(1)
103
104
  relpath = File.relative_path(Dir.pwd, File.expand_path(file))
104
- if serializer.class == YARD::Serializers::FileSystemSerializer
105
+ if (serializer.class == YARD::Serializers::FileSystemSerializer)
106
+ # Это генерация статики. Например `yardoc` или `yard doc`
105
107
  link_url(url_for(relpath), args[1])
106
108
  else
109
+ # Это генерация динамики. Например `yard server`
107
110
  link_file(relpath, args[1])
108
111
  end
109
112
  elsif args.first.is_a?(String) && /^include:file:(\S+)/.match(args.first)
@@ -139,6 +142,18 @@ module YARD
139
142
  # super
140
143
  # end
141
144
  end
145
+
146
+ module RougeHighlighter
147
+ Rouge::Lexer.all.each do |lexer_class|
148
+ ([lexer_class.tag] + lexer_class.aliases).compact.uniq.each do |tag|
149
+ define_method("html_syntax_highlight_#{tag}") do |source|
150
+ formatter = Rouge::Formatters::HTMLInline.new('monokai.sublime')
151
+ lexer = lexer_class.new
152
+ formatter.format(lexer.lex(source))
153
+ end
154
+ end
155
+ end
156
+ end
142
157
  end
143
158
 
144
159
  module ExtraFileObjectPatch
@@ -154,4 +169,7 @@ end
154
169
 
155
170
  ::YARD::Templates::Engine.register_template_path(File.dirname(__FILE__) + '/../../../templates')
156
171
  ::YARD::Templates::Template.extra_includes << ::YARD::Aggredator::Helper
172
+ ::YARD::Templates::Template.extra_includes << ::YARD::Aggredator::RougeHighlighter
173
+ ::YARD::Templates::Template.extra_includes << ::YARD::RelativeMarkdownLinks
157
174
  ::YARD::CodeObjects::ExtraFileObject.prepend(::YARD::ExtraFileObjectPatch)
175
+
@@ -1,5 +1,5 @@
1
1
  module YARD
2
2
  module Aggredator
3
- VERSION = '1.0.4'
3
+ VERSION = '1.0.7'
4
4
  end
5
5
  end
@@ -0,0 +1,6 @@
1
+
2
+ перегенерировать стиль:
3
+
4
+ ```sh
5
+ rougify style monokai.sublime --scope="body #content .highlight" > common.css
6
+ ```
@@ -0,0 +1,203 @@
1
+ body #content .highlight table td { padding: 5px; }
2
+ body #content .highlight table pre { margin: 0; }
3
+ body #content .highlight .gh {
4
+ color: #999999;
5
+ }
6
+ body #content .highlight .sr {
7
+ color: #f6aa11;
8
+ }
9
+ body #content .highlight .go {
10
+ color: #888888;
11
+ }
12
+ body #content .highlight .gp {
13
+ color: #555555;
14
+ }
15
+ body #content .highlight .ge {
16
+ font-style: italic;
17
+ }
18
+ body #content .highlight .ges {
19
+ font-weight: bold;
20
+ font-style: italic;
21
+ }
22
+ body #content .highlight .gs {
23
+ font-weight: bold;
24
+ }
25
+ body #content .highlight .gu {
26
+ color: #aaaaaa;
27
+ }
28
+ body #content .highlight .nb {
29
+ color: #f6aa11;
30
+ }
31
+ body #content .highlight .cm {
32
+ color: #75715e;
33
+ }
34
+ body #content .highlight .cp {
35
+ color: #75715e;
36
+ }
37
+ body #content .highlight .c1 {
38
+ color: #75715e;
39
+ }
40
+ body #content .highlight .cs {
41
+ color: #75715e;
42
+ }
43
+ body #content .highlight .c, body #content .highlight .ch, body #content .highlight .cd, body #content .highlight .cpf {
44
+ color: #75715e;
45
+ }
46
+ body #content .highlight .err {
47
+ color: #960050;
48
+ }
49
+ body #content .highlight .gr {
50
+ color: #960050;
51
+ }
52
+ body #content .highlight .gt {
53
+ color: #960050;
54
+ }
55
+ body #content .highlight .gd {
56
+ color: #49483e;
57
+ }
58
+ body #content .highlight .gi {
59
+ color: #49483e;
60
+ }
61
+ body #content .highlight .kc {
62
+ color: #66d9ef;
63
+ }
64
+ body #content .highlight .kd {
65
+ color: #66d9ef;
66
+ }
67
+ body #content .highlight .kr {
68
+ color: #66d9ef;
69
+ }
70
+ body #content .highlight .no {
71
+ color: #66d9ef;
72
+ }
73
+ body #content .highlight .kt {
74
+ color: #66d9ef;
75
+ }
76
+ body #content .highlight .mf {
77
+ color: #ae81ff;
78
+ }
79
+ body #content .highlight .mh {
80
+ color: #ae81ff;
81
+ }
82
+ body #content .highlight .il {
83
+ color: #ae81ff;
84
+ }
85
+ body #content .highlight .mi {
86
+ color: #ae81ff;
87
+ }
88
+ body #content .highlight .mo {
89
+ color: #ae81ff;
90
+ }
91
+ body #content .highlight .m, body #content .highlight .mb, body #content .highlight .mx {
92
+ color: #ae81ff;
93
+ }
94
+ body #content .highlight .sc {
95
+ color: #ae81ff;
96
+ }
97
+ body #content .highlight .se {
98
+ color: #ae81ff;
99
+ }
100
+ body #content .highlight .ss {
101
+ color: #ae81ff;
102
+ }
103
+ body #content .highlight .sd {
104
+ color: #e6db74;
105
+ }
106
+ body #content .highlight .s2 {
107
+ color: #e6db74;
108
+ }
109
+ body #content .highlight .sb {
110
+ color: #e6db74;
111
+ }
112
+ body #content .highlight .sh {
113
+ color: #e6db74;
114
+ }
115
+ body #content .highlight .si {
116
+ color: #e6db74;
117
+ }
118
+ body #content .highlight .sx {
119
+ color: #e6db74;
120
+ }
121
+ body #content .highlight .s1 {
122
+ color: #e6db74;
123
+ }
124
+ body #content .highlight .s, body #content .highlight .sa, body #content .highlight .dl {
125
+ color: #e6db74;
126
+ }
127
+ body #content .highlight .na {
128
+ color: #a6e22e;
129
+ }
130
+ body #content .highlight .nc {
131
+ color: #a6e22e;
132
+ }
133
+ body #content .highlight .nd {
134
+ color: #a6e22e;
135
+ }
136
+ body #content .highlight .ne {
137
+ color: #a6e22e;
138
+ }
139
+ body #content .highlight .nf, body #content .highlight .fm {
140
+ color: #a6e22e;
141
+ }
142
+ body #content .highlight .vc {
143
+ color: #ffffff;
144
+ background-color: #272822;
145
+ }
146
+ body #content .highlight .nn {
147
+ color: #ffffff;
148
+ background-color: #272822;
149
+ }
150
+ body #content .highlight .nl {
151
+ color: #ffffff;
152
+ background-color: #272822;
153
+ }
154
+ body #content .highlight .ni {
155
+ color: #ffffff;
156
+ background-color: #272822;
157
+ }
158
+ body #content .highlight .bp {
159
+ color: #ffffff;
160
+ background-color: #272822;
161
+ }
162
+ body #content .highlight .vg {
163
+ color: #ffffff;
164
+ background-color: #272822;
165
+ }
166
+ body #content .highlight .vi {
167
+ color: #ffffff;
168
+ background-color: #272822;
169
+ }
170
+ body #content .highlight .nv, body #content .highlight .vm {
171
+ color: #ffffff;
172
+ background-color: #272822;
173
+ }
174
+ body #content .highlight .w {
175
+ color: #ffffff;
176
+ background-color: #272822;
177
+ }
178
+ body #content .highlight {
179
+ color: #ffffff;
180
+ background-color: #272822;
181
+ }
182
+ body #content .highlight .n, body #content .highlight .py, body #content .highlight .nx {
183
+ color: #ffffff;
184
+ background-color: #272822;
185
+ }
186
+ body #content .highlight .ow {
187
+ color: #f92672;
188
+ }
189
+ body #content .highlight .nt {
190
+ color: #f92672;
191
+ }
192
+ body #content .highlight .k, body #content .highlight .kv {
193
+ color: #f92672;
194
+ }
195
+ body #content .highlight .kn {
196
+ color: #f92672;
197
+ }
198
+ body #content .highlight .kp {
199
+ color: #f92672;
200
+ }
201
+ body #content .highlight .o {
202
+ color: #f92672;
203
+ }
@@ -1,3 +1,2 @@
1
1
  <script>
2
- console.log('custom js')
3
2
  </script>
@@ -7,4 +7,5 @@ end
7
7
 
8
8
  def javascripts
9
9
  super + ['js/mermaid.min.js']
10
- end
10
+ end
11
+
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.authors = ['Samoilenko Yuri']
11
11
  spec.email = ['kinnalru@gmail.com']
12
12
 
13
- spec.summary = 'YARD plugin for documenting Aggredator API gem'
13
+ spec.summary = 'YARD plugin with useful fixes and tools'
14
14
  spec.description = '
15
15
  Различные вспомогательные функции: работа с Mermaid Diagram, работа с сылками на статические файлы и другая косметика'
16
16
 
@@ -18,10 +18,11 @@ Gem::Specification.new do |spec|
18
18
  spec.homepage = 'https://br.rnds.pro/ruby/yard-aggredator'
19
19
  spec.platform = Gem::Platform::RUBY
20
20
 
21
- spec.files = Dir.glob('{lib,templates}/**/*') + ['LICENSE.txt', 'README.md', __FILE__]
21
+ spec.files = Dir.glob('{lib,templates}/**/*') + ['LICENSE', 'README.md', __FILE__]
22
22
  spec.require_paths = ['lib']
23
23
 
24
- spec.add_dependency 'coderay'
24
+ spec.add_dependency 'rouge'
25
25
  spec.add_dependency 'json'
26
26
  spec.add_dependency 'yard'
27
+ spec.add_dependency 'yard-relative_markdown_links'
27
28
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yard-aggredator
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samoilenko Yuri
@@ -10,7 +10,7 @@ cert_chain: []
10
10
  date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
- name: coderay
13
+ name: rouge
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
16
  - - ">="
@@ -51,6 +51,20 @@ dependencies:
51
51
  - - ">="
52
52
  - !ruby/object:Gem::Version
53
53
  version: '0'
54
+ - !ruby/object:Gem::Dependency
55
+ name: yard-relative_markdown_links
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ type: :runtime
62
+ prerelease: false
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
54
68
  description: |2-
55
69
 
56
70
  Различные вспомогательные функции: работа с Mermaid Diagram, работа с сылками на статические файлы и другая косметика
@@ -60,12 +74,14 @@ executables: []
60
74
  extensions: []
61
75
  extra_rdoc_files: []
62
76
  files:
63
- - LICENSE.txt
77
+ - LICENSE
64
78
  - README.md
65
79
  - lib/yard-aggredator.rb
66
80
  - lib/yard/aggredator/plugin.rb
67
81
  - lib/yard/aggredator/version.rb
68
82
  - lib/yard_aggredator.rb
83
+ - templates/default/fulldoc/html/css/README.md
84
+ - templates/default/fulldoc/html/css/common.css
69
85
  - templates/default/fulldoc/html/js/mermaid.min.js
70
86
  - templates/default/layout/html/customjs.erb
71
87
  - templates/default/layout/html/setup.rb
@@ -90,5 +106,5 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
106
  requirements: []
91
107
  rubygems_version: 3.6.9
92
108
  specification_version: 4
93
- summary: YARD plugin for documenting Aggredator API gem
109
+ summary: YARD plugin with useful fixes and tools
94
110
  test_files: []