@@ -141,9 +141,10 @@ sub MAIN(
141
141
say ' Composing doc registry ...' ;
142
142
$ * DR . compose;
143
143
144
- for $ * DR . lookup(" language" , : by<kind >). list {
145
- say " Writing language document for { . name } ..." ;
146
- spurt " html{ . url} .html" , p2h(. pod, ' language' );
144
+ for $ * DR . lookup(" language" , : by<kind >). list -> $ doc {
145
+ $ doc . pod. contents. push : doc-source-reference($ doc );
146
+ say " Writing language document for { $ doc . name } ..." ;
147
+ spurt " html{ $ doc . url} .html" , p2h($ doc . pod, ' language' );
147
148
}
148
149
for $ * DR . lookup(" type" , : by<kind >). list {
149
150
write-type-source $ _ ;
@@ -301,6 +302,7 @@ multi write-type-source($doc) {
301
302
;
302
303
}
303
304
}
305
+ $ pod . contents. push : doc-source-reference($ doc );
304
306
}
305
307
else {
306
308
note " Type $ podname not found in type-graph data" ;
@@ -755,4 +757,19 @@ def p6format(code):
755
757
}
756
758
}
757
759
760
+ # | Append a section to the pod document referencing the source on GitHub
761
+ # | Note that we link to the raw source since GitHub isn't always able to
762
+ # | render Pod6 properly.
763
+ sub doc-source-reference ($ doc ) {
764
+ # XXX: it would be nice to have a filename attribute for pod documents
765
+ my $ pod-filename = $ doc . url. split (/\ // )[* - 1 ] ~ ' .pod' ;
766
+ my $ kind = $ doc . kind. tclc;
767
+ my @ doc-source-ref-pod =
768
+ pod-block(" This documentation was generated from " ,
769
+ pod-link(" $ pod-filename" ," https://github.com/perl6/doc/raw/master/lib/$ kind /$ pod-filename" ),
770
+ " ." );
771
+
772
+ return @ doc-source-ref-pod ;
773
+ }
774
+
758
775
# vim: expandtab shiftwidth=4 ft=perl6
0 commit comments