This repository was archived by the owner on Jun 1, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +17
-12
lines changed
Sources/swift-doc/Extensions Expand file tree Collapse file tree 1 file changed +17
-12
lines changed Original file line number Diff line number Diff line change @@ -39,23 +39,28 @@ extension Symbol {
3939 func graph( in module: Module , baseURL: String ) -> Graph {
4040 var graph = Graph ( directed: true )
4141
42- let relationships = module. interface. relationships. filter {
43- ( $0. predicate == . inheritsFrom || $0. predicate == . conformsTo) &&
44- ( $0. subject == self || $0. object == self )
45- }
42+ do {
43+ var node = self . node
4644
47- var symbolNode = self . node
45+ if !( api is Unknown ) {
46+ node. href = path ( for: self , with: baseURL)
47+ }
4848
49- if !( api is Unknown ) {
50- symbolNode. href = path ( for: self , with: baseURL)
51- }
49+ node. strokeWidth = 3.0
50+ node. class = [ node. class, " current " ] . compactMap { $0 } . joined ( separator: " " )
5251
53- symbolNode . strokeWidth = 3.0
54- symbolNode . class = [ symbolNode . class , " current " ] . compactMap { $0 } . joined ( separator : " " )
52+ graph . append ( node )
53+ }
5554
56- graph. append ( symbolNode)
55+ let relationships = module. interface. relationships. filter {
56+ ( $0. predicate == . inheritsFrom || $0. predicate == . conformsTo) &&
57+ ( $0. subject == self || $0. object == self )
58+ }
5759
58- for node in Set ( relationships. flatMap { [ $0. subject. node, $0. object. node] } ) where node. id != symbolNode. id {
60+ for symbol in Set ( relationships. flatMap { [ $0. subject, $0. object] } ) {
61+ guard self != symbol else { continue }
62+ var node = symbol. node
63+ node. href = path ( for: symbol, with: baseURL)
5964 graph. append ( node)
6065 }
6166
You can’t perform that action at this time.
0 commit comments