@@ -128,10 +128,9 @@ sub MAIN(
128
128
say ' Reading type graph ...' ;
129
129
$ tg = Perl6::TypeGraph. new-from-file(' type-graph.txt' );
130
130
my % h = $ tg . sorted. kv . flat . reverse ;
131
+ write-type-graph-images(: force($ typegraph ));
131
132
132
133
process-pod-dir ' Language' , : $ sparse ;
133
- write-type-graph-images(: force($ typegraph ));
134
- # XXX: Generalize
135
134
process-pod-dir ' Type' , : sorted-by{ % h {. key } // -1 }, : $ sparse ;
136
135
for $ * DR . lookup(" type" , : by<kind >). list {
137
136
write-type-source $ _ ;
@@ -144,19 +143,9 @@ sub MAIN(
144
143
write-search-file if $ search-file ;
145
144
write-index-files;
146
145
147
- say ' Writing per-routine files ...' ;
148
- for $ * DR . lookup(' routine' , : by<kind >). unique (: as{. name }) -> $ d {
149
- write-routine-file($ d . name );
150
- print ' .'
146
+ for <routine syntax > -> $ kind {
147
+ write-kind $ kind ;
151
148
}
152
- say ' ' ;
153
-
154
- say ' Writing per-syntactic-feature files ...' ;
155
- for $ * DR . lookup(' syntax' , : by<kind >). unique (: as{. name }). list -> $ d {
156
- write-syntax-file($ d . name );
157
- print ' .'
158
- }
159
- say ' ' ;
160
149
161
150
say ' Processing complete.' ;
162
151
if $ sparse || ! $ search-file || ! $ disambiguation {
@@ -673,43 +662,29 @@ sub write-sub-index(:$kind, :$category, :&summary = {Nil}) {
673
662
), $ kind );
674
663
}
675
664
676
- sub write-routine-file ($ name ) {
677
- say ' Writing html/routine/$name.html ...' if $ * DEBUG ;
678
- my @ docs = $ * DR . lookup($ name , : by<name >). grep (*. kind eq ' routine' );
679
- my $ subkind = ' routine' ;
680
- {
681
- my @ subkinds = @ docs >>. subkinds;
682
- $ subkind = @ subkinds [0 ] if all (@ subkinds >>. defined ) && [eq ] @ subkinds ;
683
- }
684
- my $ pod = pod-with-title(" Documentation for $ subkind $ name" ,
685
- pod-block(" Documentation for $ subkind $ name , assembled from the
686
- following types:" ),
687
- @ docs . map ({
688
- pod-heading(" { . origin. human-kind} { . origin. name } " ),
689
- pod-block(" From " , pod-link(. origin. name , . origin. url ~ ' #' ~ (. subkinds~ ' _' if . subkinds ~~ /fix /) ~ . name )),
690
- . pod. list,
691
- })
692
- );
693
- spurt " html/routine/$ name .html" , p2h($ pod , ' routine' );
694
- }
695
-
696
- sub write-syntax-file ($ name ) {
697
- say ' Writing html/syntax/$name.html ...' if $ * DEBUG ;
698
- my @ docs = $ * DR . lookup($ name , : by<name >). grep (*. kind eq ' syntax' );
699
- my $ subkind = ' syntactic feature' ;
700
- {
701
- my @ subkinds = @ docs >>. subkinds;
702
- $ subkind = @ subkinds [0 ] if all (@ subkinds >>. defined ) && [eq ] @ subkinds ;
703
- }
704
- my $ pod = pod-with-title(" Documentation for $ subkind $ name" ,
705
- pod-block(" Documentation for $ subkind $ name" ),
706
- @ docs . map ({
707
- pod-heading(" { . origin. human-kind} { . origin. name } " ),
708
- pod-block(" From " , pod-link(. origin. name , . origin. url ~ ' #' ~ (. subkinds~ ' _' if . subkinds ~~ /fix /) ~ . name )),
709
- . pod. list,
710
- })
711
- );
712
- spurt " html/syntax/$ name. subst (/<[ /\\ ] > /,' _' ,: g) .html" , p2h($ pod , ' syntax' );
665
+ sub write-kind ($ kind ) {
666
+ say " Writing per-$ kind files ..." ;
667
+ $ * DR . lookup($ kind , : by<kind >)\
668
+ . categorize ({. name })\
669
+ . kv . map : -> $ name , @ docs {
670
+ my @ subkinds = @ docs . map ({. subkinds}). unique ;
671
+ my $ subkind = @ subkinds . elems == 1 ?? @ subkinds . list[0 ] !! $ kind ;
672
+ my $ pod = pod-with-title(
673
+ " Documentation for $ subkind $ name" ,
674
+ pod-block(" Documentation for $ subkind $ name , assembled from the following types:" ),
675
+ @ docs . map ({
676
+ pod-heading(" { . origin. human-kind} { . origin. name } " ),
677
+ pod-block(" From " ,
678
+ pod-link(. origin. name ,
679
+ . origin. url ~ ' #' ~ (. subkinds~ ' _' if . subkinds ~~ /fix /) ~ . name ),
680
+ ),
681
+ . pod. list,
682
+ })
683
+ );
684
+ print ' .' ;
685
+ spurt " html/$ kind /$ name. subst (/<[ /\\ ] > /,' _' ,: g) .html" , p2h($ pod , $ kind );
686
+ }
687
+ say ' ' ;
713
688
}
714
689
715
690
sub write-qualified-method-call (: $ name ! , : $ pod ! , : $ type ! ) {
0 commit comments