/[suikacvs]/markup/h2h/implementation/classic/H2H/V100/Theme/Default.pm
Suika

Contents of /markup/h2h/implementation/classic/H2H/V100/Theme/Default.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Sat Jul 19 12:46:44 2003 UTC (22 years, 11 months ago) by wakaba
Branch: MAIN
CVS Tags: HEAD
Branch point for: norakuro-d
Imported to CVS

1
2 =head1 NAME
3
4 H2H/1.0
5 Default Theme
6
7 =cut
8
9 package H2H::V100;
10 #%template = ();
11
12 sub init_theme {
13 my $self = shift;
14 $self->{template}->{headerfile} ||= $self->{template}->{directory}.'header.htt';
15 $self->{template}->{footerfile} ||= $self->{template}->{directory}.'footer.htt';
16 undef $self->{template}->{headerfile} if $self->{template}->{noheader};
17 undef $self->{template}->{footerfile} if $self->{template}->{nofooter};
18 $self->{template}->{_BODY_param}->{id} = $self->{template}->{prefix};
19 $self;
20 }
21
22 =head1 H2H::V100::Document
23
24 Templates for output-document.
25
26 =cut
27
28 package H2H::URI;
29 $mine = '';
30 $diary = '_diary_';
31 $glossary{_} = '_glossary_#';
32 $glossary{person} = '_person_#';
33 $resolve = '/uri?uri=';
34
35 package H2H::V100::Document;
36 #$template = \%H2H::V100::template;
37
38 sub header {
39 my $self = shift;
40 return unless $self->{template}->{headerfile};
41 my $ret;
42 if (open HDR, $self->{template}->{headerfile}) {
43 $ret = join('', <HDR>);
44 close HDR;
45 for $i (keys %{$self->{template}}) {
46 $ret =~ s/\Q%$i%\E/$self->{template}->{$i}/g;
47 }
48 }
49 $ret;
50 }
51 sub footer {
52 my $self = shift;
53 return unless $self->{template}->{footerfile};
54 my $ret;
55 if (open HDR, $self->{template}->{footerfile}) {
56 $ret = join('', <HDR>);
57 close HDR;
58 for $i (keys %{$self->{template}}) {
59 $ret =~ s/\Q%$i%\E/$self->{template}->{$i}/g;
60 }
61 }
62 $ret;
63 }
64
65 =head1 Tree()
66
67 Not implemented yet.
68
69 =cut
70
71 sub Tree {
72 }
73
74 =head1 H2H::V100::headervalue
75
76 HeaderValue.
77 This will be removed and moved to command module
78 in future version of H2H.
79
80 =head2 replace
81
82 %name => Value Name
83 %value => Value.
84
85 =cut
86
87 package H2H::V100::headervalue;
88 %hdrtemplate = (
89 _default => '%name = %value',
90 );
91
92 sub start {
93 '<div class="header">';
94 }
95 sub end {
96 '</div><!-- header -->'."\n";
97 }
98
99 sub replace {
100 my $self = shift;
101 my %o = @_;
102 my $t = $hdrtemplate{$o{name}} || $hdrtemplate{_default};
103 $self->{template}->{header}->{$o{name}}->{'text/x-h2h'} = $o{value};
104 return &$t(%o) if ref $t;
105 $t =~ s/%name/$o{name}/g;
106 $t =~ s/%value/$o{value}/g; ## TO DO: __html_ent()
107 $o{href} = H2H::V100::Command::_BLOCK::__uri_norm(1, $o{href}) if $o{href};
108 $t = '<a href="'.$o{href}.'">'.$t.'</a>' if $o{href};
109 '<span class="var '.$o{name}.'">'.$t.'</span>'."\n";
110 }
111
112 =head1 LICENSE
113
114 Public Domain.
115
116 =head1 CHANGE
117
118 2001-09-05 wakaba <wakaba@suika.fam.cx>
119
120 * (headervalue::replace): Fix problem that uri norm wasn't supported.
121
122 2001-08-20 wakaba <wakaba@suika.fam.cx>
123
124 * (theme_init): noheader, nofooter support.
125
126 2001-08-20 wakaba <wakaba@suika.fam.cx>
127
128 * (theme_init): Fix bug that template->prefix was not applied.
129
130 2001-08-11 wakaba <wakaba@suika.fam.cx>
131
132 * New file.
133
134 =cut
135
136 1;

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24