Skip to content

Commit

Permalink
Merge pull request #975 from realm/jf-bad-decl-xml
Browse files Browse the repository at this point in the history
Do not crash with bad declaration XML
  • Loading branch information
johnfairh authored May 20, 2018
2 parents 987a6d8 + 40bc27b commit 83cebe5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
[John Fairhurst](https://github.com/johnfairh)
[#965](https://github.com/realm/jazzy/issues/965)

* Fix crash with unicode scalars in string literals.
[John Fairhurst](https://github.com/johnfairh)
[#972](https://github.com/realm/jazzy/issues/972)

## 0.9.3

##### Breaking
Expand Down
11 changes: 7 additions & 4 deletions lib/jazzy/sourcekitten.rb
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,8 @@ def self.make_doc_info(doc, declaration)
def self.xml_to_text(xml)
document = REXML::Document.new(xml)
REXML::XPath.match(document.root, '//text()').map(&:value).join
rescue
''
end

# Regexp to match an @attribute. Complex to handle @available().
Expand Down Expand Up @@ -372,10 +374,11 @@ def self.split_decl_attributes(declaration)
end

def self.prefer_parsed_decl?(parsed, annotated)
parsed &&
(annotated.include?(' = default') || # SR-2608
parsed.match('@autoclosure|@escaping') || # SR-6321
parsed.include?("\n"))
annotated.empty? ||
parsed &&
(annotated.include?(' = default') || # SR-2608
parsed.match('@autoclosure|@escaping') || # SR-6321
parsed.include?("\n"))
end

# Replace the fully qualified name of a type with its base name
Expand Down
2 changes: 1 addition & 1 deletion spec/integration_specs
Submodule integration_specs updated 60 files
+3 −0 misc_jazzy_features/after/docs/Classes/ClassWithInitializers.html
+3 −0 misc_jazzy_features/after/docs/Classes/ImplicitlyInternalTopLevelClass.html
+3 −0 misc_jazzy_features/after/docs/Classes/ImplicitlyInternalTopLevelClass/NestedClass.html
+3 −0 misc_jazzy_features/after/docs/Classes/MiscMarkdown.html
+3 −0 misc_jazzy_features/after/docs/Classes/Operators_5FNamespace.html
+3 −0 misc_jazzy_features/after/docs/Classes/TopLevelClass.html
+3 −0 misc_jazzy_features/after/docs/Classes/TopLevelClass/NestedLevel1.html
+3 −0 misc_jazzy_features/after/docs/Classes/TopLevelClass/NestedLevel1/NestedLevel2.html
+3 −0 misc_jazzy_features/after/docs/Enums/DocumentedEnum.html
+301 −0 misc_jazzy_features/after/docs/Enums/StringEnum.html
+3 −0 misc_jazzy_features/after/docs/Enums/UndocumentedEnum.html
+3 −0 misc_jazzy_features/after/docs/Extensions/NSObject.html
+3 −0 misc_jazzy_features/after/docs/Extensions/String.html
+3 −0 misc_jazzy_features/after/docs/Extensions/String/CharacterView.html
+3 −0 misc_jazzy_features/after/docs/Guides.html
+3 −0 misc_jazzy_features/after/docs/Other Classes.html
+42 −0 misc_jazzy_features/after/docs/Other Enums.html
+3 −0 misc_jazzy_features/after/docs/Other Extensions.html
+3 −0 misc_jazzy_features/after/docs/Other Functions.html
+3 −0 misc_jazzy_features/after/docs/Other Global Variables.html
+3 −0 misc_jazzy_features/after/docs/Other Structs.html
+3 −0 misc_jazzy_features/after/docs/Structs/GenericStruct.html
+3 −0 misc_jazzy_features/after/docs/Yang.html
+3 −0 misc_jazzy_features/after/docs/Yin.html
+3 −0 ...after/docs/docsets/MiscJazzyFeatures.docset/Contents/Resources/Documents/Classes/ClassWithInitializers.html
+3 −0 .../docsets/MiscJazzyFeatures.docset/Contents/Resources/Documents/Classes/ImplicitlyInternalTopLevelClass.html
+3 −0 ...cJazzyFeatures.docset/Contents/Resources/Documents/Classes/ImplicitlyInternalTopLevelClass/NestedClass.html
+3 −0 ...features/after/docs/docsets/MiscJazzyFeatures.docset/Contents/Resources/Documents/Classes/MiscMarkdown.html
+3 −0 ...after/docs/docsets/MiscJazzyFeatures.docset/Contents/Resources/Documents/Classes/Operators_5FNamespace.html
+3 −0 ...eatures/after/docs/docsets/MiscJazzyFeatures.docset/Contents/Resources/Documents/Classes/TopLevelClass.html
+3 −0 .../docs/docsets/MiscJazzyFeatures.docset/Contents/Resources/Documents/Classes/TopLevelClass/NestedLevel1.html
+3 −0 .../MiscJazzyFeatures.docset/Contents/Resources/Documents/Classes/TopLevelClass/NestedLevel1/NestedLevel2.html
+3 −0 ...features/after/docs/docsets/MiscJazzyFeatures.docset/Contents/Resources/Documents/Enums/DocumentedEnum.html
+301 −0 ...zzy_features/after/docs/docsets/MiscJazzyFeatures.docset/Contents/Resources/Documents/Enums/StringEnum.html
+3 −0 ...atures/after/docs/docsets/MiscJazzyFeatures.docset/Contents/Resources/Documents/Enums/UndocumentedEnum.html
+3 −0 ..._features/after/docs/docsets/MiscJazzyFeatures.docset/Contents/Resources/Documents/Extensions/NSObject.html
+3 −0 ...zy_features/after/docs/docsets/MiscJazzyFeatures.docset/Contents/Resources/Documents/Extensions/String.html
+3 −0 ...ter/docs/docsets/MiscJazzyFeatures.docset/Contents/Resources/Documents/Extensions/String/CharacterView.html
+3 −0 misc_jazzy_features/after/docs/docsets/MiscJazzyFeatures.docset/Contents/Resources/Documents/Guides.html
+3 −0 ..._jazzy_features/after/docs/docsets/MiscJazzyFeatures.docset/Contents/Resources/Documents/Other Classes.html
+42 −0 misc_jazzy_features/after/docs/docsets/MiscJazzyFeatures.docset/Contents/Resources/Documents/Other Enums.html
+3 −0 ...zzy_features/after/docs/docsets/MiscJazzyFeatures.docset/Contents/Resources/Documents/Other Extensions.html
+3 −0 ...azzy_features/after/docs/docsets/MiscJazzyFeatures.docset/Contents/Resources/Documents/Other Functions.html
+3 −0 ...atures/after/docs/docsets/MiscJazzyFeatures.docset/Contents/Resources/Documents/Other Global Variables.html
+3 −0 ..._jazzy_features/after/docs/docsets/MiscJazzyFeatures.docset/Contents/Resources/Documents/Other Structs.html
+3 −0 ...eatures/after/docs/docsets/MiscJazzyFeatures.docset/Contents/Resources/Documents/Structs/GenericStruct.html
+3 −0 misc_jazzy_features/after/docs/docsets/MiscJazzyFeatures.docset/Contents/Resources/Documents/Yang.html
+3 −0 misc_jazzy_features/after/docs/docsets/MiscJazzyFeatures.docset/Contents/Resources/Documents/Yin.html
+3 −0 misc_jazzy_features/after/docs/docsets/MiscJazzyFeatures.docset/Contents/Resources/Documents/example-1.html
+3 −0 misc_jazzy_features/after/docs/docsets/MiscJazzyFeatures.docset/Contents/Resources/Documents/example-2.html
+3 −0 misc_jazzy_features/after/docs/docsets/MiscJazzyFeatures.docset/Contents/Resources/Documents/index.html
+1 −1 misc_jazzy_features/after/docs/docsets/MiscJazzyFeatures.docset/Contents/Resources/Documents/search.json
+51 −47 misc_jazzy_features/after/docs/docsets/MiscJazzyFeatures.docset/Contents/Resources/docSet.dsidx.csv
+3 −0 misc_jazzy_features/after/docs/example-1.html
+3 −0 misc_jazzy_features/after/docs/example-2.html
+3 −0 misc_jazzy_features/after/docs/index.html
+1 −1 misc_jazzy_features/after/docs/search.json
+28 −0 misc_jazzy_features/after/docs/undocumented.json
+2 −2 misc_jazzy_features/after/execution_output.txt
+8 −0 misc_jazzy_features/before/MiscJazzyFeatures/Classes.swift

0 comments on commit 83cebe5

Please sign in to comment.