yard-aggredator 1.1.0 → 1.1.1
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 +4 -4
- data/lib/yard/aggredator/plugin.rb +30 -20
- data/lib/yard/aggredator/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 883431c6c272284d50bc24fc97f8da6f513c2ebfd6d8ee32480947bcfef258f6
|
|
4
|
+
data.tar.gz: 82605aa22c6cb2078bca0584367039511020d19267a7af78182253e8b18938ea
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a331da53d97bb4473b34b005079ba8cab5c0185bf5bef3b284da048f279de2517c66e118b3b83327fcbae1900ef6d99e2857e8b0fec18aeaa7262e8244caabcc
|
|
7
|
+
data.tar.gz: 8f841de208c7080aff30563edbb73eb0b7185cef2cbf06b379446d857f7584be3dab4387a86ba78c0c3a3c1b0d571cd03f7c2b28552fdcb0d03e30798f2d4e60
|
|
@@ -131,6 +131,17 @@ module YARD
|
|
|
131
131
|
@current_linking_file = nil
|
|
132
132
|
end
|
|
133
133
|
|
|
134
|
+
def self.find_static_file(file, root: nil)
|
|
135
|
+
files = [file]
|
|
136
|
+
files << File.relative_path(Dir.pwd, File.expand_path(file))
|
|
137
|
+
if root.to_s['.yardoc']
|
|
138
|
+
files << root.to_s.sub('.yardoc', file)
|
|
139
|
+
files << files.last.sub('/doc/', '/gems/')
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
files.find { |f| File.file?(f) }
|
|
143
|
+
end
|
|
144
|
+
|
|
134
145
|
def linkify(*args)
|
|
135
146
|
if args.first.is_a?(String) && /^link:file:(\S+)/.match(args.first)
|
|
136
147
|
file = ::Regexp.last_match(1)
|
|
@@ -145,13 +156,10 @@ module YARD
|
|
|
145
156
|
elsif args.first.is_a?(String) && /^include:file:(\S+)/.match(args.first)
|
|
146
157
|
file = ::Regexp.last_match(1)
|
|
147
158
|
root = YARD::Registry.send(:thread_local_store).file.to_s
|
|
148
|
-
if root
|
|
149
|
-
|
|
150
|
-
file2 = file1.sub('/doc/', '/gems/')
|
|
151
|
-
if (finded = [file, file1, file2].find { |f| File.file?(f) })
|
|
152
|
-
return link_include_file(finded)
|
|
153
|
-
end
|
|
159
|
+
if (finded = Aggredator::Helper.find_static_file(file, root: root))
|
|
160
|
+
return link_include_file(finded)
|
|
154
161
|
end
|
|
162
|
+
|
|
155
163
|
super
|
|
156
164
|
else
|
|
157
165
|
super
|
|
@@ -271,17 +279,18 @@ module YARD
|
|
|
271
279
|
def expand
|
|
272
280
|
if reference?
|
|
273
281
|
result = if (r = directives_from_reference.first&.expand)
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
282
|
+
r
|
|
283
|
+
else
|
|
284
|
+
"<code>see [#{name}] #{reference}</code>"
|
|
285
|
+
end
|
|
278
286
|
return result
|
|
279
287
|
end
|
|
280
288
|
|
|
281
|
-
|
|
282
|
-
|
|
289
|
+
root = YARD::Registry.send(:thread_local_store).file.to_s
|
|
290
|
+
if (finded = Aggredator::Helper.find_static_file(tag.text.to_s, root: root))
|
|
291
|
+
"{include:file:#{finded}}"
|
|
283
292
|
else
|
|
284
|
-
tag.text
|
|
293
|
+
"<code>@!include #{tag.text}</code>"
|
|
285
294
|
end
|
|
286
295
|
end
|
|
287
296
|
end
|
|
@@ -290,17 +299,18 @@ module YARD
|
|
|
290
299
|
def expand
|
|
291
300
|
if reference?
|
|
292
301
|
result = if (r = directives_from_reference.first&.expand)
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
302
|
+
r
|
|
303
|
+
else
|
|
304
|
+
"<code>see [#{name}] #{reference}</code>"
|
|
305
|
+
end
|
|
297
306
|
return result
|
|
298
307
|
end
|
|
299
308
|
|
|
300
|
-
|
|
301
|
-
|
|
309
|
+
root = YARD::Registry.send(:thread_local_store).file.to_s
|
|
310
|
+
if (finded = Aggredator::Helper.find_static_file(tag.text.to_s, root: root))
|
|
311
|
+
File.read(finded)
|
|
302
312
|
else
|
|
303
|
-
tag.text
|
|
313
|
+
"<code>@!embed #{tag.text}</code>"
|
|
304
314
|
end
|
|
305
315
|
end
|
|
306
316
|
end
|