@@ -138,35 +138,41 @@ sub MAIN(Bool :$debug, Bool :$typegraph = False) {
138
138
mkdir " html/$ _" unless " html/$ _" . IO ~~ : e;
139
139
}
140
140
141
- say ' Reading lib/ ...' ;
142
- my @ source = recursive-dir(' lib' ). grep (*. f ). grep (rx {\. pod$ });
143
- @ source .= map : {; . path . subst (' lib/' , ' ' ). subst (rx {\. pod$ }, ' ' ). subst (: g, ' /' , ' ::' ) => $ _ };
141
+ my $ dr = Perl6::Documentable::Registry. new ;
142
+
143
+ say ' Reading lib/Language ...' ;
144
+ my @ lang-doc-sources =
145
+ recursive-dir(' lib/Language/' )\
146
+ . map ({; . path . subst (' lib/Language/' , ' ' ). subst (rx {\. pod$ }, ' ' ) => $ _ })\
147
+ . sort ;
148
+
149
+ say ' Processing Language Pod files ...' ;
150
+ for @ lang-doc-sources . kv -> $ num , (: key($ podname ), : value($ file )) {
151
+ printf " % 4d/% d : % -40s => % s\n " , $ num , + @ lang-doc-sources , $ file . path , " language/$ podname" ;
152
+ my $ pod = EVAL (slurp ($ file . path ) ~ " \n \$=pod" )[0 ];
153
+ write-language-file(: $ dr , : what<language >, : $ pod , : $ podname );
154
+ }
155
+
156
+ # TODO: Abstract this duplication
157
+ say ' Reading lib/Type ...' ;
158
+ my @ type-doc-sources =
159
+ recursive-dir(' lib/Type/' ). grep (*. f )\
160
+ . map : {; . path . subst (' lib/Type/' , ' ' ). subst (rx {\. pod$ }, ' ' ). subst (: g, ' /' , ' ::' ) => $ _ };
144
161
145
162
say ' Reading type graph ...' ;
146
163
$ tg = Perl6::TypeGraph. new-from-file(' type-graph.txt' );
147
164
{
148
165
my % h = $ tg . sorted. kv . flat . reverse ;
149
- @ source .= sort : { % h {. key } // -1 };
166
+ @ type-doc-sources .= sort : { % h {. key } // -1 };
150
167
}
151
168
152
- my $ dr = Perl6::Documentable::Registry. new ;
153
-
154
- say ' Processing Pod files ...' ;
155
- for @ source . kv -> $ num , $ _ {
156
- my $ podname = . key ;
157
- my $ file = . value ;
158
- my $ what = $ podname ~~ /^ <[ A..Z ] > | '::' / ?? ' type' !! ' language' ;
159
- printf " % 4d/% d : % -40s => % s\n " , $ num , + @ source , $ file . path , " $ what /$ podname" ;
160
-
169
+ # TODO: Abstract this duplication as well
170
+ say ' Processing Type Pod files ...' ;
171
+ for @ type-doc-sources . kv -> $ num , (: key($ podname ), : value($ file )) {
172
+ printf " % 4d/% d : % -40s => % s\n " , $ num , + @ type-doc-sources , $ file . path , " type/$ podname" ;
161
173
my $ pod = EVAL (slurp ($ file . path ) ~ " \n \$=pod" )[0 ];
162
-
163
- if $ what eq ' language' {
164
- write-language-file(: $ dr , : $ what , : $ pod , : $ podname );
165
- }
166
- else {
167
- say pod-gist($ pod [0 ]) if $ * DEBUG ;
168
- write-type-file(: $ dr , : $ what , : pod($ pod [0 ]), : $ podname );
169
- }
174
+ say pod-gist($ pod [0 ]) if $ * DEBUG ;
175
+ write-type-file(: $ dr , : what<type >, : pod($ pod [0 ]), : $ podname );
170
176
}
171
177
172
178
say ' Composing doc registry ...' ;
0 commit comments