diff --git a/CHANGELOG.md b/CHANGELOG.md index 97fedce55..633e05cf0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ ## Master +##### Breaking + +* None. + +##### Enhancements + +* Objective-C documentation now also includes Swift declarations. + [JP Simard](https://github.com/jpsim) + [#136](https://github.com/realm/jazzy/issues/136) + ##### Bug Fixes * Uses GitHub-Flavored Markdown syntax for anchors when rendering README pages. diff --git a/SourceKitten b/SourceKitten index c4da1e86f..fc6d23c08 160000 --- a/SourceKitten +++ b/SourceKitten @@ -1 +1 @@ -Subproject commit c4da1e86f441ee9596c441ec3321e5d023beca19 +Subproject commit fc6d23c087c8f8b333c2a2f1407180b01c8baf39 diff --git a/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/Commandant.framework/Versions/A/Commandant b/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/Commandant.framework/Versions/A/Commandant index f81d04e70..d6a49490c 100755 Binary files a/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/Commandant.framework/Versions/A/Commandant and b/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/Commandant.framework/Versions/A/Commandant differ diff --git a/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/Commandant.framework/Versions/A/Resources/Info.plist b/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/Commandant.framework/Versions/A/Resources/Info.plist index 35fb414f0..1189fbc0f 100644 --- a/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/Commandant.framework/Versions/A/Resources/Info.plist +++ b/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/Commandant.framework/Versions/A/Resources/Info.plist @@ -3,7 +3,7 @@ BuildMachineOSBuild - 15E65 + 15F18b CFBundleDevelopmentRegion en CFBundleExecutable @@ -17,7 +17,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 0.8.2 + 0.9.0 CFBundleSignature ???? CFBundleSupportedPlatforms diff --git a/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/Result.framework/Versions/A/Resources/Info.plist b/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/Result.framework/Versions/A/Resources/Info.plist index b8f361062..685ec1c4c 100644 --- a/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/Result.framework/Versions/A/Resources/Info.plist +++ b/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/Result.framework/Versions/A/Resources/Info.plist @@ -3,7 +3,7 @@ BuildMachineOSBuild - 15E65 + 15F18b CFBundleDevelopmentRegion en CFBundleExecutable diff --git a/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/SWXMLHash.framework/Versions/A/Resources/Info.plist b/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/SWXMLHash.framework/Versions/A/Resources/Info.plist index 56c518fcb..4961f88b0 100644 --- a/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/SWXMLHash.framework/Versions/A/Resources/Info.plist +++ b/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/SWXMLHash.framework/Versions/A/Resources/Info.plist @@ -3,7 +3,7 @@ BuildMachineOSBuild - 15E65 + 15F18b CFBundleDevelopmentRegion en CFBundleExecutable diff --git a/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/SWXMLHash.framework/Versions/A/SWXMLHash b/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/SWXMLHash.framework/Versions/A/SWXMLHash index 11c64beb7..73ee5ac42 100755 Binary files a/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/SWXMLHash.framework/Versions/A/SWXMLHash and b/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/SWXMLHash.framework/Versions/A/SWXMLHash differ diff --git a/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Resources/Info.plist b/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Resources/Info.plist index 8f7a2f4ac..3970c79fe 100644 --- a/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Resources/Info.plist +++ b/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Resources/Info.plist @@ -3,7 +3,7 @@ BuildMachineOSBuild - 15E65 + 15F18b CFBundleDevelopmentRegion en CFBundleExecutable diff --git a/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/SourceKittenFramework b/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/SourceKittenFramework index 5b5c4488f..6e8c8c129 100755 Binary files a/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/SourceKittenFramework and b/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/SourceKittenFramework differ diff --git a/lib/jazzy/SourceKitten/bin/sourcekitten b/lib/jazzy/SourceKitten/bin/sourcekitten index e5456f5de..63b146715 100755 Binary files a/lib/jazzy/SourceKitten/bin/sourcekitten and b/lib/jazzy/SourceKitten/bin/sourcekitten differ diff --git a/lib/jazzy/doc_builder.rb b/lib/jazzy/doc_builder.rb index b52d74c1c..db242cecd 100644 --- a/lib/jazzy/doc_builder.rb +++ b/lib/jazzy/doc_builder.rb @@ -284,19 +284,20 @@ def self.render_item(item, source_module) # Combine abstract and discussion into abstract abstract = (item.abstract || '') + (item.discussion || '') item_render = { - name: item.name, - abstract: render_markdown(abstract), - declaration: item.declaration, - usr: item.usr, - dash_type: item.type.dash_type, - github_token_url: gh_token_url(item, source_module), - default_impl_abstract: render_markdown(item.default_impl_abstract), - from_protocol_extension: item.from_protocol_extension, - return: render_markdown(item.return), - parameters: (item.parameters if item.parameters.any?), - url: (item.url if item.children.any?), - start_line: item.start_line, - end_line: item.end_line, + name: item.name, + abstract: render_markdown(abstract), + declaration: item.declaration, + other_language_declaration: item.other_language_declaration, + usr: item.usr, + dash_type: item.type.dash_type, + github_token_url: gh_token_url(item, source_module), + default_impl_abstract: render_markdown(item.default_impl_abstract), + from_protocol_extension: item.from_protocol_extension, + return: render_markdown(item.return), + parameters: (item.parameters if item.parameters.any?), + url: (item.url if item.children.any?), + start_line: item.start_line, + end_line: item.end_line, } item_render.reject { |_, v| v.nil? } end diff --git a/lib/jazzy/source_declaration.rb b/lib/jazzy/source_declaration.rb index c1a2c03be..6565bae88 100644 --- a/lib/jazzy/source_declaration.rb +++ b/lib/jazzy/source_declaration.rb @@ -54,6 +54,7 @@ def objc_category_name attr_accessor :usr attr_accessor :name attr_accessor :declaration + attr_accessor :other_language_declaration attr_accessor :abstract attr_accessor :default_impl_abstract attr_accessor :from_protocol_extension diff --git a/lib/jazzy/sourcekitten.rb b/lib/jazzy/sourcekitten.rb index 009d1a730..028e44953 100644 --- a/lib/jazzy/sourcekitten.rb +++ b/lib/jazzy/sourcekitten.rb @@ -213,6 +213,8 @@ def self.parameters(doc) end end + # rubocop:disable Metrics/CyclomaticComplexity + # rubocop:disable Metrics/PerceivedComplexity def self.make_doc_info(doc, declaration) return unless should_document?(doc) unless doc['key.doc.full_as_xml'] @@ -225,6 +227,11 @@ def self.make_doc_info(doc, declaration) doc['key.parsed_declaration'] || doc['key.doc.declaration'], Config.instance.objc_mode ? 'objc' : 'swift', ) + if Config.instance.objc_mode && doc['key.swift_declaration'] + declaration.other_language_declaration = Highlighter.highlight( + doc['key.swift_declaration'], 'swift' + ) + end declaration.abstract = Jazzy.markdown.render(doc['key.doc.comment'] || '') declaration.discussion = '' declaration.return = make_paragraphs(doc, 'key.doc.result_discussion') @@ -233,6 +240,8 @@ def self.make_doc_info(doc, declaration) @documented_count += 1 end + # rubocop:enable Metrics/CyclomaticComplexity + # rubocop:enable Metrics/PerceivedComplexity def self.make_substructure(doc, declaration) if doc['key.substructure'] diff --git a/lib/jazzy/themes/apple/templates/task.mustache b/lib/jazzy/themes/apple/templates/task.mustache index a02a1135b..0dec82827 100644 --- a/lib/jazzy/themes/apple/templates/task.mustache +++ b/lib/jazzy/themes/apple/templates/task.mustache @@ -53,6 +53,12 @@

{{language}}

{{{declaration}}} + {{#other_language_declaration}} +
+

Swift

+ {{{other_language_declaration}}} +
+ {{/other_language_declaration}} {{/declaration}} {{#parameters.count}} diff --git a/lib/jazzy/themes/fullwidth/templates/task.mustache b/lib/jazzy/themes/fullwidth/templates/task.mustache index 4e1786307..b08f2e0a6 100644 --- a/lib/jazzy/themes/fullwidth/templates/task.mustache +++ b/lib/jazzy/themes/fullwidth/templates/task.mustache @@ -53,6 +53,12 @@

{{language}}

{{{declaration}}} + {{#other_language_declaration}} +
+

Swift

+ {{{other_language_declaration}}} +
+ {{/other_language_declaration}} {{/declaration}} {{#parameters.count}} diff --git a/spec/integration_specs b/spec/integration_specs index b63a7d3a1..134405064 160000 --- a/spec/integration_specs +++ b/spec/integration_specs @@ -1 +1 @@ -Subproject commit b63a7d3a126fdb4421dbd97710bac79401546178 +Subproject commit 13440506455f6d25f5702a041a1ac52cf59becfa