@@ -178,6 +178,7 @@ sub MAIN(
178
178
Bool : $ search-file = True ,
179
179
Bool : $ no-highlight = False ,
180
180
Int : $ parallel = 1 ,
181
+ Bool : $ manage = False ,
181
182
) {
182
183
if ! $ no-highlight {
183
184
if ! $ coffee-exe . IO . f {
@@ -215,19 +216,22 @@ sub MAIN(
215
216
spurt " html{ $ doc . url} .html" ,
216
217
p2h($ doc . pod, ' programs' , pod-path => $ pod-path );
217
218
}
219
+
218
220
for $ * DR . lookup(" language" , : by<kind >). list -> $ doc {
219
221
say " Writing language document for { $ doc . name } ..." ;
220
222
my $ pod-path = pod-path-from-url($ doc . url);
221
223
spurt " html{ $ doc . url} .html" ,
222
224
p2h($ doc . pod, ' language' , pod-path => $ pod-path );
223
225
}
226
+
224
227
for $ * DR . lookup(" type" , : by<kind >). list {
225
228
write-type-source $ _ ;
226
229
}
227
230
231
+
228
232
write-disambiguation-files if $ disambiguation ;
229
233
write-search-file if $ search-file ;
230
- write-index-files;
234
+ write-index-files( $ manage ) ;
231
235
232
236
for (set(<routine syntax >) (&) set($ * DR . get-kinds)). keys -> $ kind {
233
237
write-kind $ kind ;
@@ -239,6 +243,7 @@ sub MAIN(
239
243
}
240
244
241
245
spurt (' links.txt' , $ url-log . URLS. sort . unique . join (" \n " ));
246
+
242
247
}
243
248
244
249
sub process-pod-dir (: $ topdir , : $ dir , : & sorted-by = &[cmp ], : $ sparse , : $ parallel ) {
@@ -309,6 +314,7 @@ sub process-pod-dir(:$topdir, :$dir, :&sorted-by = &[cmp], :$sparse, :$parallel)
309
314
sub process-pod-source (: $ kind , : $ pod , : $ filename , : $ pod-is-complete ) {
310
315
my $ summary = ' ' ;
311
316
my $ name = $ filename ;
317
+ my Bool $ section = ($ pod . config<class >: exists and $ pod . config<class > eq ' section-start' );
312
318
my $ first = $ pod . contents[0 ];
313
319
if $ first ~~ Pod ::Block::Named && $ first . name eq " TITLE" {
314
320
$ name = $ pod . contents[0 ]. contents[0 ]. contents[0 ];
@@ -319,6 +325,15 @@ sub process-pod-source(:$kind, :$pod, :$filename, :$pod-is-complete) {
319
325
else {
320
326
note " $ filename does not have a =TITLE" ;
321
327
}
328
+ if $ first ~~ Pod ::Block::Named && $ first . name eq " TITLE" {
329
+ $ name = $ pod . contents[0 ]. contents[0 ]. contents[0 ];
330
+ if $ kind eq " type" {
331
+ $ name = $ name . split (/\s + /)[* - 1 ];
332
+ }
333
+ }
334
+ else {
335
+ note " $ filename does not have a =TITLE" ;
336
+ }
322
337
if $ pod . contents[1 ] ~~ {$ _ ~~ Pod ::Block::Named and . name eq " SUBTITLE" } {
323
338
$ summary = $ pod . contents[1 ]. contents[0 ]. contents[0 ];
324
339
}
@@ -344,6 +359,7 @@ sub process-pod-source(:$kind, :$pod, :$filename, :$pod-is-complete) {
344
359
: $ summary ,
345
360
: $ pod-is-complete ,
346
361
: subkinds($ kind ),
362
+ : $ section ,
347
363
| % type-info ,
348
364
);
349
365
@@ -862,7 +878,7 @@ sub write-disambiguation-files() {
862
878
say ' ' ;
863
879
}
864
880
865
- sub write-index-files () {
881
+ sub write-index-files ($ manage ) {
866
882
say ' Writing html/index.html and html/404.html...' ;
867
883
spurt ' html/index.html' ,
868
884
p2h(extract-pod(' doc/HomePage.pod6' ),
@@ -884,14 +900,40 @@ sub write-index-files() {
884
900
885
901
# sort language index by file name to allow author control of order
886
902
say ' Writing html/language.html ...' ;
887
- spurt ' html/language.html' , p2h(pod-with-title(
888
- ' Perl 6 Language Documentation' ,
889
- pod-block(" Tutorials, general reference, migration guides and meta pages for the Perl 6 language." ),
890
- pod-table($ * DR . lookup(' language' , : by<kind >). map ({[
903
+ if $ manage {
904
+ my @ p-chunks ;
905
+ my @ end ;
906
+ for $ * DR . lookup(' language' , : by<kind >). list {
907
+ if . section {
908
+ @ p-chunks . push ( pod-table(@ end . map ({[
909
+ pod-link(. name , . url),
910
+ . summary
911
+ ]})) ) if + @ end ;
912
+ @ p-chunks . push : pod-heading( . name , : level(2 ) );
913
+ @ end = ();
914
+ } else {
915
+ @ end . push : $ _ ;
916
+ }
917
+ }
918
+ @ p-chunks . push ( pod-table(@ end . map ({[
891
919
pod-link(. name , . url),
892
920
. summary
893
- ]}))
894
- ), ' language' );
921
+ ]})) ) if + @ end ;
922
+ spurt ' html/language.html' , p2h(pod-with-title(
923
+ ' Perl 6 Language Documentation' ,
924
+ pod-block(" Tutorials, general reference, migration guides and meta pages for the Perl 6 language." ),
925
+ @ p-chunks
926
+ ), ' language' );
927
+ } else {
928
+ spurt ' html/language.html' , p2h(pod-with-title(
929
+ ' Perl 6 Language Documentation' ,
930
+ pod-block(" Tutorials, general reference, migration guides and meta pages for the Perl 6 language." ),
931
+ pod-table($ * DR . lookup(' language' , : by<kind >). map ({[
932
+ pod-link(. name , . url),
933
+ . summary
934
+ ]}))
935
+ ), ' language' );
936
+ }
895
937
896
938
my & summary ;
897
939
& summary = {
0 commit comments