summaryrefslogtreecommitdiff
path: root/lib/WebCoso/Doc/Base.pm
blob: 6037ff9a65b1411550ec758f8fa7849ddf0c0cae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# -*- mode: perl6 -*- 
use WebCoso::Maker::TT;
use WebCoso::Maker::RST;
use WebCoso::Maker::XHTML;
use WebCoso::Maker::HTML;
 
class WebCoso::Doc::Base {
    has $!wc;
    has $.dir;
 
    has $.tt;
    has $.rst;
    has $.xhtml;
    has $.html;
 
    method basename() { ... }
 
    submethod BUILD(:$!wc,:$!dir) {
        my $basename = self.basename;
        $!tt = WebCoso::Maker::TT.new(:$basename,:$!dir,:$!wc);
        $!rst = WebCoso::Maker::RST.new(:$basename,:$!dir,:$!wc);
        $!xhtml = WebCoso::Maker::XHTML.new(:$basename,:$!dir,:$!wc);
        $!html = WebCoso::Maker::HTML.new(:$basename,:$!dir,:$!wc);
    }
 
    method make-by-ext($ext) {
        say "Doc::Base($.dir/$.basename)::make-by-ext($ext)";
        given $ext {
            when 'rest.txt' { return $.tt.make() }
            when 'du.xml' { return $.rst.make() }
            when 'xhtml' { return $.xhtml.make() }
            when 'html' { return $.html.make() }
            default: { return () }
        }
    }
    
    method make() {
        say "Doc::Base($.dir/$.basename)::make";
        $.make-by-ext('html');
    }
}