@@ -21,69 +21,26 @@ use MONKEY-SEE-NO-EVAL;
21
21
22
22
BEGIN say ' Initializing ...' ;
23
23
24
- use Pod ::To::HTML;
25
24
use URI::Escape;
26
- use lib ' lib ' ;
27
- use Perl6::TypeGraph ;
28
- use Perl6::TypeGraph::Viz ;
25
+
26
+ use lib ' lib ' , ' ../Pod-TreeWalker/lib ' ;
27
+ use DocSite::Pod::To::HTML ;
29
28
use Perl6::Documentable::Registry;
29
+ use Perl6::TypeGraph::Viz;
30
+ use Perl6::TypeGraph;
30
31
use Pod ::Convenience;
31
32
use Pod ::Htmlify;
32
33
33
- use experimental : cached;
34
-
35
34
my $ type-graph ;
36
35
my % routines-by-type ;
37
36
my % * POD2HTML-CALLBACKS ;
38
37
39
- # TODO: Generate menulist automatically
40
- my @ menu =
41
- (' language' ,' ' ) => (),
42
- (' type' , ' Types' ) => <basic composite domain-specific exceptions >,
43
- (' routine' , ' Routines' ) => <sub method term operator >,
44
- # ('module', 'Modules' ) => (),
45
- # ('formalities','' ) => ();
46
- ;
47
-
48
- my $ head = slurp ' template/head.html' ;
49
- sub header-html ($ current-selection = ' nothing selected' ) is cached {
50
- state $ header = slurp ' template/header.html' ;
51
-
52
- my $ menu-items = [~ ]
53
- q [ <div class="menu-items dark-green"> ] ,
54
- @ menu >>. key . map (-> ($ dir , $ name ) {qq [
55
- <a class="menu-item { $ dir eq $ current-selection ?? " selected darker-green" !! " " } "
56
- href="/$ dir .html">
57
- { $ name || $ dir . wordcase }
58
- </a>
59
- ] }), # "
60
- q [ </div> ] ;
61
-
62
- my $ sub-menu-items = ' ' ;
63
- state % sub-menus = @ menu >>. key >> [0 ] Z => @ menu >>. value ;
64
- if % sub-menus {$ current-selection } -> $ _ {
65
- $ sub-menu-items = [~ ]
66
- q [ <div class="menu-items darker-green"> ] ,
67
- qq [ <a class="menu-item" href="/$ current-selection .html">All</a> ] ,
68
- . map ({qq [
69
- <a class="menu-item" href="/$ current-selection\ -$ _ .html">
70
- { . wordcase}
71
- </a>
72
- ] }),
73
- q [ </div> ]
74
- }
75
-
76
- state $ menu-pos = ($ header ~~ /MENU /). from ;
77
- $ header . subst (' MENU' , : p($ menu-pos ), $ menu-items ~ $ sub-menu-items );
78
- }
79
-
80
38
sub p2h ($ pod , $ selection = ' nothing selected' , : $ pod-path = ' unknown' ) {
81
- pod2html $ pod ,
82
- : url(& url-munge ),
83
- : $ head ,
84
- : header(header-html $ selection ),
85
- : footer(footer-html($ pod-path )),
86
- : default-title(" Perl 6 Documentation" ),
39
+ return DocSite::Pod::To::HTML. new (
40
+ : selection($ selection ),
41
+ : pod-path($ pod-path ),
42
+ : title(' Perl 6 Documentation' ),
43
+ ). pod-to-html($ pod );
87
44
}
88
45
89
46
sub recursive-dir ($ dir ) {
@@ -243,9 +200,9 @@ multi write-type-source($doc) {
243
200
to the documentation pages for the related types. If not, try the
244
201
<a href="/images/type-graph-{ uri_escape $ podname } .png">PNG
245
202
version</a> instead.</p> ] ;
246
- $ pod . contents. append : Pod ::Raw . new (
247
- target => ' html' ,
248
- contents => $ tg-preamble ~ svg-for-file(" html/images/type-graph-$ podname .svg" ),
203
+ $ pod . contents. append : Pod ::Block::Named . new (
204
+ name => ' html' ,
205
+ contents => [ $ tg-preamble ~ svg-for-file(" html/images/type-graph-$ podname .svg" )] ,
249
206
250
207
);
251
208
0 commit comments