@@ -132,13 +132,18 @@ sub MAIN(
132
132
133
133
process-pod-dir ' Language' , : $ sparse ;
134
134
process-pod-dir ' Type' , : sorted-by{ % h {. key } // -1 }, : $ sparse ;
135
- for $ * DR . lookup(" type" , : by<kind >). list {
136
- write-type-source $ _ ;
137
- }
138
135
139
136
say ' Composing doc registry ...' ;
140
137
$ * DR . compose;
141
138
139
+ for $ * DR . lookup(" language" , : by<kind >). list {
140
+ say " Writing language document for { . name } ..." ;
141
+ spurt " html/language/{ . filename} .html" , p2h(. pod, ' language' );
142
+ }
143
+ for $ * DR . lookup(" type" , : by<kind >). list {
144
+ write-type-source $ _ ;
145
+ }
146
+
142
147
write-disambiguation-files if $ disambiguation ;
143
148
write-search-file if $ search-file ;
144
149
write-index-files;
@@ -170,55 +175,48 @@ sub process-pod-dir($dir, :&sorted-by = &[cmp], :$sparse) {
170
175
171
176
say " Processing $ dir Pod files ..." ;
172
177
my $ total = + @ pod-sources ;
173
- my $ what = $ dir . lc ;
174
- for @ pod-sources . kv -> $ num , (: key($ podname ), : value($ file )) {
175
- printf " % 4d/% d : % -40s => % s\n " , $ num + 1, $ total , $ file . path , " $ what / $ podname " ;
178
+ my $ kind = $ dir . lc ;
179
+ for @ pod-sources . kv -> $ num , (: key($ filename ), : value($ file )) {
180
+ printf " % 4d/% d : % -40s => % s\n " , $ num + 1, $ total , $ file . path , " $ kind / $ filename " ;
176
181
my $ pod = EVAL (slurp ($ file . path ) ~ " \n \$=pod" )[0 ];
177
- process-pod-source : $ what , : $ pod , : $ podname , : pod-is-complete;
182
+ process-pod-source : $ kind , : $ pod , : $ filename , : pod-is-complete;
178
183
}
179
184
}
180
185
181
- multi process-pod-source (: $ what where " language" , : $ pod , : $ podname , : $ pod-is-complete ) {
182
- my $ name = $ podname ;
186
+ sub process-pod-source (: $ kind , : $ pod , : $ filename , : $ pod-is-complete ) {
183
187
my $ summary = ' ' ;
184
- if $ pod . contents[0 ] ~~ {$ _ ~~ Pod ::Block::Named and . name eq " TITLE" } {
185
- $ name = $ pod . contents[0 ]. contents[0 ]. contents[0 ]
186
- } else {
187
- note " $ podname does not have an =TITLE" ;
188
+ my $ name = $ filename ;
189
+ if $ kind eq " language" {
190
+ if $ pod . contents[0 ] ~~ {$ _ ~~ Pod ::Block::Named and . name eq " TITLE" } {
191
+ $ name = $ pod . contents[0 ]. contents[0 ]. contents[0 ]
192
+ }
193
+ else {
194
+ note " $ filename does not have an =TITLE" ;
195
+ }
188
196
}
189
197
if $ pod . contents[1 ] ~~ {$ _ ~~ Pod ::Block::Named and . name eq " SUBTITLE" } {
190
198
$ summary = $ pod . contents[1 ]. contents[0 ]. contents[0 ];
191
199
} else {
192
- note " $ podname does not have an =SUBTITLE" ;
200
+ note " $ filename does not have an =SUBTITLE" ;
193
201
}
194
- my $ origin = $ * DR . add-new(
195
- : kind<language >,
196
- : name($ name ),
197
- : url(" /language/$ podname" ),
198
- : $ summary ,
199
- : $ pod ,
200
- : pod-is-complete,
201
- );
202
- find-definitions : $ pod , : $ origin ;
203
- spurt " html/$ what /$ podname .html" , p2h($ pod , $ what );
204
- }
205
202
206
- multi process-pod-source ( : $ what where " type " , : $ pod , : $ podname , : $ pod-is-complete ) {
207
- my $ type = $ tg . types{ $ podname };
208
- my $ summary = ' ' ;
209
- if $ pod . contents[ 1 ] ~~ { $ _ ~~ Pod ::Block::Named and . name eq " SUBTITLE " } {
210
- $ summary = $ pod . contents[ 1 ] . contents[ 0 ] . contents[ 0 ];
211
- } else {
212
- note " $ podname does not have an =SUBTITLE " ;
203
+ my % type-info ;
204
+ if $ kind eq " type " {
205
+ if $ tg . types{ $ name } -> $ type {
206
+ % type-info = : subkinds( $ type . packagetype), : categories( $ type . categories);
207
+ } else {
208
+ % type-info = : subkinds< class >;
209
+ }
213
210
}
214
211
my $ origin = $ * DR . add-new(
215
- : kind<type >,
216
- : subkinds($ type ?? $ type . packagetype !! ' class' ),
217
- : categories($ type ?? $ type . categories !! Nil ),
218
- : $ summary ,
212
+ : $ kind ,
213
+ : $ name ,
219
214
: $ pod ,
215
+ : url(" /$ kind /$ filename" ),
216
+ : $ filename ,
217
+ : $ summary ,
220
218
: $ pod-is-complete ,
221
- : name( $ podname ) ,
219
+ | % type-info ,
222
220
);
223
221
224
222
find-definitions : $ pod , : $ origin ;
0 commit comments