@@ -346,40 +346,12 @@ struct RenderContentCompiler: MarkupVisitor {
346
346
}
347
347
348
348
mutating func visitBlockDirective( _ blockDirective: BlockDirective ) -> [ RenderContent ] {
349
- switch blockDirective. name {
350
- case Snippet . directiveName:
351
- guard let snippet = Snippet ( from: blockDirective, for: bundle, in: context) else {
352
- return [ ]
353
- }
354
-
355
- guard let snippetReference = resolveSymbolReference ( destination: snippet. path) ,
356
- let snippetEntity = try ? context. entity ( with: snippetReference) ,
357
- let snippetSymbol = snippetEntity. symbol,
358
- let snippetMixin = snippetSymbol. mixins [ SymbolGraph . Symbol. Snippet. mixinKey] as? SymbolGraph . Symbol . Snippet else {
359
- return [ ]
360
- }
361
-
362
- if let requestedSlice = snippet. slice,
363
- let requestedLineRange = snippetMixin. slices [ requestedSlice] {
364
- // Render only the slice.
365
- let lineRange = requestedLineRange. lowerBound..< min ( requestedLineRange. upperBound, snippetMixin. lines. count)
366
- let lines = snippetMixin. lines [ lineRange]
367
- let minimumIndentation = lines. map { $0. prefix { $0. isWhitespace } . count } . min ( ) ?? 0
368
- let trimmedLines = lines. map { String ( $0. dropFirst ( minimumIndentation) ) }
369
- return [ RenderBlockContent . codeListing ( . init( syntax: snippetMixin. language, code: trimmedLines, metadata: nil ) ) ]
370
- } else {
371
- // Render the whole snippet with its explanation content.
372
- let docCommentContent = snippetEntity. markup. children. flatMap { self . visit ( $0) }
373
- let code = RenderBlockContent . codeListing ( . init( syntax: snippetMixin. language, code: snippetMixin. lines, metadata: nil ) )
374
- return docCommentContent + [ code]
375
- }
376
- default :
377
- guard let renderableDirective = DirectiveIndex . shared. renderableDirectives [ blockDirective. name] else {
378
- return [ ]
379
- }
380
-
381
- return renderableDirective. render ( blockDirective, with: & self )
349
+
350
+ guard let renderableDirective = DirectiveIndex . shared. renderableDirectives [ blockDirective. name] else {
351
+ return [ ]
382
352
}
353
+
354
+ return renderableDirective. render ( blockDirective, with: & self )
383
355
}
384
356
385
357
func defaultVisit( _ markup: Markup ) -> [ RenderContent ] {
0 commit comments