@@ -40,6 +40,23 @@ sub render-node($node) {
40
40
$ result ;
41
41
}
42
42
43
+ # given a slashy type, see if that file exists on disk
44
+ # To work on case-insensitive file systems, we grep the dir listing
45
+ # rather than check a preconstructed path.
46
+
47
+ sub file-exists ($ type ) {
48
+ my @ parts = $ type . split (' /' );
49
+
50
+ my $ path = " doc/Type" . IO ;
51
+ while @ parts {
52
+ my $ part = @ parts . shift ;
53
+ $ part ~ = ' .rakudoc' unless @ parts . elems ;
54
+ return False unless $ path . dir . grep (*. basename eq $ part );
55
+ $ path = $ path . child ($ part );
56
+ }
57
+ return True ;
58
+ }
59
+
43
60
sub is-valid-type ($ node , $ parent , $ file ) {
44
61
# only care about I<>, C<>, L<>, etc.
45
62
return unless $ node ~~ Pod ::FormattingCode;
@@ -49,7 +66,8 @@ sub is-valid-type($node, $parent, $file) {
49
66
my $ type = $ node . contents. join (' ' );
50
67
my $ type-slash = $ type . subst (' ::' , ' /' , : g);
51
68
my $ type-colon = $ type . subst (' /' , ' ::' , : g);
52
- return unless " doc/Type/$ type-slash .rakudoc" . IO . f ;
69
+
70
+ return unless file-exists($ type-slash );
53
71
54
72
if $ file eq " doc/Type/$ type-slash .rakudoc" {
55
73
# We are on the same page as this type. Don't link it, only C<> it.
0 commit comments