File tree 14 files changed +129
-164
lines changed
14 files changed +129
-164
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,6 @@ use clap::App;
4
4
use clap:: Arg ;
5
5
use deno_doc:: find_nodes_by_name_recursively;
6
6
use deno_doc:: html:: HrefResolver ;
7
- use deno_doc:: html:: ShortPath ;
8
7
use deno_doc:: html:: UrlResolveKind ;
9
8
use deno_doc:: DocNodeKind ;
10
9
use deno_doc:: DocParser ;
@@ -195,8 +194,10 @@ impl HrefResolver for EmptyResolver {
195
194
None
196
195
}
197
196
198
- fn resolve_usage ( & self , current_file : & ShortPath ) -> Option < String > {
199
- Some ( current_file. specifier . to_string ( ) )
197
+ fn resolve_usage ( & self , current_resolve : UrlResolveKind ) -> Option < String > {
198
+ current_resolve
199
+ . get_file ( )
200
+ . map ( |current_file| current_file. specifier . to_string ( ) )
200
201
}
201
202
202
203
fn resolve_source ( & self , location : & deno_doc:: Location ) -> Option < String > {
Original file line number Diff line number Diff line change 1
1
use super :: render_context:: RenderContext ;
2
2
use super :: util:: * ;
3
3
use crate :: html:: usage:: UsagesCtx ;
4
- use crate :: html:: FileMode ;
5
4
use crate :: html:: ShortPath ;
6
5
use crate :: js_doc:: JsDoc ;
7
6
use crate :: js_doc:: JsDocTag ;
@@ -602,7 +601,7 @@ impl ModuleDocCtx {
602
601
( None , None , None )
603
602
} ;
604
603
605
- if short_path. is_main && render_ctx . ctx . file_mode == FileMode :: SingleDts {
604
+ if ! short_path. is_main {
606
605
let partitions_by_kind =
607
606
super :: partition:: partition_nodes_by_kind ( module_doc_nodes, true ) ;
608
607
Original file line number Diff line number Diff line change @@ -221,7 +221,7 @@ impl<'ctx> RenderContext<'ctx> {
221
221
is_first_symbol: false ,
222
222
} ] ;
223
223
224
- if file. is_main {
224
+ if ! file. is_main {
225
225
parts. push ( BreadcrumbCtx {
226
226
name : file. display_name ( ) ,
227
227
href : self
@@ -320,11 +320,10 @@ mod test {
320
320
Some ( format ! ( "{src}/{}" , symbol. join( "." ) ) )
321
321
}
322
322
323
- fn resolve_usage (
324
- & self ,
325
- current_file : & crate :: html:: ShortPath ,
326
- ) -> Option < String > {
327
- Some ( current_file. specifier . to_string ( ) )
323
+ fn resolve_usage ( & self , current_resolve : UrlResolveKind ) -> Option < String > {
324
+ current_resolve
325
+ . get_file ( )
326
+ . map ( |current_file| current_file. specifier . to_string ( ) )
328
327
}
329
328
330
329
fn resolve_source ( & self , location : & Location ) -> Option < String > {
Original file line number Diff line number Diff line change @@ -121,7 +121,7 @@ summary::-webkit-details-marker {
121
121
}
122
122
123
123
.namespaceSection {
124
- @apply grid grid-cols-1 sm :grid-cols-2 md :grid-cols-3 lg:grid-cols-4 gap-y-3 md:gap-x-3 md:gap-y-8;
124
+ @apply grid grid-cols-1 md :grid-cols-2 lg :grid-cols-3 gap-y-3 md:gap-x-8 md:gap-y-8;
125
125
.namespaceItem {
126
126
@apply flex gap-x-2.5;
127
127
Original file line number Diff line number Diff line change @@ -130,7 +130,7 @@ impl UsagesCtx {
130
130
let url = ctx
131
131
. ctx
132
132
. href_resolver
133
- . resolve_usage ( ctx. get_current_resolve ( ) . get_file ( ) ? ) ?;
133
+ . resolve_usage ( ctx. get_current_resolve ( ) ) ?;
134
134
135
135
if let Some ( usage_composer) = & ctx. ctx . usage_composer {
136
136
let usages = usage_composer ( ctx, doc_nodes, url) ;
Original file line number Diff line number Diff line change @@ -225,7 +225,7 @@ pub trait HrefResolver {
225
225
-> Option < String > ;
226
226
227
227
/// Resolve the URL used in "usage" blocks.
228
- fn resolve_usage ( & self , current_file : & ShortPath ) -> Option < String > ;
228
+ fn resolve_usage ( & self , current_resolve : UrlResolveKind ) -> Option < String > ;
229
229
230
230
/// Resolve the URL used in source code link buttons.
231
231
fn resolve_source ( & self , location : & crate :: Location ) -> Option < String > ;
Original file line number Diff line number Diff line change @@ -66,8 +66,10 @@ impl HrefResolver for EmptyResolver {
66
66
None
67
67
}
68
68
69
- fn resolve_usage ( & self , current_file : & ShortPath ) -> Option < String > {
70
- Some ( current_file. path . clone ( ) )
69
+ fn resolve_usage ( & self , current_resolve : UrlResolveKind ) -> Option < String > {
70
+ current_resolve
71
+ . get_file ( )
72
+ . map ( |current_file| current_file. path . to_string ( ) )
71
73
}
72
74
73
75
fn resolve_source ( & self , _location : & deno_doc:: Location ) -> Option < String > {
Original file line number Diff line number Diff line change 34
34
"sections" : {
35
35
"id" : " module_doc" ,
36
36
"docs" : null ,
37
- "sections" : []
37
+ "sections" : [
38
+ {
39
+ "header" : {
40
+ "title" : " Functions" ,
41
+ "href" : null ,
42
+ "doc" : null
43
+ },
44
+ "content" : {
45
+ "kind" : " namespace_section" ,
46
+ "content" : [
47
+ {
48
+ "tags" : [],
49
+ "doc_node_kind_ctx" : [
50
+ {
51
+ "kind" : " Function" ,
52
+ "char" : " f" ,
53
+ "title" : " Function" ,
54
+ "title_lowercase" : " function" ,
55
+ "title_plural" : " Functions"
56
+ }
57
+ ],
58
+ "origin_name" : null ,
59
+ "href" : " ../.././foo/~/x.html" ,
60
+ "name" : " x" ,
61
+ "docs" : null ,
62
+ "deprecated" : false
63
+ }
64
+ ]
65
+ }
66
+ }
67
+ ]
38
68
}
39
69
}
40
70
]
Original file line number Diff line number Diff line change 34
34
"sections" : {
35
35
"id" : " module_doc" ,
36
36
"docs" : null ,
37
- "sections" : []
37
+ "sections" : [
38
+ {
39
+ "header" : {
40
+ "title" : " Functions" ,
41
+ "href" : null ,
42
+ "doc" : null
43
+ },
44
+ "content" : {
45
+ "kind" : " namespace_section" ,
46
+ "content" : [
47
+ {
48
+ "tags" : [],
49
+ "doc_node_kind_ctx" : [
50
+ {
51
+ "kind" : " Function" ,
52
+ "char" : " f" ,
53
+ "title" : " Function" ,
54
+ "title_lowercase" : " function" ,
55
+ "title_plural" : " Functions"
56
+ }
57
+ ],
58
+ "origin_name" : null ,
59
+ "href" : " ../.././foo/~/x.html" ,
60
+ "name" : " x" ,
61
+ "docs" : null ,
62
+ "deprecated" : false
63
+ }
64
+ ]
65
+ }
66
+ }
67
+ ]
38
68
}
39
69
}
40
70
]
Original file line number Diff line number Diff line change 34
34
"sections" : {
35
35
"id" : " module_doc" ,
36
36
"docs" : null ,
37
- "sections" : []
37
+ "sections" : [
38
+ {
39
+ "header" : {
40
+ "title" : " Functions" ,
41
+ "href" : null ,
42
+ "doc" : null
43
+ },
44
+ "content" : {
45
+ "kind" : " namespace_section" ,
46
+ "content" : [
47
+ {
48
+ "tags" : [],
49
+ "doc_node_kind_ctx" : [
50
+ {
51
+ "kind" : " Function" ,
52
+ "char" : " f" ,
53
+ "title" : " Function" ,
54
+ "title_lowercase" : " function" ,
55
+ "title_plural" : " Functions"
56
+ }
57
+ ],
58
+ "origin_name" : null ,
59
+ "href" : " ../.././foo/~/x.html" ,
60
+ "name" : " x" ,
61
+ "docs" : null ,
62
+ "deprecated" : false
63
+ }
64
+ ]
65
+ }
66
+ }
67
+ ]
38
68
}
39
69
}
40
70
]
Original file line number Diff line number Diff line change 140
140
"is_symbol" : false ,
141
141
"is_first_symbol" : false
142
142
},
143
- {
144
- "name" : " default" ,
145
- "href" : " ../" ,
146
- "is_symbol" : false ,
147
- "is_first_symbol" : false
148
- },
149
143
{
150
144
"name" : " Bar" ,
151
145
"href" : " ../././~/Bar.html" ,
354
348
"is_symbol" : false ,
355
349
"is_first_symbol" : false
356
350
},
357
- {
358
- "name" : " default" ,
359
- "href" : " ../" ,
360
- "is_symbol" : false ,
361
- "is_first_symbol" : false
362
- },
363
351
{
364
352
"name" : " Foo" ,
365
353
"href" : " ../././~/Foo.html" ,
507
495
"is_symbol" : false ,
508
496
"is_first_symbol" : false
509
497
},
510
- {
511
- "name" : " default" ,
512
- "href" : " ../" ,
513
- "is_symbol" : false ,
514
- "is_first_symbol" : false
515
- },
516
498
{
517
499
"name" : " Foobar" ,
518
500
"href" : " ../././~/Foobar.html" ,
679
661
"is_symbol" : false ,
680
662
"is_first_symbol" : false
681
663
},
682
- {
683
- "name" : " default" ,
684
- "href" : " ../" ,
685
- "is_symbol" : false ,
686
- "is_first_symbol" : false
687
- },
688
664
{
689
665
"name" : " Hello" ,
690
666
"href" : " ../././~/Hello.html" ,
850
826
"is_symbol" : false ,
851
827
"is_first_symbol" : false
852
828
},
853
- {
854
- "name" : " default" ,
855
- "href" : " ../" ,
856
- "is_symbol" : false ,
857
- "is_first_symbol" : false
858
- },
859
829
{
860
830
"name" : " Foo" ,
861
831
"href" : " ../././~/Foo.html" ,
1027
997
"is_symbol" : false ,
1028
998
"is_first_symbol" : false
1029
999
},
1030
- {
1031
- "name" : " default" ,
1032
- "href" : " ../" ,
1033
- "is_symbol" : false ,
1034
- "is_first_symbol" : false
1035
- },
1036
1000
{
1037
1001
"name" : " Foo" ,
1038
1002
"href" : " ../././~/Foo.html" ,
1210
1174
"is_symbol" : false ,
1211
1175
"is_first_symbol" : false
1212
1176
},
1213
- {
1214
- "name" : " default" ,
1215
- "href" : " ../" ,
1216
- "is_symbol" : false ,
1217
- "is_first_symbol" : false
1218
- },
1219
1177
{
1220
1178
"name" : " Foo" ,
1221
1179
"href" : " ../././~/Foo.html" ,
1393
1351
"is_symbol" : false ,
1394
1352
"is_first_symbol" : false
1395
1353
},
1396
- {
1397
- "name" : " default" ,
1398
- "href" : " ../" ,
1399
- "is_symbol" : false ,
1400
- "is_first_symbol" : false
1401
- },
1402
1354
{
1403
1355
"name" : " Hello" ,
1404
1356
"href" : " ../././~/Hello.html" ,
1564
1516
"is_symbol" : false ,
1565
1517
"is_first_symbol" : false
1566
1518
},
1519
+ {
1520
+ "name" : " foo" ,
1521
+ "href" : " ../.././foo/~/index.html" ,
1522
+ "is_symbol" : false ,
1523
+ "is_first_symbol" : false
1524
+ },
1567
1525
{
1568
1526
"name" : " x" ,
1569
1527
"href" : " ../.././foo/~/x.html" ,
You can’t perform that action at this time.
0 commit comments