@@ -136,10 +136,15 @@ public class DocumentationContext: DocumentationContextDataProviderDelegate {
136
136
/// The set of all manually curated references if `shouldStoreManuallyCuratedReferences` was true at the time of processing and has remained `true` since.. Nil if curation has not been processed yet.
137
137
public private( set) var manuallyCuratedReferences : Set < ResolvedTopicReference > ?
138
138
139
- /// The root technology nodes of the Topic Graph.
139
+ @ available ( * , deprecated , renamed : " tutorialTableOfContentsReferences " , message : " Use 'tutorialTableOfContentsReferences' This deprecated API will be removed after 6.2 is released " )
140
140
public var rootTechnologies : [ ResolvedTopicReference ] {
141
+ tutorialTableOfContentsReferences
142
+ }
143
+
144
+ /// The tutorial table-of-contents nodes in the topic graph.
145
+ public var tutorialTableOfContentsReferences : [ ResolvedTopicReference ] {
141
146
return topicGraph. nodes. values. compactMap { node in
142
- guard node. kind == . technology && parents ( of: node. reference) . isEmpty else {
147
+ guard node. kind == . tutorialTableOfContents && parents ( of: node. reference) . isEmpty else {
143
148
return nil
144
149
}
145
150
return node. reference
@@ -606,65 +611,65 @@ public class DocumentationContext: DocumentationContextDataProviderDelegate {
606
611
/// up in the context, not from the arrays that was passed as arguments.
607
612
///
608
613
/// - Parameters:
609
- /// - technologies : The list of temporary 'technology ' pages.
614
+ /// - tutorialTableOfContentsResults : The list of temporary 'tutorial table-of-contents ' pages.
610
615
/// - tutorials: The list of temporary 'tutorial' pages.
611
616
/// - tutorialArticles: The list of temporary 'tutorialArticle' pages.
612
617
/// - bundle: The bundle to resolve links against.
613
- private func resolveLinks( technologies: [ SemanticResult < Technology > ] ,
614
- tutorials: [ SemanticResult < Tutorial > ] ,
615
- tutorialArticles: [ SemanticResult < TutorialArticle > ] ,
616
- bundle: DocumentationBundle ) {
617
-
618
+ private func resolveLinks(
619
+ tutorialTableOfContents tutorialTableOfContentsResults: [ SemanticResult < TutorialTableOfContents > ] ,
620
+ tutorials: [ SemanticResult < Tutorial > ] ,
621
+ tutorialArticles: [ SemanticResult < TutorialArticle > ] ,
622
+ bundle: DocumentationBundle
623
+ ) {
618
624
let sourceLanguages = soleRootModuleReference. map { self . sourceLanguages ( for: $0) } ?? [ . swift]
619
625
620
- // Technologies
621
-
622
- for technologyResult in technologies {
626
+ // Tutorial table-of-contents
627
+
628
+ for tableOfContentsResult in tutorialTableOfContentsResults {
623
629
autoreleasepool {
624
- let url = technologyResult. source
625
- let unresolvedTechnology = technologyResult. value
630
+ let url = tableOfContentsResult. source
626
631
var resolver = ReferenceResolver ( context: self , bundle: bundle)
627
- let technology = resolver. visit ( unresolvedTechnology ) as! Technology
632
+ let tableOfContents = resolver. visit ( tableOfContentsResult . value ) as! TutorialTableOfContents
628
633
diagnosticEngine. emit ( resolver. problems)
629
634
630
635
// Add to document map
631
- documentLocationMap [ url] = technologyResult. topicGraphNode. reference
632
-
633
- let technologyReference = technologyResult. topicGraphNode. reference. withSourceLanguages ( sourceLanguages)
636
+ documentLocationMap [ url] = tableOfContentsResult. topicGraphNode. reference
634
637
635
- let technologyNode = DocumentationNode (
636
- reference: technologyReference,
637
- kind: . technology,
638
+ let tableOfContentsReference = tableOfContentsResult. topicGraphNode. reference. withSourceLanguages ( sourceLanguages)
639
+
640
+ let tutorialTableOfContentsNode = DocumentationNode (
641
+ reference: tableOfContentsReference,
642
+ kind: . tutorialTableOfContents,
638
643
sourceLanguage: Self . defaultLanguage ( in: sourceLanguages) ,
639
644
availableSourceLanguages: sourceLanguages,
640
- name: . conceptual( title: technology . intro. title) ,
641
- markup: technology . originalMarkup,
642
- semantic: technology
645
+ name: . conceptual( title: tableOfContents . intro. title) ,
646
+ markup: tableOfContents . originalMarkup,
647
+ semantic: tableOfContents
643
648
)
644
- documentationCache [ technologyReference ] = technologyNode
649
+ documentationCache [ tableOfContentsReference ] = tutorialTableOfContentsNode
645
650
646
- // Update the reference in the topic graph with the technology 's available languages.
651
+ // Update the reference in the topic graph with the table-of-contents page 's available languages.
647
652
topicGraph. updateReference (
648
- technologyResult . topicGraphNode. reference,
649
- newReference: technologyReference
653
+ tableOfContentsResult . topicGraphNode. reference,
654
+ newReference: tableOfContentsReference
650
655
)
651
656
652
657
let anonymousVolumeName = " $volume "
653
658
654
- for volume in technology . volumes {
659
+ for volume in tableOfContents . volumes {
655
660
// Graph node: Volume
656
- let volumeReference = technologyNode . reference. appendingPath ( volume. name ?? anonymousVolumeName)
661
+ let volumeReference = tutorialTableOfContentsNode . reference. appendingPath ( volume. name ?? anonymousVolumeName)
657
662
let volumeNode = TopicGraph . Node ( reference: volumeReference, kind: . volume, source: . file( url: url) , title: volume. name ?? anonymousVolumeName)
658
663
topicGraph. addNode ( volumeNode)
659
664
660
- // Graph edge: Technology -> Volume
661
- topicGraph. addEdge ( from: technologyResult . topicGraphNode, to: volumeNode)
665
+ // Graph edge: Tutorial table-of-contents -> Volume
666
+ topicGraph. addEdge ( from: tableOfContentsResult . topicGraphNode, to: volumeNode)
662
667
663
668
for chapter in volume. chapters {
664
669
// Graph node: Module
665
670
let baseNodeReference : ResolvedTopicReference
666
671
if volume. name == nil {
667
- baseNodeReference = technologyNode . reference
672
+ baseNodeReference = tutorialTableOfContentsNode . reference
668
673
} else {
669
674
baseNodeReference = volumeNode. reference
670
675
}
@@ -761,15 +766,15 @@ public class DocumentationContext: DocumentationContextDataProviderDelegate {
761
766
}
762
767
763
768
private func registerDocuments( from bundle: DocumentationBundle ) throws -> (
764
- technologies : [ SemanticResult < Technology > ] ,
769
+ tutorialTableOfContentsResults : [ SemanticResult < TutorialTableOfContents > ] ,
765
770
tutorials: [ SemanticResult < Tutorial > ] ,
766
771
tutorialArticles: [ SemanticResult < TutorialArticle > ] ,
767
772
articles: [ SemanticResult < Article > ] ,
768
773
documentationExtensions: [ SemanticResult < Article > ]
769
774
) {
770
775
// First, try to understand the basic structure of the document by
771
776
// analyzing it and putting references in as "unresolved".
772
- var technologies = [ SemanticResult < Technology > ] ( )
777
+ var tutorialTableOfContentsResults = [ SemanticResult < TutorialTableOfContents > ] ( )
773
778
var tutorials = [ SemanticResult < Tutorial > ] ( )
774
779
var tutorialArticles = [ SemanticResult < TutorialArticle > ] ( )
775
780
var articles = [ SemanticResult < Article > ] ( )
@@ -857,11 +862,11 @@ public class DocumentationContext: DocumentationContextDataProviderDelegate {
857
862
Add all topic graph nodes up front before resolution starts, because
858
863
there may be circular linking.
859
864
*/
860
- if let technology = analyzed as? Technology {
861
- let topicGraphNode = TopicGraph . Node ( reference: reference, kind: . technology , source: . file( url: url) , title: technology . intro. title)
865
+ if let tableOfContents = analyzed as? TutorialTableOfContents {
866
+ let topicGraphNode = TopicGraph . Node ( reference: reference, kind: . tutorialTableOfContents , source: . file( url: url) , title: tableOfContents . intro. title)
862
867
topicGraph. addNode ( topicGraphNode)
863
- let result = SemanticResult ( value: technology , source: url, topicGraphNode: topicGraphNode)
864
- technologies . append ( result)
868
+ let result = SemanticResult ( value: tableOfContents , source: url, topicGraphNode: topicGraphNode)
869
+ tutorialTableOfContentsResults . append ( result)
865
870
} else if let tutorial = analyzed as? Tutorial {
866
871
let topicGraphNode = TopicGraph . Node ( reference: reference, kind: . tutorial, source: . file( url: url) , title: tutorial. title ?? " " )
867
872
topicGraph. addNode ( topicGraphNode)
@@ -920,7 +925,7 @@ public class DocumentationContext: DocumentationContextDataProviderDelegate {
920
925
}
921
926
}
922
927
923
- return ( technologies , tutorials, tutorialArticles, articles, documentationExtensions)
928
+ return ( tutorialTableOfContentsResults , tutorials, tutorialArticles, articles, documentationExtensions)
924
929
}
925
930
926
931
private func insertLandmarks( _ landmarks: some Sequence < Landmark > , from topicGraphNode: TopicGraph . Node , source url: URL ) {
@@ -2098,7 +2103,7 @@ public class DocumentationContext: DocumentationContextDataProviderDelegate {
2098
2103
// symbols or attempt to resolve links/references since the topic graph may not contain all documents
2099
2104
// or all symbols yet.
2100
2105
var result : (
2101
- technologies : [ SemanticResult < Technology > ] ,
2106
+ tutorialTableOfContentsResults : [ SemanticResult < TutorialTableOfContents > ] ,
2102
2107
tutorials: [ SemanticResult < Tutorial > ] ,
2103
2108
tutorialArticles: [ SemanticResult < TutorialArticle > ] ,
2104
2109
articles: [ SemanticResult < Article > ] ,
@@ -2137,7 +2142,7 @@ public class DocumentationContext: DocumentationContextDataProviderDelegate {
2137
2142
}
2138
2143
2139
2144
// All discovery went well, process the inputs.
2140
- let ( technologies , tutorials, tutorialArticles, allArticles, documentationExtensions) = result
2145
+ let ( tutorialTableOfContentsResults , tutorials, tutorialArticles, allArticles, documentationExtensions) = result
2141
2146
var ( otherArticles, rootPageArticles) = splitArticles ( allArticles)
2142
2147
2143
2148
let globalOptions = ( allArticles + documentationExtensions) . compactMap { article in
@@ -2185,8 +2190,8 @@ public class DocumentationContext: DocumentationContextDataProviderDelegate {
2185
2190
for article in tutorialArticles {
2186
2191
hierarchyBasedResolver. addTutorialArticle ( article)
2187
2192
}
2188
- for technology in technologies {
2189
- hierarchyBasedResolver. addTechnology ( technology )
2193
+ for tutorialTableOfContents in tutorialTableOfContentsResults {
2194
+ hierarchyBasedResolver. addTutorialTableOfContents ( tutorialTableOfContents )
2190
2195
}
2191
2196
2192
2197
registerRootPages ( from: rootPageArticles, in: bundle)
@@ -2221,13 +2226,13 @@ public class DocumentationContext: DocumentationContextDataProviderDelegate {
2221
2226
2222
2227
// Third, any processing that relies on resolving other content is done, mainly resolving links.
2223
2228
preResolveExternalLinks ( semanticObjects:
2224
- technologies . map ( referencedSemanticObject) +
2229
+ tutorialTableOfContentsResults . map ( referencedSemanticObject) +
2225
2230
tutorials. map ( referencedSemanticObject) +
2226
2231
tutorialArticles. map ( referencedSemanticObject) ,
2227
2232
localBundleID: bundle. identifier)
2228
2233
2229
2234
resolveLinks (
2230
- technologies : technologies ,
2235
+ tutorialTableOfContents : tutorialTableOfContentsResults ,
2231
2236
tutorials: tutorials,
2232
2237
tutorialArticles: tutorialArticles,
2233
2238
bundle: bundle
@@ -2913,8 +2918,8 @@ public class DocumentationContext: DocumentationContextDataProviderDelegate {
2913
2918
extension DocumentationContext {
2914
2919
2915
2920
/// The nodes that are allowed to be roots in the topic graph.
2916
- static var allowedRootNodeKinds : [ DocumentationNode . Kind ] = [ . technology , . module]
2917
-
2921
+ static var allowedRootNodeKinds : [ DocumentationNode . Kind ] = [ . tutorialTableOfContents , . module]
2922
+
2918
2923
func analyzeTopicGraph( ) {
2919
2924
// Find all nodes that are loose in the graph and have no parent but aren't supposed to
2920
2925
let unexpectedRoots = topicGraph. nodes. values. filter { node in
0 commit comments