jazzy 0.13.4 → 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/Tests.yml +52 -0
- data/.rubocop.yml +123 -24
- data/CHANGELOG.md +103 -0
- data/CONTRIBUTING.md +5 -5
- data/Dangerfile +11 -8
- data/Gemfile +3 -1
- data/Gemfile.lock +91 -69
- data/README.md +85 -13
- data/Rakefile +19 -13
- data/bin/jazzy +3 -2
- data/bin/sourcekitten +0 -0
- data/jazzy.gemspec +8 -6
- data/js/package-lock.json +30 -25
- data/js/package.json +3 -3
- data/lib/jazzy.rb +2 -0
- data/lib/jazzy/config.rb +124 -70
- data/lib/jazzy/doc.rb +3 -1
- data/lib/jazzy/doc_builder.rb +75 -81
- 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/extensions/katex/css/fonts/KaTeX_AMS-Regular.ttf +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_AMS-Regular.woff +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_AMS-Regular.woff2 +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Caligraphic-Bold.ttf +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Caligraphic-Bold.woff +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Caligraphic-Regular.ttf +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Caligraphic-Regular.woff +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Fraktur-Bold.ttf +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Fraktur-Bold.woff +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Fraktur-Regular.ttf +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Fraktur-Regular.woff +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Main-Bold.ttf +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Main-Bold.woff +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Main-Bold.woff2 +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Main-BoldItalic.ttf +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Main-BoldItalic.woff +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Main-Italic.ttf +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Main-Italic.woff +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Main-Italic.woff2 +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Main-Regular.ttf +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Main-Regular.woff +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Main-Regular.woff2 +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Math-BoldItalic.ttf +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Math-BoldItalic.woff +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Math-Italic.ttf +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Math-Italic.woff +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Math-Italic.woff2 +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_SansSerif-Bold.ttf +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_SansSerif-Bold.woff +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_SansSerif-Italic.ttf +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_SansSerif-Italic.woff +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_SansSerif-Regular.ttf +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_SansSerif-Regular.woff +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Script-Regular.ttf +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Script-Regular.woff +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Script-Regular.woff2 +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Size1-Regular.ttf +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Size1-Regular.woff +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Size1-Regular.woff2 +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Size2-Regular.ttf +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Size2-Regular.woff +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Size2-Regular.woff2 +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Size3-Regular.ttf +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Size3-Regular.woff +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Size3-Regular.woff2 +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Size4-Regular.ttf +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Size4-Regular.woff +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Size4-Regular.woff2 +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Typewriter-Regular.ttf +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Typewriter-Regular.woff +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
- 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 +3 -1
- data/lib/jazzy/highlighter.rb +5 -3
- data/lib/jazzy/jazzy_markdown.rb +101 -30
- data/lib/jazzy/podspec_documenter.rb +14 -16
- data/lib/jazzy/search_builder.rb +4 -3
- data/lib/jazzy/source_declaration.rb +24 -5
- data/lib/jazzy/source_declaration/access_control_level.rb +7 -5
- data/lib/jazzy/source_declaration/type.rb +33 -1
- 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 +105 -79
- data/lib/jazzy/stats.rb +4 -2
- data/lib/jazzy/symbol_graph.rb +95 -0
- data/lib/jazzy/symbol_graph/constraint.rb +98 -0
- data/lib/jazzy/symbol_graph/ext_node.rb +116 -0
- data/lib/jazzy/symbol_graph/graph.rb +195 -0
- data/lib/jazzy/symbol_graph/relationship.rb +42 -0
- data/lib/jazzy/symbol_graph/sym_node.rb +163 -0
- data/lib/jazzy/symbol_graph/symbol.rb +222 -0
- data/lib/jazzy/themes/apple/assets/css/highlight.css.scss +63 -59
- data/lib/jazzy/themes/apple/assets/css/jazzy.css.scss +101 -4
- data/lib/jazzy/themes/apple/assets/img/spinner.gif +0 -0
- data/lib/jazzy/themes/apple/assets/js/jazzy.js +4 -0
- data/lib/jazzy/themes/apple/assets/js/jazzy.search.js +74 -0
- data/lib/jazzy/themes/apple/assets/js/jquery.min.js +2 -2
- data/lib/jazzy/themes/apple/assets/js/lunr.min.js +6 -0
- data/lib/jazzy/themes/apple/assets/js/typeahead.jquery.js +1694 -0
- data/lib/jazzy/themes/apple/templates/doc.mustache +35 -0
- data/lib/jazzy/themes/apple/templates/footer.mustache +1 -1
- data/lib/jazzy/themes/apple/templates/header.mustache +10 -3
- data/lib/jazzy/themes/apple/templates/task.mustache +4 -4
- data/lib/jazzy/themes/fullwidth/assets/css/highlight.css.scss +63 -59
- data/lib/jazzy/themes/fullwidth/assets/css/jazzy.css.scss +11 -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/assets/js/jquery.min.js +2 -2
- data/lib/jazzy/themes/fullwidth/assets/js/lunr.min.js +3 -3
- data/lib/jazzy/themes/fullwidth/templates/doc.mustache +30 -0
- data/lib/jazzy/themes/fullwidth/templates/footer.mustache +1 -1
- data/lib/jazzy/themes/fullwidth/templates/header.mustache +5 -5
- data/lib/jazzy/themes/fullwidth/templates/task.mustache +4 -4
- data/lib/jazzy/themes/jony/assets/css/highlight.css.scss +63 -59
- data/lib/jazzy/themes/jony/assets/css/jazzy.css.scss +34 -2
- data/lib/jazzy/themes/jony/assets/js/jazzy.js +4 -0
- data/lib/jazzy/themes/jony/assets/js/jquery.min.js +2 -2
- data/lib/jazzy/themes/jony/templates/doc.mustache +30 -0
- data/lib/jazzy/themes/jony/templates/footer.mustache +1 -1
- data/lib/jazzy/themes/jony/templates/header.mustache +5 -5
- data/lib/jazzy/themes/jony/templates/task.mustache +4 -4
- data/spec/integration_spec.rb +54 -42
- data/spec/spec_helper.rb +3 -1
- data/spec/spec_helper/pre_flight.rb +2 -0
- metadata +43 -19
- data/.circleci/config.yml +0 -83
- 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,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
|
@@ -11,7 +13,9 @@ module Jazzy
|
|
11
13
|
|
12
14
|
# Give the item its own page or just inline into parent?
|
13
15
|
def render_as_page?
|
14
|
-
children.any?
|
16
|
+
children.any? ||
|
17
|
+
(Config.instance.separate_global_declarations &&
|
18
|
+
type.global?)
|
15
19
|
end
|
16
20
|
|
17
21
|
def swift?
|
@@ -25,7 +29,8 @@ module Jazzy
|
|
25
29
|
# When referencing this item from its parent category,
|
26
30
|
# include the content or just link to it directly?
|
27
31
|
def omit_content_from_parent?
|
28
|
-
|
32
|
+
Config.instance.separate_global_declarations &&
|
33
|
+
render_as_page?
|
29
34
|
end
|
30
35
|
|
31
36
|
# Element containing this declaration in the code
|
@@ -36,7 +41,7 @@ module Jazzy
|
|
36
41
|
attr_accessor :parent_in_docs
|
37
42
|
|
38
43
|
# counterpart of parent_in_docs
|
39
|
-
|
44
|
+
attr_reader :children
|
40
45
|
|
41
46
|
def children=(new_children)
|
42
47
|
# Freeze to ensure that parent_in_docs stays in sync
|
@@ -73,7 +78,7 @@ module Jazzy
|
|
73
78
|
# of the extended objc class and the category name itself, i.e.
|
74
79
|
# ["NSString", "MyMethods"], nil otherwise.
|
75
80
|
def objc_category_name
|
76
|
-
name.split(/[
|
81
|
+
name.split(/[()]/) if type.objc_category?
|
77
82
|
end
|
78
83
|
|
79
84
|
def swift_objc_extension?
|
@@ -108,6 +113,7 @@ module Jazzy
|
|
108
113
|
attr_accessor :line
|
109
114
|
attr_accessor :column
|
110
115
|
attr_accessor :usr
|
116
|
+
attr_accessor :type_usr
|
111
117
|
attr_accessor :modulename
|
112
118
|
attr_accessor :name
|
113
119
|
attr_accessor :objc_name
|
@@ -141,6 +147,16 @@ module Jazzy
|
|
141
147
|
CGI.unescape(url)
|
142
148
|
end
|
143
149
|
|
150
|
+
# Base filename (no extension) for the item
|
151
|
+
def docs_filename
|
152
|
+
result = url_name || name
|
153
|
+
# Workaround functions sharing names with
|
154
|
+
# different argument types (f(a:Int) vs. f(a:String))
|
155
|
+
return result unless type.swift_global_function?
|
156
|
+
|
157
|
+
result + "_#{type_usr}"
|
158
|
+
end
|
159
|
+
|
144
160
|
def constrained_extension?
|
145
161
|
type.swift_extension? &&
|
146
162
|
generic_requirements
|
@@ -162,6 +178,7 @@ module Jazzy
|
|
162
178
|
# Is there at least one inherited type that is not in the given list?
|
163
179
|
def other_inherited_types?(unwanted)
|
164
180
|
return false unless inherited_types?
|
181
|
+
|
165
182
|
inherited_types.any? { |t| !unwanted.include?(t) }
|
166
183
|
end
|
167
184
|
|
@@ -188,7 +205,9 @@ module Jazzy
|
|
188
205
|
return [] unless
|
189
206
|
Config.instance.abstract_glob_configured &&
|
190
207
|
Config.instance.abstract_glob
|
208
|
+
|
191
209
|
Config.instance.abstract_glob.select { |e| File.file? e }
|
192
210
|
end
|
193
211
|
end
|
212
|
+
# rubocop:enable Metrics/ClassLength
|
194
213
|
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
|
@@ -23,6 +25,12 @@ module Jazzy
|
|
23
25
|
@type && @type[:jazzy]
|
24
26
|
end
|
25
27
|
|
28
|
+
# kinds that are 'global' and should get their own pages
|
29
|
+
# with --separate-global-declarations
|
30
|
+
def global?
|
31
|
+
@type && @type[:global]
|
32
|
+
end
|
33
|
+
|
26
34
|
# name to use for type subdirectory in URLs for back-compatibility
|
27
35
|
def url_name
|
28
36
|
@type && (@type[:url] || @type[:jazzy])
|
@@ -118,6 +126,10 @@ module Jazzy
|
|
118
126
|
kind == 'source.lang.swift.decl.typealias'
|
119
127
|
end
|
120
128
|
|
129
|
+
def swift_global_function?
|
130
|
+
kind == 'source.lang.swift.decl.function.free'
|
131
|
+
end
|
132
|
+
|
121
133
|
def param?
|
122
134
|
# SourceKit strangely categorizes initializer parameters as local
|
123
135
|
# variables, so both kinds represent a parameter in jazzy.
|
@@ -141,7 +153,7 @@ module Jazzy
|
|
141
153
|
Type.new('Overview')
|
142
154
|
end
|
143
155
|
|
144
|
-
MARKDOWN_KIND = 'document.markdown'
|
156
|
+
MARKDOWN_KIND = 'document.markdown'
|
145
157
|
|
146
158
|
def self.markdown
|
147
159
|
Type.new(MARKDOWN_KIND)
|
@@ -180,19 +192,23 @@ module Jazzy
|
|
180
192
|
'sourcekitten.source.lang.objc.decl.category' => {
|
181
193
|
jazzy: 'Category',
|
182
194
|
dash: 'Extension',
|
195
|
+
global: true,
|
183
196
|
}.freeze,
|
184
197
|
'sourcekitten.source.lang.objc.decl.class' => {
|
185
198
|
jazzy: 'Class',
|
186
199
|
dash: 'Class',
|
200
|
+
global: true,
|
187
201
|
}.freeze,
|
188
202
|
'sourcekitten.source.lang.objc.decl.constant' => {
|
189
203
|
jazzy: 'Constant',
|
190
204
|
dash: 'Constant',
|
205
|
+
global: true,
|
191
206
|
}.freeze,
|
192
207
|
'sourcekitten.source.lang.objc.decl.enum' => {
|
193
208
|
jazzy: 'Enumeration',
|
194
209
|
url: 'Enum',
|
195
210
|
dash: 'Enum',
|
211
|
+
global: true,
|
196
212
|
}.freeze,
|
197
213
|
'sourcekitten.source.lang.objc.decl.enumcase' => {
|
198
214
|
jazzy: 'Enumeration Case',
|
@@ -217,10 +233,12 @@ module Jazzy
|
|
217
233
|
'sourcekitten.source.lang.objc.decl.protocol' => {
|
218
234
|
jazzy: 'Protocol',
|
219
235
|
dash: 'Protocol',
|
236
|
+
global: true,
|
220
237
|
}.freeze,
|
221
238
|
'sourcekitten.source.lang.objc.decl.typedef' => {
|
222
239
|
jazzy: 'Type Definition',
|
223
240
|
dash: 'Type',
|
241
|
+
global: true,
|
224
242
|
}.freeze,
|
225
243
|
'sourcekitten.source.lang.objc.mark' => {
|
226
244
|
jazzy: 'Mark',
|
@@ -229,11 +247,13 @@ module Jazzy
|
|
229
247
|
'sourcekitten.source.lang.objc.decl.function' => {
|
230
248
|
jazzy: 'Function',
|
231
249
|
dash: 'Function',
|
250
|
+
global: true,
|
232
251
|
}.freeze,
|
233
252
|
'sourcekitten.source.lang.objc.decl.struct' => {
|
234
253
|
jazzy: 'Structure',
|
235
254
|
url: 'Struct',
|
236
255
|
dash: 'Struct',
|
256
|
+
global: true,
|
237
257
|
}.freeze,
|
238
258
|
'sourcekitten.source.lang.objc.decl.field' => {
|
239
259
|
jazzy: 'Field',
|
@@ -300,6 +320,7 @@ module Jazzy
|
|
300
320
|
'source.lang.swift.decl.class' => {
|
301
321
|
jazzy: 'Class',
|
302
322
|
dash: 'Class',
|
323
|
+
global: true,
|
303
324
|
}.freeze,
|
304
325
|
'source.lang.swift.decl.function.constructor' => {
|
305
326
|
jazzy: 'Initializer',
|
@@ -312,6 +333,7 @@ module Jazzy
|
|
312
333
|
'source.lang.swift.decl.var.global' => {
|
313
334
|
jazzy: 'Global Variable',
|
314
335
|
dash: 'Global',
|
336
|
+
global: true,
|
315
337
|
}.freeze,
|
316
338
|
'source.lang.swift.decl.enumcase' => {
|
317
339
|
jazzy: 'Enumeration Case',
|
@@ -325,30 +347,37 @@ module Jazzy
|
|
325
347
|
jazzy: 'Enumeration',
|
326
348
|
url: 'Enum',
|
327
349
|
dash: 'Enum',
|
350
|
+
global: true,
|
328
351
|
}.freeze,
|
329
352
|
'source.lang.swift.decl.extension' => {
|
330
353
|
jazzy: 'Extension',
|
331
354
|
dash: 'Extension',
|
355
|
+
global: true,
|
332
356
|
}.freeze,
|
333
357
|
'source.lang.swift.decl.extension.class' => {
|
334
358
|
jazzy: 'Class Extension',
|
335
359
|
dash: 'Extension',
|
360
|
+
global: true,
|
336
361
|
}.freeze,
|
337
362
|
'source.lang.swift.decl.extension.enum' => {
|
338
363
|
jazzy: 'Enumeration Extension',
|
339
364
|
dash: 'Extension',
|
365
|
+
global: true,
|
340
366
|
}.freeze,
|
341
367
|
'source.lang.swift.decl.extension.protocol' => {
|
342
368
|
jazzy: 'Protocol Extension',
|
343
369
|
dash: 'Extension',
|
370
|
+
global: true,
|
344
371
|
}.freeze,
|
345
372
|
'source.lang.swift.decl.extension.struct' => {
|
346
373
|
jazzy: 'Structure Extension',
|
347
374
|
dash: 'Extension',
|
375
|
+
global: true,
|
348
376
|
}.freeze,
|
349
377
|
'source.lang.swift.decl.function.free' => {
|
350
378
|
jazzy: 'Function',
|
351
379
|
dash: 'Function',
|
380
|
+
global: true,
|
352
381
|
}.freeze,
|
353
382
|
'source.lang.swift.decl.function.method.instance' => {
|
354
383
|
jazzy: 'Instance Method',
|
@@ -369,6 +398,7 @@ module Jazzy
|
|
369
398
|
'source.lang.swift.decl.protocol' => {
|
370
399
|
jazzy: 'Protocol',
|
371
400
|
dash: 'Protocol',
|
401
|
+
global: true,
|
372
402
|
}.freeze,
|
373
403
|
'source.lang.swift.decl.function.method.static' => {
|
374
404
|
jazzy: 'Static Method',
|
@@ -382,6 +412,7 @@ module Jazzy
|
|
382
412
|
jazzy: 'Structure',
|
383
413
|
url: 'Struct',
|
384
414
|
dash: 'Struct',
|
415
|
+
global: true,
|
385
416
|
}.freeze,
|
386
417
|
'source.lang.swift.decl.function.subscript' => {
|
387
418
|
jazzy: 'Subscript',
|
@@ -391,6 +422,7 @@ module Jazzy
|
|
391
422
|
jazzy: 'Type Alias',
|
392
423
|
url: 'Typealias',
|
393
424
|
dash: 'Alias',
|
425
|
+
global: true,
|
394
426
|
}.freeze,
|
395
427
|
'source.lang.swift.decl.generic_type_param' => {
|
396
428
|
jazzy: 'Generic Type Parameter',
|
@@ -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)
|