jazzy 0.15.3 → 0.15.4
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/.github/workflows/Tests.yml +4 -4
- data/.rubocop.yml +71 -1
- data/CHANGELOG.md +36 -3
- data/CONTRIBUTING.md +1 -1
- data/Gemfile.lock +82 -64
- data/README.md +13 -1
- data/jazzy.gemspec +2 -0
- data/js/package-lock.json +10 -5
- data/lib/jazzy/doc_builder.rb +2 -2
- data/lib/jazzy/doc_index.rb +12 -1
- data/lib/jazzy/docset_builder.rb +1 -1
- data/lib/jazzy/extensions/katex/css/katex.min.css +1 -1
- data/lib/jazzy/extensions/katex/js/katex.min.js +1 -1
- data/lib/jazzy/gem_version.rb +1 -1
- data/lib/jazzy/grouper.rb +25 -15
- data/lib/jazzy/podspec_documenter.rb +2 -0
- data/lib/jazzy/source_declaration/type.rb +3 -2
- data/lib/jazzy/source_declaration.rb +16 -1
- data/lib/jazzy/sourcekitten.rb +13 -11
- data/lib/jazzy/symbol_graph/constraint.rb +3 -2
- data/lib/jazzy/symbol_graph/graph.rb +1 -1
- data/lib/jazzy/symbol_graph/sym_node.rb +1 -1
- metadata +37 -6
data/lib/jazzy/gem_version.rb
CHANGED
data/lib/jazzy/grouper.rb
CHANGED
@@ -49,22 +49,18 @@ module Jazzy
|
|
49
49
|
|
50
50
|
def self.group_custom_categories(docs, doc_index)
|
51
51
|
group = config.custom_categories.map do |category|
|
52
|
-
children = category['children'].map do |
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
52
|
+
children = category['children'].map do |selector|
|
53
|
+
selected = select_docs(doc_index, selector)
|
54
|
+
selected.map do |doc|
|
55
|
+
unless doc.parent_in_code.nil?
|
56
|
+
warn "WARNING: Declaration \"#{doc.fully_qualified_module_name}\" " \
|
57
|
+
'specified in categories file exists but is not top-level and ' \
|
58
|
+
'cannot be included here'
|
59
|
+
next nil
|
60
|
+
end
|
61
|
+
docs.delete(doc)
|
57
62
|
end
|
58
|
-
|
59
|
-
unless doc.parent_in_code.nil?
|
60
|
-
warn "WARNING: Declaration \"#{doc.fully_qualified_module_name}\" " \
|
61
|
-
'specified in categories file exists but is not top-level and ' \
|
62
|
-
'cannot be included here'
|
63
|
-
next nil
|
64
|
-
end
|
65
|
-
|
66
|
-
docs.delete(doc)
|
67
|
-
end.compact
|
63
|
+
end.flatten.compact
|
68
64
|
# Category config overrides alphabetization
|
69
65
|
children.each.with_index { |child, i| child.nav_order = i }
|
70
66
|
make_group(children, category['name'], '')
|
@@ -72,6 +68,20 @@ module Jazzy
|
|
72
68
|
[group.compact, docs]
|
73
69
|
end
|
74
70
|
|
71
|
+
def self.select_docs(doc_index, selector)
|
72
|
+
if selector.is_a?(String)
|
73
|
+
unless single_doc = doc_index.lookup(selector)
|
74
|
+
warn 'WARNING: No documented top-level declarations match ' \
|
75
|
+
"name \"#{selector}\" specified in categories file"
|
76
|
+
return []
|
77
|
+
end
|
78
|
+
[single_doc]
|
79
|
+
else
|
80
|
+
doc_index.lookup_regex(selector['regex'])
|
81
|
+
.sort_by(&:name)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
75
85
|
def self.group_guides(docs, prefix)
|
76
86
|
guides, others = docs.partition { |doc| doc.type.markdown? }
|
77
87
|
return [[], others] unless guides.any?
|
@@ -103,10 +103,12 @@ module Jazzy
|
|
103
103
|
|
104
104
|
# Latest valid value for SWIFT_VERSION.
|
105
105
|
LATEST_SWIFT_VERSION = '6'
|
106
|
+
private_constant :LATEST_SWIFT_VERSION
|
106
107
|
|
107
108
|
# All valid values for SWIFT_VERSION that are longer
|
108
109
|
# than a major version number. Ordered ascending.
|
109
110
|
LONG_SWIFT_VERSIONS = ['4.2'].freeze
|
111
|
+
private_constant :LONG_SWIFT_VERSIONS
|
110
112
|
|
111
113
|
# Go from a full Swift version like 4.2.1 to
|
112
114
|
# something valid for SWIFT_VERSION.
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'logger'
|
3
4
|
require 'active_support'
|
4
5
|
require 'active_support/inflector'
|
5
6
|
|
@@ -148,8 +149,8 @@ module Jazzy
|
|
148
149
|
def param?
|
149
150
|
# SourceKit strangely categorizes initializer parameters as local
|
150
151
|
# variables, so both kinds represent a parameter in jazzy.
|
151
|
-
|
152
|
-
|
152
|
+
['source.lang.swift.decl.var.parameter',
|
153
|
+
'source.lang.swift.decl.var.local'].include?(kind)
|
153
154
|
end
|
154
155
|
|
155
156
|
def generic_type_param?
|
@@ -98,7 +98,7 @@ module Jazzy
|
|
98
98
|
end
|
99
99
|
|
100
100
|
def swift_objc_extension?
|
101
|
-
type.swift_extension? && usr
|
101
|
+
type.swift_extension? && usr&.start_with?('c:objc')
|
102
102
|
end
|
103
103
|
|
104
104
|
def swift_extension_objc_name
|
@@ -256,6 +256,21 @@ module Jazzy
|
|
256
256
|
notes.join(', ').upcase_first unless notes.empty?
|
257
257
|
end
|
258
258
|
|
259
|
+
# For matching where `Self` is equivalent without considering
|
260
|
+
# constraints
|
261
|
+
def simplified_typename
|
262
|
+
typename&.gsub(/<Self .*?>/, '<Self>')
|
263
|
+
end
|
264
|
+
|
265
|
+
# Is the candidate `SourceDeclaration` probably a default
|
266
|
+
# implementation of this declaration?
|
267
|
+
def default_implementation?(candidate)
|
268
|
+
name == candidate.name &&
|
269
|
+
type == candidate.type &&
|
270
|
+
simplified_typename == candidate.simplified_typename &&
|
271
|
+
async == candidate.async
|
272
|
+
end
|
273
|
+
|
259
274
|
def readme?
|
260
275
|
false
|
261
276
|
end
|
data/lib/jazzy/sourcekitten.rb
CHANGED
@@ -739,18 +739,19 @@ module Jazzy
|
|
739
739
|
mod_key = module_deduplication_key(decl)
|
740
740
|
# Swift extension of objc class
|
741
741
|
if decl.swift_objc_extension?
|
742
|
-
[decl.swift_extension_objc_name, :objc_class_and_categories, mod_key]
|
742
|
+
[decl.swift_extension_objc_name, nil, :objc_class_and_categories, mod_key]
|
743
743
|
# Swift type or Swift extension of Swift type
|
744
744
|
elsif mergeable_swift?(decl)
|
745
|
-
[decl.usr, decl.name, mod_key]
|
745
|
+
[decl.usr, nil, decl.name, mod_key]
|
746
746
|
# Objc categories and classes
|
747
747
|
elsif mergeable_objc?(decl, root_decls)
|
748
748
|
# Using the ObjC name to match swift_objc_extension.
|
749
749
|
name, _ = decl.objc_category_name || decl.objc_name
|
750
|
-
[name, :objc_class_and_categories, mod_key]
|
750
|
+
[name, nil, :objc_class_and_categories, mod_key]
|
751
751
|
# Non-mergable declarations (funcs, typedefs etc...)
|
752
752
|
else
|
753
|
-
|
753
|
+
# The typename part works around a Swift bug, jazzy#1396
|
754
|
+
[decl.usr, decl.typename, decl.name, decl.type.kind, '']
|
754
755
|
end
|
755
756
|
end
|
756
757
|
|
@@ -826,14 +827,17 @@ module Jazzy
|
|
826
827
|
# type itself, the type must be private and the extensions
|
827
828
|
# should be rejected.
|
828
829
|
if !typedecl &&
|
829
|
-
wanted_exts.first
|
830
|
-
wanted_exts.first.type_from_doc_module?
|
830
|
+
wanted_exts.first&.type_from_doc_module?
|
831
831
|
unwanted_exts += wanted_exts
|
832
832
|
wanted_exts = []
|
833
833
|
end
|
834
834
|
|
835
|
-
# Don't tell the user to document them
|
836
|
-
|
835
|
+
# Don't tell the user to document them or their contents
|
836
|
+
remover = lambda do |decls|
|
837
|
+
decls.each { |d| @stats.remove_undocumented(d) }
|
838
|
+
decls.map(&:children).each { |c| remover[c] }
|
839
|
+
end
|
840
|
+
remover[unwanted_exts]
|
837
841
|
|
838
842
|
objc_exts + wanted_exts
|
839
843
|
end
|
@@ -853,9 +857,7 @@ module Jazzy
|
|
853
857
|
extensions.each do |ext|
|
854
858
|
ext.children = ext.children.select do |ext_member|
|
855
859
|
proto_member = protocol.children.find do |p|
|
856
|
-
p.
|
857
|
-
p.type == ext_member.type &&
|
858
|
-
p.async == ext_member.async
|
860
|
+
p.default_implementation?(ext_member)
|
859
861
|
end
|
860
862
|
|
861
863
|
# Extension-only method, keep.
|
@@ -17,13 +17,14 @@ module Jazzy
|
|
17
17
|
self.rhs = rhs
|
18
18
|
end
|
19
19
|
|
20
|
-
public
|
21
|
-
|
22
20
|
KIND_MAP = {
|
23
21
|
'conformance' => ':',
|
24
22
|
'superclass' => ':',
|
25
23
|
'sameType' => '==',
|
26
24
|
}.freeze
|
25
|
+
private_constant :KIND_MAP
|
26
|
+
|
27
|
+
public
|
27
28
|
|
28
29
|
# Init from a JSON hash
|
29
30
|
def self.new_hash(hash)
|
@@ -100,7 +100,7 @@ module Jazzy
|
|
100
100
|
source.unique_context_constraints(target))
|
101
101
|
|
102
102
|
# Add to its parent or invent an extension
|
103
|
-
unless target&.
|
103
|
+
unless target&.add_child?(source, constraints.ext)
|
104
104
|
add_ext_member(rel.target_usr, source, constraints)
|
105
105
|
end
|
106
106
|
end
|
@@ -76,7 +76,7 @@ module Jazzy
|
|
76
76
|
# It must go in an extension if either:
|
77
77
|
# - it has different generic constraints to us; or
|
78
78
|
# - we're a protocol and it's a default impl / ext method
|
79
|
-
def
|
79
|
+
def add_child?(node, unique_context_constraints)
|
80
80
|
unless unique_context_constraints.empty? &&
|
81
81
|
(!protocol? || node.protocol_requirement?)
|
82
82
|
return false
|
metadata
CHANGED
@@ -1,18 +1,37 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jazzy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.15.
|
4
|
+
version: 0.15.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JP Simard
|
8
8
|
- Tim Anglade
|
9
9
|
- Samuel Giddins
|
10
10
|
- John Fairhurst
|
11
|
-
autorequire:
|
12
11
|
bindir: bin
|
13
12
|
cert_chain: []
|
14
|
-
date:
|
13
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
15
14
|
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: activesupport
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - ">="
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '5.0'
|
22
|
+
- - "<"
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: '8'
|
25
|
+
type: :runtime
|
26
|
+
prerelease: false
|
27
|
+
version_requirements: !ruby/object:Gem::Requirement
|
28
|
+
requirements:
|
29
|
+
- - ">="
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: '5.0'
|
32
|
+
- - "<"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '8'
|
16
35
|
- !ruby/object:Gem::Dependency
|
17
36
|
name: cocoapods
|
18
37
|
requirement: !ruby/object:Gem::Requirement
|
@@ -27,6 +46,20 @@ dependencies:
|
|
27
46
|
- - "~>"
|
28
47
|
- !ruby/object:Gem::Version
|
29
48
|
version: '1.5'
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: logger
|
51
|
+
requirement: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
type: :runtime
|
57
|
+
prerelease: false
|
58
|
+
version_requirements: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
30
63
|
- !ruby/object:Gem::Dependency
|
31
64
|
name: mustache
|
32
65
|
requirement: !ruby/object:Gem::Requirement
|
@@ -367,7 +400,6 @@ licenses:
|
|
367
400
|
- MIT
|
368
401
|
metadata:
|
369
402
|
rubygems_mfa_required: 'true'
|
370
|
-
post_install_message:
|
371
403
|
rdoc_options: []
|
372
404
|
require_paths:
|
373
405
|
- lib
|
@@ -382,8 +414,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
382
414
|
- !ruby/object:Gem::Version
|
383
415
|
version: '0'
|
384
416
|
requirements: []
|
385
|
-
rubygems_version: 3.
|
386
|
-
signing_key:
|
417
|
+
rubygems_version: 3.6.9
|
387
418
|
specification_version: 4
|
388
419
|
summary: Soulful docs for Swift & Objective-C.
|
389
420
|
test_files: []
|