File tree Expand file tree Collapse file tree 3 files changed +29
-0
lines changed
Sources/SwiftDocC/Model/Rendering
Test Bundles/MixedManualAutomaticCuration.docc Expand file tree Collapse file tree 3 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -1244,6 +1244,10 @@ public struct RenderNodeTranslator: SemanticVisitor {
1244
1244
}
1245
1245
}
1246
1246
}
1247
+
1248
+ if let pageColor = documentationNode. metadata? . pageColor {
1249
+ node. metadata. color = TopicColor ( standardColorIdentifier: pageColor. rawValue)
1250
+ }
1247
1251
1248
1252
var metadataCustomDictionary : [ String : String ] = [ : ]
1249
1253
if let customMetadatas = documentationNode. metadata? . customMetadata {
Original file line number Diff line number Diff line change @@ -1226,4 +1226,25 @@ class RenderNodeTranslatorTests: XCTestCase {
1226
1226
" yellow "
1227
1227
)
1228
1228
}
1229
+
1230
+ func testPageColorMetadataInSymbolExtension( ) throws {
1231
+ let ( bundle, context) = try testBundleAndContext ( named: " MixedManualAutomaticCuration " )
1232
+ let reference = ResolvedTopicReference (
1233
+ bundleIdentifier: bundle. identifier,
1234
+ path: " /documentation/TestBed " ,
1235
+ sourceLanguage: . swift
1236
+ )
1237
+ let symbol = try XCTUnwrap ( context. entity ( with: reference) . semantic as? Symbol )
1238
+ var translator = RenderNodeTranslator (
1239
+ context: context,
1240
+ bundle: bundle,
1241
+ identifier: reference,
1242
+ source: nil
1243
+ )
1244
+ let renderNode = try XCTUnwrap ( translator. visitSymbol ( symbol) as? RenderNode )
1245
+
1246
+ let encodedSymbol = try JSONEncoder ( ) . encode ( renderNode)
1247
+ let roundTrippedSymbol = try JSONDecoder ( ) . decode ( RenderNode . self, from: encodedSymbol)
1248
+ XCTAssertEqual ( roundTrippedSymbol. metadata. color? . standardColorIdentifier, " purple " )
1249
+ }
1229
1250
}
Original file line number Diff line number Diff line change 1
1
# `` TestBed ``
2
2
3
+ @Metadata {
4
+ @PageColor (purple)
5
+ }
6
+
3
7
TestBed framework.
4
8
5
9
TestBed content.
You can’t perform that action at this time.
0 commit comments