@@ -179,7 +179,6 @@ sub MAIN(Bool :$debug, Bool :$typegraph = False) {
179
179
$ dr . compose;
180
180
181
181
write-disambiguation-files($ dr );
182
- write-op-disambiguation-files($ dr );
183
182
write-type-graph-images(: force($ typegraph ));
184
183
write-search-file($ dr );
185
184
write-index-files($ dr );
@@ -198,6 +197,16 @@ sub MAIN(Bool :$debug, Bool :$typegraph = False) {
198
197
199
198
sub write-language-file (: $ dr , : $ what , : $ pod , : $ podname ) {
200
199
spurt " html/$ what /$ podname .html" , p2h($ pod , $ what );
200
+ my $ name = $ pod . content[0 ]. name eq " TITLE"
201
+ ?? $ pod . content[0 ]. content[0 ]. content[0 ]
202
+ !! $ podname ;
203
+ my $ d = $ dr . add-new(
204
+ : kind<language >,
205
+ : name($ name ),
206
+ : url(" /language/$ podname" ),
207
+ : $ pod ,
208
+ : pod-is-complete,
209
+ );
201
210
if $ podname eq ' operators' {
202
211
my @ chunks = chunks-grep($ pod . content,
203
212
: from({ $ _ ~~ Pod ::Heading and . level == 2 }),
@@ -213,20 +222,11 @@ sub write-language-file(:$dr, :$what, :$pod, :$podname) {
213
222
: subkinds($ what ),
214
223
: name($ operator ),
215
224
: pod($ chunk ),
225
+ : origin($ d )
216
226
:! pod-is-complete,
217
227
);
218
228
}
219
229
}
220
- my $ name = $ pod . content[0 ]. name eq " TITLE"
221
- ?? $ pod . content[0 ]. content[0 ]. content[0 ]
222
- !! $ podname ;
223
- $ dr . add-new(
224
- : kind<language >,
225
- : name($ name ),
226
- : url(" /language/$ podname" ),
227
- : $ pod ,
228
- : pod-is-complete,
229
- );
230
230
}
231
231
232
232
sub write-type-file (: $ dr , : $ what , : $ pod , : $ podname ) {
@@ -570,50 +570,6 @@ sub write-disambiguation-files($dr) {
570
570
say ' ' ;
571
571
}
572
572
573
- sub write-op-disambiguation-files ($ dr ) {
574
- say ' Writing operator disambiguation files ...' ;
575
- for $ dr . lookup(' operator' , : by<kind >). classify (*. name ). kv -> $ name , @ ops {
576
- next unless % operator_disambiguation_file_written {$ name };
577
- my $ pod = pod-with-title(" Disambiguation for '$ name '" );
578
- if @ ops == 1 {
579
- my $ p = @ ops [0 ];
580
- if $ p . origin -> $ o {
581
- $ pod . content. push :
582
- pod-block(
583
- pod-link(" '$ name ' is a $ p. human-kind ()" , $ p . url),
584
- ' from ' ,
585
- pod-link($ o . human-kind() ~ ' ' ~ $ o . name , $ o . url),
586
- );
587
- }
588
- else {
589
- $ pod . content. push :
590
- pod-block(
591
- pod-link(" '$ name ' is a $ p. human-kind ()" , $ p . url)
592
- );
593
- }
594
- }
595
- else {
596
- $ pod . content. push :
597
- pod-block(" '$ name ' can be anything of the following" ),
598
- @ ops . map ({
599
- if . origin -> $ o {
600
- pod-item(
601
- pod-link(. human-kind, . url),
602
- ' from ' ,
603
- pod-link($ o . human-kind() ~ ' ' ~ $ o . name , $ o . url),
604
- )
605
- }
606
- else {
607
- pod-item( pod-link(. human-kind, . url) )
608
- }
609
- });
610
- }
611
- my $ html = p2h($ pod , ' routine' );
612
- spurt " html/$ name .html" , $ html ;
613
- }
614
-
615
- }
616
-
617
573
sub write-index-files ($ dr ) {
618
574
# XXX: Main index file can't be generated properly until
619
575
# it is turned into a Pod file. For now, it's just static.
@@ -654,7 +610,7 @@ sub write-index-files($dr) {
654
610
. grep ({$ subkind ⊆ . subkinds})\ # XXX
655
611
. categorize (*. name ). sort (*. key )>>. value \
656
612
. map ({
657
- [set(. map : {. subkinds // Nil }). list. join (' , ' ), pod-link(. name , . url), . summary]
613
+ [set(. map : {. subkinds // Nil }). list. join (' , ' ), pod-link(. [ 0 ] . name , . [ 0 ] . url), . [ 0 ] . summary]
658
614
})
659
615
)
660
616
), $ kind );
@@ -676,7 +632,7 @@ sub write-routine-file($dr, $name) {
676
632
pod-block(" Documentation for $ subkind $ name , assembled from the
677
633
following types:" ),
678
634
@ docs . map ({
679
- pod-heading(. origin . name ~ ' . ' ~ . name ), # TODO: better way to get link to origin
635
+ pod-heading(" { . name } in { . origin . name } " ), # TODO: better way to get link to origin
680
636
pod-block(" From " , pod-link(. origin. name , . origin. url ~ ' #' ~ (. subkinds ~~ /fix / ?? . subkinds~ ' _' !! ' ' ) ~ . name )),
681
637
. pod. list,
682
638
})
0 commit comments