jazzy 0.8.3 → 0.8.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9b6c8d617080bf1a2a5d1930f3c63c630da8869e
4
- data.tar.gz: 558a557588f533343725d3efc06cf7c00d25e241
3
+ metadata.gz: 521ac7a49708dd60f61fd8a5be45a0cabeadab01
4
+ data.tar.gz: d92a5318703bcdc5b70a30b02147c1b6318a5207
5
5
  SHA512:
6
- metadata.gz: 22f290f2559756550a4122c9338528d6d0b9a21a66f5d4f2906e1f35d0c8f7f20d3ecc2285a88a900619d5d17170fb70548ed971de1bde3d08045b5ab026392d
7
- data.tar.gz: 87ac65fd0994caf9229c76d6c68e837b0fa167863d213a33834be1c16f6d8212703fcce5ca2d8219a9573407432447aaf9597beead518877b67235c6b5a3d1ad
6
+ metadata.gz: 4fbcffeba3be993af19ca581792fc18c2cef463df918ab0f0f7f5f76b04a09494d7dd7066c1b4a3a3125102178660cc4278f985d2becf2c9974eb32340c14004
7
+ data.tar.gz: 54f4db86a1b320ec74f98992c26757a4dc5fdd25e350942678d51bc0b15ab6910e6b0d2e3a8f5bd2d2f2eb172244039233ecbdf255c5bfecf0e1bd0ba6aa64f7
@@ -1,3 +1,36 @@
1
+ ## 0.8.4
2
+
3
+ ##### Breaking
4
+
5
+ * None.
6
+
7
+ ##### Enhancements
8
+
9
+ * Align jazzy terminology with Apple usage.
10
+ [Xiaodi Wu](https://github.com/xwu)
11
+ [John Fairhurst](https://github.com/johnfairh)
12
+
13
+ * Add `url` attribute that can be more accurate than `{{section}}.html` as a URL
14
+ in custom templates.
15
+ [John Fairhurst](https://github.com/johnfairh)
16
+
17
+ ##### Bug Fixes
18
+
19
+ * Fix crash when specifying `swift_version` as a floating point value in
20
+ `.jazzy.yaml` rather than a string.
21
+ [JP Simard](https://github.com/jpsim)
22
+ [#860](https://github.com/realm/jazzy/issues/860)
23
+
24
+ * Autolink from parameter documentation and from external markdown documents
25
+ including README. Autolink to symbols containing & < >.
26
+ [John Fairhurst](https://github.com/johnfairh)
27
+ [#715](https://github.com/realm/jazzy/issues/715)
28
+ [#789](https://github.com/realm/jazzy/issues/789)
29
+ [#805](https://github.com/realm/jazzy/issues/805)
30
+
31
+ * Fix Swift 4 declarations containing ampersands (`&`) being truncated.
32
+ [JP Simard](https://github.com/jpsim)
33
+
1
34
  ## 0.8.3
2
35
 
3
36
  ##### Breaking
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jazzy (0.8.3)
4
+ jazzy (0.8.4)
5
5
  cocoapods (~> 1.0)
6
6
  mustache (~> 0.99)
7
7
  open4
@@ -15,7 +15,7 @@ GEM
15
15
  remote: https://rubygems.org/
16
16
  specs:
17
17
  CFPropertyList (2.3.5)
18
- activesupport (4.2.8)
18
+ activesupport (4.2.9)
19
19
  i18n (~> 0.7)
20
20
  minitest (~> 5.1)
21
21
  thread_safe (~> 0.3, >= 0.3.4)
@@ -88,16 +88,17 @@ GEM
88
88
  multipart-post (>= 1.2, < 3)
89
89
  faraday-http-cache (1.3.1)
90
90
  faraday (~> 0.8)
91
+ ffi (1.9.18)
91
92
  fourflusher (2.0.1)
92
93
  fuzzy_match (2.0.4)
93
94
  gh_inspector (1.0.3)
94
95
  git (1.3.0)
95
96
  hashdiff (0.3.4)
96
- i18n (0.8.1)
97
+ i18n (0.8.6)
97
98
  kramdown (1.13.2)
98
99
  liferaft (0.0.6)
99
100
  metaclass (0.0.4)
100
- minitest (5.10.2)
101
+ minitest (5.10.3)
101
102
  mocha (1.2.1)
102
103
  metaclass (~> 0.0.1)
103
104
  mocha-on-bacon (0.2.3)
@@ -120,6 +121,9 @@ GEM
120
121
  rainbow (2.2.2)
121
122
  rake
122
123
  rake (10.5.0)
124
+ rb-fsevent (0.10.2)
125
+ rb-inotify (0.9.10)
126
+ ffi (>= 0.5.0, < 2)
123
127
  redcarpet (3.4.0)
124
128
  rouge (1.11.1)
125
129
  rubocop (0.48.1)
@@ -131,7 +135,11 @@ GEM
131
135
  ruby-macho (1.1.0)
132
136
  ruby-progressbar (1.8.1)
133
137
  safe_yaml (1.0.4)
134
- sass (3.4.24)
138
+ sass (3.5.1)
139
+ sass-listen (~> 4.0.0)
140
+ sass-listen (4.0.0)
141
+ rb-fsevent (~> 0.9, >= 0.9.4)
142
+ rb-inotify (~> 0.9, >= 0.9.7)
135
143
  sawyer (0.8.1)
136
144
  addressable (>= 2.3.5, < 2.6)
137
145
  faraday (~> 0.8, < 1.0)
@@ -172,4 +180,4 @@ DEPENDENCIES
172
180
  webmock
173
181
 
174
182
  BUNDLED WITH
175
- 1.14.6
183
+ 1.15.4
data/README.md CHANGED
@@ -49,12 +49,22 @@ all available options, run `jazzy --help config`.
49
49
 
50
50
  ### Supported keywords
51
51
 
52
- Swift header documentation is written in markdown and supports a number of special keywords.
53
- For a complete list and examples, see Erica Sadun's post on [*Swift header documentation in Xcode 7*](http://ericasadun.com/2015/06/14/swift-header-documentation-in-xcode-7/)
54
- and her [book on Swift Documentation Markup](https://itunes.apple.com/us/book/swift-documentation-markup/id1049010423).
52
+ Swift documentation is written in markdown and supports a number of special keywords.
53
+ For a complete list and examples, see Erica Sadun's post on [*Swift header documentation in Xcode 7*](http://ericasadun.com/2015/06/14/swift-header-documentation-in-xcode-7/),
54
+ her [book on Swift Documentation Markup](https://itunes.apple.com/us/book/swift-documentation-markup/id1049010423), and the [Xcode Markup Formatting Reference](https://developer.apple.com/library/content/documentation/Xcode/Reference/xcode_markup_formatting_ref/).
55
55
 
56
56
  For Objective-C documentation the same keywords are supported, but note that the format
57
- is slightly different. In Swift you would write `- returns:`, but in Objective-C you write `@return`. See Apple's [*HeaderDoc User Guide*](https://developer.apple.com/legacy/library/documentation/DeveloperTools/Conceptual/HeaderDoc/tags/tags.html) for more details. **Note: `jazzy` currently does not support _all_ Objective-C keywords listed in this document.**
57
+ is slightly different. In Swift you would write `- returns:`, but in Objective-C you write `@return`. See Apple's [*HeaderDoc User Guide*](https://developer.apple.com/legacy/library/documentation/DeveloperTools/Conceptual/HeaderDoc/tags/tags.html) for more details. **Note: `jazzy` currently does not support _all_ Objective-C keywords listed in this document, only @param, @return, @warning, @see, and @note.**
58
+
59
+ Jazzy can also generate cross-references within your documentation. A symbol name in
60
+ backticks generates a link, for example:
61
+ * \`MyClass\` - a link to documentation for `MyClass`.
62
+ * \`MyClass.method(param1:)\` - a link to documentation for that method.
63
+ * \`MyClass.method(...)\` - shortcut syntax for the same thing.
64
+ * \`method(...)\` - shortcut syntax to link to `method` from the documentation of another
65
+ method or property in the same class.
66
+ * \`[MyClass method1]\` - a link to an Objective-C method.
67
+ * \`-[MyClass method2:param1]\` - a link to another Objective-C method.
58
68
 
59
69
  ### Swift
60
70
 
@@ -171,15 +181,40 @@ This is very helpful when using `custom_categories` for grouping types and inclu
171
181
 
172
182
  For an example of a project using both `--documentation` and `--abstract` see: [http://reswift.github.io/ReSwift/](http://reswift.github.io/ReSwift/)
173
183
 
184
+ ### Controlling what is documented
185
+
186
+ In Swift mode, Jazzy by default documents only `public` and `open` declarations. To
187
+ include declarations with a lower access level, set the `--min-acl` flag to `internal`,
188
+ `fileprivate`, or `private`.
189
+
190
+ In Objective-C mode, Jazzy documents all declarations found in the `--umbrella-header`
191
+ header file and any other header files included by it.
192
+
193
+ You can then prevent some of these declarations from being documented using `--exclude`
194
+ or `:nodoc:`.
195
+
196
+ The `--exclude` flag lists source files to omit from the documentation. Entries in the
197
+ list can be absolute pathnames beginning with `/` or relative pathnames. Relative
198
+ pathnames are interpreted relative to the directory from where you run `jazzy` or, if the
199
+ exclude flag is set in the config file, relative to the directory containing the config
200
+ file. Entries in the list can match multiple files using `*` to match any number of
201
+ characters including `/`. For example:
202
+ * `jazzy --exclude=/Users/fred/project/Sources/Secret.swift` -- exclude a specific file
203
+ * `jazzy --exclude=/*/Internal*` -- exclude all files with names that begin with *Internal*
204
+ and any files under any directory with a name beginning *Internal*.
205
+ * `jazzy --exclude=Impl1/*,Impl2/*` -- exclude all files under the directories *Impl1* and
206
+ *Impl2* found in the current directory.
207
+
208
+ Declarations with a documentation comment containing `:nodoc:` are excluded from the
209
+ documentation.
210
+
174
211
  ## Troubleshooting
175
212
 
176
213
  #### Swift
177
214
 
178
215
  **Only extensions are listed in the documentation?**
179
216
 
180
- By default, `jazzy` only documents public declarations. To generate documentation
181
- for declarations with a lower accessibility level (`internal` or `private`), please
182
- set the `--min-acl` flag to `internal` or `private`.
217
+ Check the `--min-acl` setting -- see [above](#controlling-what-is-documented).
183
218
 
184
219
  ## Development
185
220
 
Binary file
data/circle.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  machine:
2
2
  xcode:
3
- version: "8.3.2"
3
+ version: "9.0"
4
4
 
5
5
  checkout:
6
6
  post:
@@ -150,8 +150,8 @@ module Jazzy
150
150
  parse: ->(sd) { expand_path(sd) }
151
151
 
152
152
  config_attr :excluded_files,
153
- command_line: ['-e', '--exclude file1,file2,directory3,…fileN', Array],
154
- description: 'Files/directories to be excluded from documentation. '\
153
+ command_line: ['-e', '--exclude filepath1,filepath2,…filepathN', Array],
154
+ description: 'Source file pathnames to be excluded from documentation. '\
155
155
  'Supports wildcards.',
156
156
  default: [],
157
157
  parse: ->(files) do
@@ -162,7 +162,7 @@ module Jazzy
162
162
  command_line: '--swift-version VERSION',
163
163
  default: nil,
164
164
  parse: ->(v) do
165
- return nil if v.empty?
165
+ return nil if v.to_s.empty?
166
166
  raise 'jazzy only supports Swift 2.0 or later.' if v.to_f < 2
167
167
  v
168
168
  end
@@ -46,6 +46,7 @@ module Jazzy
46
46
  end
47
47
  {
48
48
  section: doc.name,
49
+ url: doc.url,
49
50
  children: children,
50
51
  }
51
52
  end
@@ -208,6 +209,11 @@ module Jazzy
208
209
  end
209
210
  end
210
211
 
212
+ def self.render(doc_model, markdown)
213
+ html = Markdown.render(markdown)
214
+ SourceKitten.autolink_document(html, doc_model)
215
+ end
216
+
211
217
  # Build Mustache document from a markdown source file
212
218
  # @param [Config] options Build options
213
219
  # @param [Hash] doc_model Parsed doc. @see SourceKitten.parse
@@ -218,7 +224,7 @@ module Jazzy
218
224
  doc = Doc.new # Mustache model instance
219
225
  name = doc_model.name == 'index' ? source_module.name : doc_model.name
220
226
  doc[:name] = name
221
- doc[:overview] = Markdown.render(doc_model.content(source_module))
227
+ doc[:overview] = render(doc_model, doc_model.content(source_module))
222
228
  doc[:custom_head] = Config.instance.custom_head
223
229
  doc[:disable_search] = Config.instance.disable_search
224
230
  doc[:doc_coverage] = source_module.doc_coverage unless
@@ -230,7 +236,7 @@ module Jazzy
230
236
  doc[:dash_url] = source_module.dash_url
231
237
  doc[:path_to_root] = path_to_root
232
238
  doc[:hide_name] = true
233
- doc.render
239
+ doc.render.gsub(ELIDED_AUTOLINK_TOKEN, path_to_root)
234
240
  end
235
241
 
236
242
  # Returns the appropriate color for the provided percentage,
@@ -365,7 +371,7 @@ module Jazzy
365
371
  overview = (doc_model.abstract || '') + (doc_model.discussion || '')
366
372
  alternative_abstract = doc_model.alternative_abstract
367
373
  if alternative_abstract
368
- overview = Markdown.render(alternative_abstract) + overview
374
+ overview = render(doc_model, alternative_abstract) + overview
369
375
  end
370
376
 
371
377
  doc = Doc.new # Mustache model instance
@@ -1,3 +1,3 @@
1
1
  module Jazzy
2
- VERSION = '0.8.3'.freeze unless defined? Jazzy::VERSION
2
+ VERSION = '0.8.4'.freeze unless defined? Jazzy::VERSION
3
3
  end
@@ -2,6 +2,7 @@ require 'tmpdir'
2
2
  require 'json'
3
3
 
4
4
  module Jazzy
5
+ # rubocop:disable Metrics/ClassLength
5
6
  class PodspecDocumenter
6
7
  attr_reader :podspec
7
8
 
@@ -14,7 +15,8 @@ module Jazzy
14
15
  def sourcekitten_output(config)
15
16
  installation_root = Pathname(Dir.mktmpdir(['jazzy', podspec.name]))
16
17
  installation_root.rmtree if installation_root.exist?
17
- Pod::Config.instance.with_changes(installation_root: installation_root) do
18
+ Pod::Config.instance.with_changes(installation_root: installation_root,
19
+ verbose: false) do
18
20
  sandbox = Pod::Sandbox.new(Pod::Config.instance.sandbox_root)
19
21
  installer = Pod::Installer.new(sandbox, podfile)
20
22
  installer.install!
@@ -25,7 +27,7 @@ module Jazzy
25
27
 
26
28
  targets.map do |t|
27
29
  args = %W[doc --module-name #{podspec.module_name} -- -target #{t}]
28
- swift_version = (config.swift_version || '3')[0] + '.0'
30
+ swift_version = (config.swift_version || '4')[0] + '.0'
29
31
  args << "SWIFT_VERSION=\"#{swift_version}\""
30
32
  SourceKitten.run_sourcekitten(args)
31
33
  end
@@ -117,8 +119,12 @@ module Jazzy
117
119
  ss.available_platforms.each do |p|
118
120
  # Travis builds take too long when building docs for all available
119
121
  # platforms for the Moya integration spec, so we just document OSX.
122
+ # Also Moya's RxSwift subspec doesn't yet support Swift 4, so skip
123
+ # that too while we're at it.
120
124
  # TODO: remove once jazzy is fast enough.
121
- next if ENV['JAZZY_INTEGRATION_SPECS'] && p.name != :osx
125
+ if ENV['JAZZY_INTEGRATION_SPECS']
126
+ next if (p.name != :osx) || (ss.name == 'Moya/RxSwift')
127
+ end
122
128
  target("Jazzy-#{ss.name.gsub('/', '__')}-#{p.name}") do
123
129
  use_frameworks!
124
130
  platform p.name, p.deployment_target
@@ -76,6 +76,7 @@ module Jazzy
76
76
  attr_accessor :start_line
77
77
  attr_accessor :end_line
78
78
  attr_accessor :nav_order
79
+ attr_accessor :url_name
79
80
 
80
81
  def alternative_abstract
81
82
  if file = alternative_abstract_file
@@ -85,7 +86,8 @@ module Jazzy
85
86
 
86
87
  def alternative_abstract_file
87
88
  abstract_glob.select do |f|
88
- File.basename(f).split('.').first == name
89
+ # allow Structs.md or Structures.md
90
+ [name, url_name].include?(File.basename(f).split('.').first)
89
91
  end.first
90
92
  end
91
93
 
@@ -23,6 +23,11 @@ module Jazzy
23
23
  @type && @type[:jazzy]
24
24
  end
25
25
 
26
+ # name to use for type subdirectory in URLs for back-compatibility
27
+ def url_name
28
+ @type && (@type[:url] || @type[:jazzy])
29
+ end
30
+
26
31
  def name_controlled_manually?
27
32
  !kind.start_with?('source')
28
33
  # "'source'.lang..." for Swift
@@ -34,6 +39,10 @@ module Jazzy
34
39
  name.pluralize
35
40
  end
36
41
 
42
+ def plural_url_name
43
+ url_name.pluralize
44
+ end
45
+
37
46
  def mark?
38
47
  kind == 'source.lang.swift.syntaxtype.comment.mark' ||
39
48
  kind == 'sourcekitten.source.lang.objc.mark'
@@ -137,11 +146,12 @@ module Jazzy
137
146
  dash: 'Constant',
138
147
  }.freeze,
139
148
  'sourcekitten.source.lang.objc.decl.enum' => {
140
- jazzy: 'Enum',
149
+ jazzy: 'Enumeration',
150
+ url: 'Enum',
141
151
  dash: 'Enum',
142
152
  }.freeze,
143
153
  'sourcekitten.source.lang.objc.decl.enumcase' => {
144
- jazzy: 'Enum Case',
154
+ jazzy: 'Enumeration Case',
145
155
  dash: 'Case',
146
156
  }.freeze,
147
157
  'sourcekitten.source.lang.objc.decl.initializer' => {
@@ -177,7 +187,8 @@ module Jazzy
177
187
  dash: 'Function',
178
188
  }.freeze,
179
189
  'sourcekitten.source.lang.objc.decl.struct' => {
180
- jazzy: 'Struct',
190
+ jazzy: 'Structure',
191
+ url: 'Struct',
181
192
  dash: 'Struct',
182
193
  }.freeze,
183
194
  'sourcekitten.source.lang.objc.decl.field' => {
@@ -185,7 +196,7 @@ module Jazzy
185
196
  dash: 'Field',
186
197
  }.freeze,
187
198
  'sourcekitten.source.lang.objc.decl.ivar' => {
188
- jazzy: 'Ivar',
199
+ jazzy: 'Instance Variable',
189
200
  dash: 'Ivar',
190
201
  }.freeze,
191
202
  'sourcekitten.source.lang.objc.module.import' => {
@@ -195,27 +206,27 @@ module Jazzy
195
206
 
196
207
  # Swift
197
208
  'source.lang.swift.decl.function.accessor.address' => {
198
- jazzy: 'Address Accessor',
209
+ jazzy: 'Addressor',
199
210
  dash: 'Function',
200
211
  }.freeze,
201
212
  'source.lang.swift.decl.function.accessor.didset' => {
202
- jazzy: 'DidSet Accessor',
213
+ jazzy: 'didSet Observer',
203
214
  dash: 'Function',
204
215
  }.freeze,
205
216
  'source.lang.swift.decl.function.accessor.getter' => {
206
- jazzy: 'Getter Accessor',
217
+ jazzy: 'Getter',
207
218
  dash: 'Function',
208
219
  }.freeze,
209
220
  'source.lang.swift.decl.function.accessor.mutableaddress' => {
210
- jazzy: 'Mutable Address Accessor',
221
+ jazzy: 'Mutable Addressor',
211
222
  dash: 'Function',
212
223
  }.freeze,
213
224
  'source.lang.swift.decl.function.accessor.setter' => {
214
- jazzy: 'Setter Accessor',
225
+ jazzy: 'Setter',
215
226
  dash: 'Function',
216
227
  }.freeze,
217
228
  'source.lang.swift.decl.function.accessor.willset' => {
218
- jazzy: 'WillSet Accessor',
229
+ jazzy: 'willSet Observer',
219
230
  dash: 'Function',
220
231
  }.freeze,
221
232
  'source.lang.swift.decl.function.operator' => {
@@ -247,11 +258,11 @@ module Jazzy
247
258
  dash: 'Class',
248
259
  }.freeze,
249
260
  'source.lang.swift.decl.function.constructor' => {
250
- jazzy: 'Constructor',
261
+ jazzy: 'Initializer',
251
262
  dash: 'Constructor',
252
263
  }.freeze,
253
264
  'source.lang.swift.decl.function.destructor' => {
254
- jazzy: 'Destructor',
265
+ jazzy: 'Deinitializer',
255
266
  dash: 'Method',
256
267
  }.freeze,
257
268
  'source.lang.swift.decl.var.global' => {
@@ -259,15 +270,16 @@ module Jazzy
259
270
  dash: 'Global',
260
271
  }.freeze,
261
272
  'source.lang.swift.decl.enumcase' => {
262
- jazzy: 'Enum Case',
273
+ jazzy: 'Enumeration Case',
263
274
  dash: 'Case',
264
275
  }.freeze,
265
276
  'source.lang.swift.decl.enumelement' => {
266
- jazzy: 'Enum Element',
277
+ jazzy: 'Enumeration Element',
267
278
  dash: 'Element',
268
279
  }.freeze,
269
280
  'source.lang.swift.decl.enum' => {
270
- jazzy: 'Enum',
281
+ jazzy: 'Enumeration',
282
+ url: 'Enum',
271
283
  dash: 'Enum',
272
284
  }.freeze,
273
285
  'source.lang.swift.decl.extension' => {
@@ -279,7 +291,7 @@ module Jazzy
279
291
  dash: 'Extension',
280
292
  }.freeze,
281
293
  'source.lang.swift.decl.extension.enum' => {
282
- jazzy: 'Enum Extension',
294
+ jazzy: 'Enumeration Extension',
283
295
  dash: 'Extension',
284
296
  }.freeze,
285
297
  'source.lang.swift.decl.extension.protocol' => {
@@ -287,7 +299,7 @@ module Jazzy
287
299
  dash: 'Extension',
288
300
  }.freeze,
289
301
  'source.lang.swift.decl.extension.struct' => {
290
- jazzy: 'Struct Extension',
302
+ jazzy: 'Structure Extension',
291
303
  dash: 'Extension',
292
304
  }.freeze,
293
305
  'source.lang.swift.decl.function.free' => {
@@ -323,7 +335,8 @@ module Jazzy
323
335
  dash: 'Variable',
324
336
  }.freeze,
325
337
  'source.lang.swift.decl.struct' => {
326
- jazzy: 'Struct',
338
+ jazzy: 'Structure',
339
+ url: 'Struct',
327
340
  dash: 'Struct',
328
341
  }.freeze,
329
342
  'source.lang.swift.decl.function.subscript' => {
@@ -331,7 +344,8 @@ module Jazzy
331
344
  dash: 'Method',
332
345
  }.freeze,
333
346
  'source.lang.swift.decl.typealias' => {
334
- jazzy: 'Typealias',
347
+ jazzy: 'Type Alias',
348
+ url: 'Typealias',
335
349
  dash: 'Alias',
336
350
  }.freeze,
337
351
  'source.lang.swift.decl.generic_type_param' => {
@@ -2,6 +2,7 @@ require 'json'
2
2
  require 'pathname'
3
3
  require 'shellwords'
4
4
  require 'xcinvoke'
5
+ require 'CGI'
5
6
 
6
7
  require 'jazzy/config'
7
8
  require 'jazzy/executable'
@@ -27,7 +28,7 @@ class String
27
28
  gsub(autolink_regex(middle_regex, after_highlight)) do
28
29
  original = Regexp.last_match(0)
29
30
  start_tag, raw_name, end_tag = Regexp.last_match.captures
30
- link_target = yield(raw_name)
31
+ link_target = yield(CGI.unescape_html(raw_name))
31
32
 
32
33
  if link_target &&
33
34
  !link_target.type.extension? &&
@@ -82,17 +83,19 @@ module Jazzy
82
83
  children,
83
84
  type_category_prefix + type.plural_name,
84
85
  "The following #{type.plural_name.downcase} are available globally.",
86
+ type_category_prefix + type.plural_url_name,
85
87
  )
86
88
  end
87
89
  [group.compact, docs]
88
90
  end
89
91
 
90
- def self.make_group(group, name, abstract)
92
+ def self.make_group(group, name, abstract, url_name = nil)
91
93
  group.reject! { |doc| doc.name.empty? }
92
94
  unless group.empty?
93
95
  SourceDeclaration.new.tap do |sd|
94
96
  sd.type = SourceDeclaration::Type.overview
95
97
  sd.name = name
98
+ sd.url_name = url_name
96
99
  sd.abstract = Markdown.render(abstract)
97
100
  sd.children = group
98
101
  end
@@ -100,7 +103,7 @@ module Jazzy
100
103
  end
101
104
 
102
105
  def self.sanitize_filename(doc)
103
- unsafe_filename = doc.name
106
+ unsafe_filename = doc.url_name || doc.name
104
107
  sanitzation_enabled = Config.instance.use_safe_filenames
105
108
  if sanitzation_enabled && !doc.type.name_controlled_manually?
106
109
  return CGI.escape(unsafe_filename).gsub('_', '%5F').tr('%', '_')
@@ -154,7 +157,8 @@ module Jazzy
154
157
  top_level_decl = doc.namespace_path.first
155
158
  if top_level_decl && top_level_decl.type && top_level_decl.type.name
156
159
  # File program elements under top ancestor’s type (Struct, Class, etc.)
157
- [top_level_decl.type.plural_name] + doc.namespace_ancestors.map(&:name)
160
+ [top_level_decl.type.plural_url_name] +
161
+ doc.namespace_ancestors.map(&:name)
158
162
  else
159
163
  # Categories live in their own directory
160
164
  []
@@ -294,7 +298,7 @@ module Jazzy
294
298
  name: name,
295
299
  discussion: discovered[name],
296
300
  }
297
- end
301
+ end.reject { |param| param[:discussion].nil? }
298
302
  end
299
303
 
300
304
  # rubocop:disable Metrics/CyclomaticComplexity
@@ -540,7 +544,7 @@ module Jazzy
540
544
  return nil unless name_part
541
545
  wildcard_expansion = Regexp.escape(name_part)
542
546
  .gsub('\.\.\.', '[^)]*')
543
- .gsub(/&lt;.*&gt;/, '')
547
+ .gsub(/<.*>/, '')
544
548
  whole_name_pat = /\A#{wildcard_expansion}\Z/
545
549
  docs.find do |doc|
546
550
  whole_name_pat =~ doc.name
@@ -602,11 +606,16 @@ module Jazzy
602
606
  end
603
607
 
604
608
  def self.autolink(docs, root_decls)
609
+ @autolink_root_decls = root_decls
605
610
  docs.each do |doc|
606
611
  doc.children = autolink(doc.children, root_decls)
607
612
 
608
613
  doc.return = autolink_text(doc.return, doc, root_decls) if doc.return
609
614
  doc.abstract = autolink_text(doc.abstract, doc, root_decls)
615
+ (doc.parameters || []).each do |param|
616
+ param[:discussion] =
617
+ autolink_text(param[:discussion], doc, root_decls)
618
+ end
610
619
 
611
620
  if doc.declaration
612
621
  doc.declaration = autolink_text(
@@ -622,6 +631,11 @@ module Jazzy
622
631
  end
623
632
  end
624
633
 
634
+ # For autolinking external markdown documents
635
+ def self.autolink_document(html, doc)
636
+ autolink_text(html, doc, @autolink_root_decls || [])
637
+ end
638
+
625
639
  def self.reject_objc_types(docs)
626
640
  enums = docs.map do |doc|
627
641
  [doc, doc.children]
@@ -2,7 +2,7 @@
2
2
  <ul class="nav-groups">
3
3
  {{#structure}}
4
4
  <li class="nav-group-name">
5
- <a href="{{path_to_root}}{{section}}.html">{{section}}</a>
5
+ <a href="{{path_to_root}}{{url}}">{{section}}</a>
6
6
  <ul class="nav-group-tasks">
7
7
  {{#children}}
8
8
  <li class="nav-group-task">
@@ -2,7 +2,7 @@
2
2
  <ul class="nav-groups">
3
3
  {{#structure}}
4
4
  <li class="nav-group-name">
5
- <a class="nav-group-name-link" href="{{path_to_root}}{{section}}.html">{{section}}</a>
5
+ <a class="nav-group-name-link" href="{{path_to_root}}{{url}}">{{section}}</a>
6
6
  <ul class="nav-group-tasks">
7
7
  {{#children}}
8
8
  <li class="nav-group-task">
@@ -106,7 +106,7 @@ describe_cli 'jazzy' do
106
106
  s.replace_pattern /^[\d\s:.-]+ ruby\[\d+:\d+\] warning:.*$[\n]?/, ''
107
107
  # Remove version numbers from CocoaPods dependencies
108
108
  # to make specs resilient against dependecy updates.
109
- s.replace_pattern /(Installing \w+ )\((.*)\)/, '\1(X.Y.Z)'
109
+ s.replace_pattern(/(Installing \w+ )\((.*)\)/, '\1(X.Y.Z)')
110
110
  end
111
111
 
112
112
  require 'shellwords'
@@ -208,8 +208,8 @@ describe_cli 'jazzy' do
208
208
  behaves_like cli_spec 'document_siesta',
209
209
  # Siesta already has Docs/
210
210
  '--output api-docs',
211
- # Use default Swift rather than the specified 3.0.2
212
- '--swift-version='
211
+ # Use Swift 4 rather than the specified 3.0.2
212
+ '--swift-version=4'
213
213
  end
214
214
 
215
215
  describe 'Creates docs for Swift project with a variety of contents' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jazzy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.3
4
+ version: 0.8.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - JP Simard
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-07-07 00:00:00.000000000 Z
13
+ date: 2017-09-28 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: cocoapods
@@ -259,7 +259,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
259
259
  version: '0'
260
260
  requirements: []
261
261
  rubyforge_project:
262
- rubygems_version: 2.6.11
262
+ rubygems_version: 2.6.13
263
263
  signing_key:
264
264
  specification_version: 4
265
265
  summary: Soulful docs for Swift & Objective-C.