jazzy 0.13.7 → 0.14.2
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 +6 -6
- data/.rubocop.yml +155 -24
- data/CHANGELOG.md +91 -0
- data/CONTRIBUTING.md +1 -1
- data/Dangerfile +11 -8
- data/Gemfile +3 -1
- data/Gemfile.lock +85 -64
- data/ObjectiveC.md +208 -0
- data/README.md +63 -33
- data/Rakefile +18 -15
- data/bin/jazzy +3 -2
- data/bin/sourcekitten +0 -0
- data/jazzy.gemspec +9 -6
- data/lib/jazzy/config.rb +135 -69
- data/lib/jazzy/doc.rb +3 -1
- data/lib/jazzy/doc_builder.rb +72 -83
- data/lib/jazzy/docset_builder.rb +3 -1
- data/lib/jazzy/documentation_generator.rb +6 -2
- data/lib/jazzy/executable.rb +3 -0
- data/lib/jazzy/extensions/bitbucket/img/bitbucket.svg +11 -0
- data/lib/jazzy/{themes/apple/assets → extensions/github}/img/gh.png +0 -0
- data/lib/jazzy/extensions/gitlab/img/gitlab.svg +23 -0
- data/lib/jazzy/gem_version.rb +3 -1
- data/lib/jazzy/highlighter.rb +5 -3
- data/lib/jazzy/jazzy_markdown.rb +75 -32
- data/lib/jazzy/podspec_documenter.rb +14 -16
- data/lib/jazzy/search_builder.rb +5 -6
- data/lib/jazzy/source_declaration/access_control_level.rb +7 -5
- data/lib/jazzy/source_declaration/type.rb +29 -3
- data/lib/jazzy/source_declaration.rb +22 -5
- data/lib/jazzy/source_document.rb +8 -5
- data/lib/jazzy/source_host.rb +111 -0
- data/lib/jazzy/source_mark.rb +8 -6
- data/lib/jazzy/source_module.rb +6 -6
- data/lib/jazzy/sourcekitten.rb +155 -81
- data/lib/jazzy/stats.rb +14 -3
- data/lib/jazzy/symbol_graph/constraint.rb +5 -1
- data/lib/jazzy/symbol_graph/ext_node.rb +3 -1
- data/lib/jazzy/symbol_graph/graph.rb +19 -12
- data/lib/jazzy/symbol_graph/relationship.rb +9 -0
- data/lib/jazzy/symbol_graph/sym_node.rb +25 -7
- data/lib/jazzy/symbol_graph/symbol.rb +54 -25
- data/lib/jazzy/symbol_graph.rb +43 -32
- data/lib/jazzy/themes/apple/assets/css/highlight.css.scss +63 -59
- data/lib/jazzy/themes/apple/assets/css/jazzy.css.scss +5 -1
- data/lib/jazzy/themes/apple/assets/js/jazzy.js +4 -0
- data/lib/jazzy/themes/apple/assets/js/jazzy.search.js +4 -0
- data/lib/jazzy/themes/apple/templates/doc.mustache +4 -5
- data/lib/jazzy/themes/apple/templates/footer.mustache +1 -1
- data/lib/jazzy/themes/apple/templates/header.mustache +6 -6
- data/lib/jazzy/themes/apple/templates/task.mustache +6 -11
- data/lib/jazzy/themes/fullwidth/assets/css/highlight.css.scss +63 -59
- data/lib/jazzy/themes/fullwidth/assets/css/jazzy.css.scss +6 -2
- data/lib/jazzy/themes/fullwidth/assets/js/jazzy.js +4 -0
- data/lib/jazzy/themes/fullwidth/assets/js/jazzy.search.js +4 -0
- data/lib/jazzy/themes/fullwidth/templates/doc.mustache +4 -5
- data/lib/jazzy/themes/fullwidth/templates/footer.mustache +1 -1
- data/lib/jazzy/themes/fullwidth/templates/header.mustache +8 -8
- data/lib/jazzy/themes/fullwidth/templates/task.mustache +6 -11
- data/lib/jazzy/themes/jony/assets/css/highlight.css.scss +63 -59
- data/lib/jazzy/themes/jony/assets/css/jazzy.css.scss +5 -1
- data/lib/jazzy/themes/jony/assets/js/jazzy.js +4 -0
- data/lib/jazzy/themes/jony/templates/doc.mustache +4 -5
- data/lib/jazzy/themes/jony/templates/footer.mustache +1 -1
- data/lib/jazzy/themes/jony/templates/header.mustache +6 -6
- data/lib/jazzy/themes/jony/templates/task.mustache +6 -11
- data/lib/jazzy.rb +2 -0
- data/spec/integration_spec.rb +46 -42
- data/spec/spec_helper/pre_flight.rb +2 -0
- data/spec/spec_helper.rb +3 -1
- metadata +32 -16
- data/lib/jazzy/themes/fullwidth/assets/img/gh.png +0 -0
- data/lib/jazzy/themes/jony/assets/img/gh.png +0 -0
- data/spec/sourcekitten_spec.rb +0 -6
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'tmpdir'
|
2
4
|
require 'json'
|
3
5
|
|
@@ -22,8 +24,8 @@ module Jazzy
|
|
22
24
|
installer.install!
|
23
25
|
stdout = Dir.chdir(sandbox.root) do
|
24
26
|
targets = installer.pod_targets
|
25
|
-
|
26
|
-
|
27
|
+
.select { |pt| pt.pod_name == podspec.root.name }
|
28
|
+
.map(&:label)
|
27
29
|
|
28
30
|
targets.map do |t|
|
29
31
|
args = %W[doc --module-name #{podspec.module_name} -- -target #{t}]
|
@@ -42,8 +44,6 @@ module Jazzy
|
|
42
44
|
end
|
43
45
|
end
|
44
46
|
|
45
|
-
# rubocop:disable Metrics/CyclomaticComplexity
|
46
|
-
# rubocop:disable Metrics/PerceivedComplexity
|
47
47
|
# rubocop:disable Metrics/MethodLength
|
48
48
|
def self.apply_config_defaults(podspec, config)
|
49
49
|
return unless podspec
|
@@ -64,9 +64,9 @@ module Jazzy
|
|
64
64
|
config.version = podspec.version.to_s
|
65
65
|
config.version_configured = true
|
66
66
|
end
|
67
|
-
unless config.
|
68
|
-
config.
|
69
|
-
config.
|
67
|
+
unless config.source_host_files_url_configured
|
68
|
+
config.source_host_files_url = github_file_prefix(podspec)
|
69
|
+
config.source_host_files_url_configured = true
|
70
70
|
end
|
71
71
|
unless config.swift_version_configured
|
72
72
|
trunk_swift_build = podspec.attributes_hash['pushed_with_swift_version']
|
@@ -74,8 +74,6 @@ module Jazzy
|
|
74
74
|
config.swift_version_configured = true
|
75
75
|
end
|
76
76
|
end
|
77
|
-
# rubocop:enable Metrics/CyclomaticComplexity
|
78
|
-
# rubocop:enable Metrics/PerceivedComplexity
|
79
77
|
# rubocop:enable Metrics/MethodLength
|
80
78
|
|
81
79
|
private
|
@@ -94,17 +92,17 @@ module Jazzy
|
|
94
92
|
|
95
93
|
def self.github_file_prefix(podspec)
|
96
94
|
return unless podspec.source[:url] =~ %r{github.com[:/]+(.+)/(.+)}
|
95
|
+
|
97
96
|
org, repo = Regexp.last_match
|
98
|
-
return unless org && repo
|
99
|
-
repo.sub!(/\.git$/, '')
|
100
97
|
return unless rev = podspec.source[:tag] || podspec.source[:commit]
|
101
|
-
|
98
|
+
|
99
|
+
"https://github.com/#{org}/#{repo.sub(/\.git$/, '')}/blob/#{rev}"
|
102
100
|
end
|
103
101
|
|
104
102
|
private_class_method :github_file_prefix
|
105
103
|
|
106
104
|
# Latest valid value for SWIFT_VERSION.
|
107
|
-
LATEST_SWIFT_VERSION = '5'
|
105
|
+
LATEST_SWIFT_VERSION = '5'
|
108
106
|
|
109
107
|
# All valid values for SWIFT_VERSION that are longer
|
110
108
|
# than a major version number. Ordered ascending.
|
@@ -162,9 +160,8 @@ module Jazzy
|
|
162
160
|
# Travis builds take too long when building docs for all available
|
163
161
|
# platforms for the Moya integration spec, so we just document OSX.
|
164
162
|
# TODO: remove once jazzy is fast enough.
|
165
|
-
if ENV['JAZZY_INTEGRATION_SPECS']
|
166
|
-
|
167
|
-
end
|
163
|
+
next if ENV['JAZZY_INTEGRATION_SPECS'] && p.name != :osx
|
164
|
+
|
168
165
|
target("Jazzy-#{ss.name.gsub('/', '__')}-#{p.name}") do
|
169
166
|
use_frameworks!
|
170
167
|
platform p.name, p.deployment_target
|
@@ -177,4 +174,5 @@ module Jazzy
|
|
177
174
|
end
|
178
175
|
# rubocop:enable Metrics/MethodLength
|
179
176
|
end
|
177
|
+
# rubocop:enable Metrics/ClassLength
|
180
178
|
end
|
data/lib/jazzy/search_builder.rb
CHANGED
@@ -1,21 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Jazzy
|
2
4
|
module SearchBuilder
|
3
5
|
def self.build(source_module, output_dir)
|
4
6
|
decls = source_module.all_declarations.select do |d|
|
5
7
|
d.type && d.name && !d.name.empty?
|
6
8
|
end
|
7
|
-
index =
|
9
|
+
index = decls.to_h do |d|
|
8
10
|
[d.url,
|
9
11
|
{
|
10
12
|
name: d.name,
|
11
13
|
abstract: d.abstract && d.abstract.split(/\n/).map(&:strip).first,
|
12
|
-
parent_name: d.parent_in_code
|
14
|
+
parent_name: d.parent_in_code&.name,
|
13
15
|
}.reject { |_, v| v.nil? || v.empty? }]
|
14
16
|
end
|
15
|
-
|
16
|
-
File.open(File.join(output_dir, 'search.json'), 'w') do |f|
|
17
|
-
f.write(index.to_json)
|
18
|
-
end
|
17
|
+
File.write(File.join(output_dir, 'search.json'), index.to_json)
|
19
18
|
end
|
20
19
|
end
|
21
20
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Jazzy
|
2
4
|
class SourceDeclaration
|
3
5
|
class AccessControlLevel
|
@@ -5,12 +7,12 @@ module Jazzy
|
|
5
7
|
|
6
8
|
attr_reader :level
|
7
9
|
|
8
|
-
ACCESSIBILITY_PRIVATE = 'source.lang.swift.accessibility.private'
|
10
|
+
ACCESSIBILITY_PRIVATE = 'source.lang.swift.accessibility.private'
|
9
11
|
ACCESSIBILITY_FILEPRIVATE =
|
10
|
-
'source.lang.swift.accessibility.fileprivate'
|
11
|
-
ACCESSIBILITY_INTERNAL = 'source.lang.swift.accessibility.internal'
|
12
|
-
ACCESSIBILITY_PUBLIC = 'source.lang.swift.accessibility.public'
|
13
|
-
ACCESSIBILITY_OPEN = 'source.lang.swift.accessibility.open'
|
12
|
+
'source.lang.swift.accessibility.fileprivate'
|
13
|
+
ACCESSIBILITY_INTERNAL = 'source.lang.swift.accessibility.internal'
|
14
|
+
ACCESSIBILITY_PUBLIC = 'source.lang.swift.accessibility.public'
|
15
|
+
ACCESSIBILITY_OPEN = 'source.lang.swift.accessibility.open'
|
14
16
|
|
15
17
|
def initialize(accessibility)
|
16
18
|
@level = case accessibility
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'active_support/inflector'
|
2
4
|
|
3
5
|
module Jazzy
|
@@ -10,11 +12,24 @@ module Jazzy
|
|
10
12
|
|
11
13
|
attr_reader :kind
|
12
14
|
|
13
|
-
def initialize(kind)
|
15
|
+
def initialize(kind, declaration = nil)
|
16
|
+
kind = fixup_kind(kind, declaration) if declaration
|
14
17
|
@kind = kind
|
15
18
|
@type = TYPES[kind]
|
16
19
|
end
|
17
20
|
|
21
|
+
# Improve kind from full declaration
|
22
|
+
def fixup_kind(kind, declaration)
|
23
|
+
if kind == 'source.lang.swift.decl.class' &&
|
24
|
+
declaration.include?(
|
25
|
+
'<syntaxtype.keyword>actor</syntaxtype.keyword>',
|
26
|
+
)
|
27
|
+
'source.lang.swift.decl.actor'
|
28
|
+
else
|
29
|
+
kind
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
18
33
|
def dash_type
|
19
34
|
@type && @type[:dash]
|
20
35
|
end
|
@@ -113,7 +128,8 @@ module Jazzy
|
|
113
128
|
end
|
114
129
|
|
115
130
|
def swift_extensible?
|
116
|
-
kind =~
|
131
|
+
kind =~
|
132
|
+
/^source\.lang\.swift\.decl\.(class|struct|protocol|enum|actor)$/
|
117
133
|
end
|
118
134
|
|
119
135
|
def swift_protocol?
|
@@ -151,7 +167,7 @@ module Jazzy
|
|
151
167
|
Type.new('Overview')
|
152
168
|
end
|
153
169
|
|
154
|
-
MARKDOWN_KIND = 'document.markdown'
|
170
|
+
MARKDOWN_KIND = 'document.markdown'
|
155
171
|
|
156
172
|
def self.markdown
|
157
173
|
Type.new(MARKDOWN_KIND)
|
@@ -253,6 +269,11 @@ module Jazzy
|
|
253
269
|
dash: 'Struct',
|
254
270
|
global: true,
|
255
271
|
}.freeze,
|
272
|
+
'sourcekitten.source.lang.objc.decl.union' => {
|
273
|
+
jazzy: 'Union',
|
274
|
+
dash: 'Union',
|
275
|
+
global: true,
|
276
|
+
}.freeze,
|
256
277
|
'sourcekitten.source.lang.objc.decl.field' => {
|
257
278
|
jazzy: 'Field',
|
258
279
|
dash: 'Field',
|
@@ -267,6 +288,11 @@ module Jazzy
|
|
267
288
|
}.freeze,
|
268
289
|
|
269
290
|
# Swift
|
291
|
+
'source.lang.swift.decl.actor' => {
|
292
|
+
jazzy: 'Actor',
|
293
|
+
dash: 'Actor',
|
294
|
+
global: true,
|
295
|
+
}.freeze,
|
270
296
|
'source.lang.swift.decl.function.accessor.address' => {
|
271
297
|
jazzy: 'Addressor',
|
272
298
|
dash: 'Function',
|
@@ -1,8 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'jazzy/source_declaration/access_control_level'
|
2
4
|
require 'jazzy/source_declaration/type'
|
3
5
|
|
4
|
-
# rubocop:disable Metrics/ClassLength
|
5
6
|
module Jazzy
|
7
|
+
# rubocop:disable Metrics/ClassLength
|
6
8
|
class SourceDeclaration
|
7
9
|
# kind of declaration (e.g. class, variable, function)
|
8
10
|
attr_accessor :type
|
@@ -39,7 +41,7 @@ module Jazzy
|
|
39
41
|
attr_accessor :parent_in_docs
|
40
42
|
|
41
43
|
# counterpart of parent_in_docs
|
42
|
-
|
44
|
+
attr_reader :children
|
43
45
|
|
44
46
|
def children=(new_children)
|
45
47
|
# Freeze to ensure that parent_in_docs stays in sync
|
@@ -76,7 +78,7 @@ module Jazzy
|
|
76
78
|
# of the extended objc class and the category name itself, i.e.
|
77
79
|
# ["NSString", "MyMethods"], nil otherwise.
|
78
80
|
def objc_category_name
|
79
|
-
name.split(/[
|
81
|
+
name.split(/[()]/) if type.objc_category?
|
80
82
|
end
|
81
83
|
|
82
84
|
def swift_objc_extension?
|
@@ -136,6 +138,7 @@ module Jazzy
|
|
136
138
|
attr_accessor :unavailable_message
|
137
139
|
attr_accessor :generic_requirements
|
138
140
|
attr_accessor :inherited_types
|
141
|
+
attr_accessor :async
|
139
142
|
|
140
143
|
def usage_discouraged?
|
141
144
|
unavailable || deprecated
|
@@ -151,6 +154,7 @@ module Jazzy
|
|
151
154
|
# Workaround functions sharing names with
|
152
155
|
# different argument types (f(a:Int) vs. f(a:String))
|
153
156
|
return result unless type.swift_global_function?
|
157
|
+
|
154
158
|
result + "_#{type_usr}"
|
155
159
|
end
|
156
160
|
|
@@ -175,13 +179,24 @@ module Jazzy
|
|
175
179
|
# Is there at least one inherited type that is not in the given list?
|
176
180
|
def other_inherited_types?(unwanted)
|
177
181
|
return false unless inherited_types?
|
182
|
+
|
178
183
|
inherited_types.any? { |t| !unwanted.include?(t) }
|
179
184
|
end
|
180
185
|
|
181
|
-
# SourceKit only sets modulename for imported modules
|
186
|
+
# Pre-Swift 5.6: SourceKit only sets modulename for imported modules
|
187
|
+
# Swift 5.6+: modulename is always set
|
182
188
|
def type_from_doc_module?
|
183
189
|
!type.extension? ||
|
184
|
-
(swift? && usr &&
|
190
|
+
(swift? && usr &&
|
191
|
+
(modulename.nil? || modulename == Config.instance.module_name))
|
192
|
+
end
|
193
|
+
|
194
|
+
# Info text for contents page by collapsed item name
|
195
|
+
def declaration_note
|
196
|
+
notes = [default_impl_abstract ? 'default implementation' : nil,
|
197
|
+
from_protocol_extension ? 'extension method' : nil,
|
198
|
+
async ? 'asynchronous' : nil].compact
|
199
|
+
notes.join(', ').humanize unless notes.empty?
|
185
200
|
end
|
186
201
|
|
187
202
|
def alternative_abstract
|
@@ -201,7 +216,9 @@ module Jazzy
|
|
201
216
|
return [] unless
|
202
217
|
Config.instance.abstract_glob_configured &&
|
203
218
|
Config.instance.abstract_glob
|
219
|
+
|
204
220
|
Config.instance.abstract_glob.select { |e| File.file? e }
|
205
221
|
end
|
206
222
|
end
|
223
|
+
# rubocop:enable Metrics/ClassLength
|
207
224
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'pathname'
|
2
4
|
|
3
5
|
require 'jazzy/jazzy_markdown'
|
@@ -43,6 +45,7 @@ module Jazzy
|
|
43
45
|
|
44
46
|
def content(source_module)
|
45
47
|
return readme_content(source_module) if name == 'index'
|
48
|
+
|
46
49
|
overview
|
47
50
|
end
|
48
51
|
|
@@ -51,7 +54,7 @@ module Jazzy
|
|
51
54
|
end
|
52
55
|
|
53
56
|
def config_readme
|
54
|
-
readme_path.read if readme_path
|
57
|
+
readme_path.read if readme_path&.exist?
|
55
58
|
end
|
56
59
|
|
57
60
|
def fallback_readme
|
@@ -67,7 +70,7 @@ module Jazzy
|
|
67
70
|
### License
|
68
71
|
|
69
72
|
# <a href="#{license[:url]}">#{license[:license]}</a>
|
70
|
-
<<-
|
73
|
+
<<-README
|
71
74
|
# #{podspec.name}
|
72
75
|
|
73
76
|
### #{podspec.summary}
|
@@ -83,15 +86,15 @@ pod '#{podspec.name}'
|
|
83
86
|
### Authors
|
84
87
|
|
85
88
|
#{source_module.author_name}
|
86
|
-
|
89
|
+
README
|
87
90
|
else
|
88
|
-
<<-
|
91
|
+
<<-README
|
89
92
|
# #{source_module.name}
|
90
93
|
|
91
94
|
### Authors
|
92
95
|
|
93
96
|
#{source_module.author_name}
|
94
|
-
|
97
|
+
README
|
95
98
|
end
|
96
99
|
end
|
97
100
|
end
|
@@ -0,0 +1,111 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Jazzy
|
4
|
+
# Deal with different source code repositories
|
5
|
+
module SourceHost
|
6
|
+
# Factory to create the right source host
|
7
|
+
def self.create(options)
|
8
|
+
return unless options.source_host_url || options.source_host_files_url
|
9
|
+
|
10
|
+
case options.source_host
|
11
|
+
when :github then GitHub.new
|
12
|
+
when :gitlab then GitLab.new
|
13
|
+
when :bitbucket then BitBucket.new
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
# Use GitHub as the default behaviour.
|
18
|
+
class GitHub
|
19
|
+
include Config::Mixin
|
20
|
+
|
21
|
+
# Human readable name, appears in UI
|
22
|
+
def name
|
23
|
+
'GitHub'
|
24
|
+
end
|
25
|
+
|
26
|
+
# Jazzy extension with logo
|
27
|
+
def extension
|
28
|
+
name.downcase
|
29
|
+
end
|
30
|
+
|
31
|
+
# Logo image filename within extension
|
32
|
+
def image
|
33
|
+
'gh.png'
|
34
|
+
end
|
35
|
+
|
36
|
+
# URL to link to from logo
|
37
|
+
def url
|
38
|
+
config.source_host_url
|
39
|
+
end
|
40
|
+
|
41
|
+
# URL to link to from a SourceDeclaration.
|
42
|
+
# Compare using `realpath` because `item.file` comes out of
|
43
|
+
# SourceKit/etc.
|
44
|
+
def item_url(item)
|
45
|
+
return unless files_url && item.file
|
46
|
+
|
47
|
+
realpath = item.file.realpath
|
48
|
+
return unless realpath.to_path.start_with?(local_root_realpath)
|
49
|
+
|
50
|
+
path = realpath.relative_path_from(local_root_realpath)
|
51
|
+
fragment =
|
52
|
+
if item.start_line && (item.start_line != item.end_line)
|
53
|
+
item_url_multiline_fragment(item.start_line, item.end_line)
|
54
|
+
else
|
55
|
+
item_url_line_fragment(item.line)
|
56
|
+
end
|
57
|
+
|
58
|
+
"#{files_url}/#{path}##{fragment}"
|
59
|
+
end
|
60
|
+
|
61
|
+
private
|
62
|
+
|
63
|
+
def files_url
|
64
|
+
config.source_host_files_url
|
65
|
+
end
|
66
|
+
|
67
|
+
def local_root_realpath
|
68
|
+
@local_root_realpath ||= config.source_directory.realpath.to_path
|
69
|
+
end
|
70
|
+
|
71
|
+
# Source host's line numbering link scheme
|
72
|
+
def item_url_line_fragment(line)
|
73
|
+
"L#{line}"
|
74
|
+
end
|
75
|
+
|
76
|
+
def item_url_multiline_fragment(start_line, end_line)
|
77
|
+
"L#{start_line}-L#{end_line}"
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
# GitLab very similar to GitHub
|
82
|
+
class GitLab < GitHub
|
83
|
+
def name
|
84
|
+
'GitLab'
|
85
|
+
end
|
86
|
+
|
87
|
+
def image
|
88
|
+
'gitlab.svg'
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
# BitBucket has its own line number system
|
93
|
+
class BitBucket < GitHub
|
94
|
+
def name
|
95
|
+
'Bitbucket'
|
96
|
+
end
|
97
|
+
|
98
|
+
def image
|
99
|
+
'bitbucket.svg'
|
100
|
+
end
|
101
|
+
|
102
|
+
def item_url_line_fragment(line)
|
103
|
+
"lines-#{line}"
|
104
|
+
end
|
105
|
+
|
106
|
+
def item_url_multiline_fragment(start_line, end_line)
|
107
|
+
"lines-#{start_line}:#{end_line}"
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
data/lib/jazzy/source_mark.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Jazzy
|
2
4
|
class SourceMark
|
3
5
|
attr_accessor :name
|
@@ -8,24 +10,24 @@ module Jazzy
|
|
8
10
|
return unless mark_string
|
9
11
|
|
10
12
|
# Format: 'MARK: - NAME -' with dashes optional
|
11
|
-
mark_string.sub
|
13
|
+
mark_content = mark_string.sub(/^MARK: /, '')
|
12
14
|
|
13
|
-
if
|
15
|
+
if mark_content.empty?
|
14
16
|
# Empty
|
15
17
|
return
|
16
|
-
elsif
|
18
|
+
elsif mark_content == '-'
|
17
19
|
# Separator
|
18
20
|
self.has_start_dash = true
|
19
21
|
return
|
20
22
|
end
|
21
23
|
|
22
|
-
self.has_start_dash =
|
23
|
-
self.has_end_dash =
|
24
|
+
self.has_start_dash = mark_content.start_with?('- ')
|
25
|
+
self.has_end_dash = mark_content.end_with?(' -')
|
24
26
|
|
25
27
|
start_index = has_start_dash ? 2 : 0
|
26
28
|
end_index = has_end_dash ? -3 : -1
|
27
29
|
|
28
|
-
self.name =
|
30
|
+
self.name = mark_content[start_index..end_index]
|
29
31
|
end
|
30
32
|
|
31
33
|
def self.new_generic_requirements(requirements)
|
data/lib/jazzy/source_module.rb
CHANGED
@@ -1,32 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'uri'
|
2
4
|
|
3
5
|
require 'jazzy/config'
|
4
6
|
require 'jazzy/source_declaration'
|
7
|
+
require 'jazzy/source_host'
|
5
8
|
|
6
9
|
module Jazzy
|
7
10
|
class SourceModule
|
8
11
|
attr_accessor :name
|
9
|
-
attr_accessor :root_path
|
10
12
|
attr_accessor :docs
|
11
13
|
attr_accessor :doc_coverage
|
12
14
|
attr_accessor :doc_structure
|
13
15
|
attr_accessor :author_name
|
14
|
-
attr_accessor :github_url
|
15
|
-
attr_accessor :github_file_prefix
|
16
16
|
attr_accessor :author_url
|
17
17
|
attr_accessor :dash_url
|
18
|
+
attr_accessor :host
|
18
19
|
|
19
20
|
def initialize(options, docs, doc_structure, doc_coverage)
|
20
21
|
self.docs = docs
|
21
|
-
self.root_path = options.source_directory
|
22
22
|
self.doc_structure = doc_structure
|
23
23
|
self.doc_coverage = doc_coverage
|
24
24
|
self.name = options.module_name
|
25
25
|
self.author_name = options.author_name
|
26
|
-
self.github_url = options.github_url
|
27
|
-
self.github_file_prefix = options.github_file_prefix
|
28
26
|
self.author_url = options.author_url
|
27
|
+
self.host = SourceHost.create(options)
|
29
28
|
return unless options.dash_url
|
29
|
+
|
30
30
|
self.dash_url =
|
31
31
|
"dash-feed://#{ERB::Util.url_encode(options.dash_url.to_s)}"
|
32
32
|
end
|