File tree 2 files changed +17
-8
lines changed
Tests/SwiftDocCTests/Model
2 files changed +17
-8
lines changed Original file line number Diff line number Diff line change @@ -142,12 +142,17 @@ struct DocumentationMarkup {
142
142
abstractSection = AbstractSection ( paragraph: firstParagraph)
143
143
return
144
144
} else if let directive = child as? BlockDirective {
145
- // Found deprecation notice in the abstract.
146
145
if directive. name == DeprecationSummary . directiveName {
146
+ // Found deprecation notice in the abstract.
147
147
deprecation = MarkupContainer ( directive. children)
148
+ return
149
+ } else if directive. name == Comment . directiveName || directive. name == Metadata . directiveName {
150
+ // These directives don't affect content so they shouldn't break us out of
151
+ // the automatic abstract section.
152
+ return
153
+ } else {
154
+ currentSection = . discussion
148
155
}
149
- // Skip other block like @Comment and so on.
150
- return
151
156
} else if let _ = child as? HTMLBlock {
152
157
// Skip HTMLBlock comment.
153
158
return
Original file line number Diff line number Diff line change @@ -77,13 +77,17 @@ class DocumentationMarkupTests: XCTestCase {
77
77
My abstract __content__.
78
78
"""
79
79
let expected = """
80
- Text " My abstract "
81
- Strong
82
- └─ Text " content "
83
- Text " . "
80
+ BlockDirective name: " Directive "
81
+ └─ BlockDirective name: " NestedDirective "
82
+ Paragraph
83
+ ├─ Text " My abstract "
84
+ ├─ Strong
85
+ │ └─ Text " content "
86
+ └─ Text " . "
84
87
"""
85
88
let model = DocumentationMarkup ( markup: Document ( parsing: source, options: . parseBlockDirectives) )
86
- XCTAssertEqual ( expected, model. abstractSection? . content. map ( { $0. detachedFromParent. debugDescription ( ) } ) . joined ( separator: " \n " ) )
89
+ XCTAssertNil ( model. abstractSection)
90
+ XCTAssertEqual ( expected, model. discussionSection? . content. map ( { $0. detachedFromParent. debugDescription ( ) } ) . joined ( separator: " \n " ) )
87
91
}
88
92
89
93
// Directives in between sections
You can’t perform that action at this time.
0 commit comments