File tree 5 files changed +34
-5
lines changed
Block Nodes/Block Container Blocks/Doxygen Commands
5 files changed +34
-5
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ import Foundation
17
17
/// line or parsed command.
18
18
///
19
19
/// ```markdown
20
- /// \discussion This object can give other objects in your program magical powers.
20
+ /// \abstract This object can give other objects in your program magical powers.
21
21
/// ```
22
22
public struct DoxygenAbstract : BlockContainer {
23
23
public var _data : _MarkupData
@@ -40,14 +40,14 @@ public struct DoxygenAbstract: BlockContainer {
40
40
}
41
41
42
42
public extension DoxygenAbstract {
43
- /// Create a new Doxygen discussion definition.
43
+ /// Create a new Doxygen abstract definition.
44
44
///
45
45
/// - Parameter children: Block child elements.
46
46
init < Children: Sequence > ( children: Children ) where Children. Element == BlockMarkup {
47
47
try ! self . init ( . doxygenAbstract( parsedRange: nil , children. map ( { $0. raw. markup } ) ) )
48
48
}
49
49
50
- /// Create a new Doxygen discussion definition.
50
+ /// Create a new Doxygen abstract definition.
51
51
///
52
52
/// - Parameter children: Block child elements.
53
53
init ( children: BlockMarkup ... ) {
Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ Doxygen commands are not parsed within code blocks or block directive content.
44
44
45
45
### Commands
46
46
47
+ - `` DoxygenAbstract ``
47
48
- `` DoxygenDiscussion ``
48
49
- `` DoxygenNote ``
49
50
- `` DoxygenParameter ``
Original file line number Diff line number Diff line change 1
1
/*
2
2
This source file is part of the Swift.org open source project
3
3
4
- Copyright (c) 2021-2024 Apple Inc. and the Swift project authors
4
+ Copyright (c) 2021-2025 Apple Inc. and the Swift project authors
5
5
Licensed under Apache License v2.0 with Runtime Library Exception
6
6
7
7
See https://swift.org/LICENSE.txt for license information
@@ -1178,6 +1178,11 @@ public struct MarkupFormatter: MarkupWalker {
1178
1178
descendInto ( doxygenDiscussion)
1179
1179
}
1180
1180
1181
+ public mutating func visitDoxygenAbstract( _ doxygenAbstract: DoxygenAbstract ) {
1182
+ printDoxygenStart ( " abstract " , for: doxygenAbstract)
1183
+ descendInto ( doxygenAbstract)
1184
+ }
1185
+
1181
1186
public mutating func visitDoxygenNote( _ doxygenNote: DoxygenNote ) {
1182
1187
printDoxygenStart ( " note " , for: doxygenNote)
1183
1188
descendInto ( doxygenNote)
@@ -1194,4 +1199,5 @@ public struct MarkupFormatter: MarkupWalker {
1194
1199
printDoxygenStart ( " returns " , for: doxygenReturns)
1195
1200
descendInto ( doxygenReturns)
1196
1201
}
1202
+
1197
1203
}
Original file line number Diff line number Diff line change @@ -469,7 +469,9 @@ class DoxygenCommandParserTests: XCTestCase {
469
469
let expectedDump = #"""
470
470
Document
471
471
├─ BlockDirective name: "method"
472
- ├─ BlockDirective name: "abstract"
472
+ ├─ DoxygenAbstract
473
+ │ └─ Paragraph
474
+ │ └─ Text "Some brief description of this method"
473
475
├─ DoxygenParameter parameter: number
474
476
│ └─ Paragraph
475
477
│ └─ Text "Some description of the “number” parameter"
Original file line number Diff line number Diff line change @@ -301,6 +301,26 @@ class MarkupFormatterSingleElementTests: XCTestCase {
301
301
XCTAssertEqual ( expectedAt, printedAt)
302
302
}
303
303
304
+ func testPrintDoxygenAbstract( ) {
305
+ let expected = #"\abstract Another thing."#
306
+ let printed = DoxygenAbstract ( children: Paragraph ( Text ( " Another thing. " ) ) ) . format ( )
307
+ print ( printed)
308
+ XCTAssertEqual ( expected, printed)
309
+ }
310
+
311
+ func testPrintDoxygenAbstractMultiline( ) {
312
+ let expected = #"""
313
+ \abstract Another thing.
314
+ This is an extended abstract.
315
+ """#
316
+ let printed = DoxygenAbstract ( children: Paragraph (
317
+ Text ( " Another thing. " ) ,
318
+ SoftBreak ( ) ,
319
+ Text ( " This is an extended abstract. " )
320
+ ) ) . format ( )
321
+ XCTAssertEqual ( expected, printed)
322
+ }
323
+
304
324
func testPrintDoxygenDiscussion( ) {
305
325
let expected = #"\discussion Another thing."#
306
326
let printed = DoxygenDiscussion ( children: Paragraph ( Text ( " Another thing. " ) ) ) . format ( )
You can’t perform that action at this time.
0 commit comments