1 |
|
2 |
=pod
|
3 |
|
4 |
H2H -- (extended) hnf -> HTML Cnverter
|
5 |
|
6 |
Copyright 2001 the Watermelon Project.
|
7 |
|
8 |
2001-04-03 wakaba
|
9 |
- Modulization.
|
10 |
- Add `DIV' support.
|
11 |
- Add `RUBY' support (in FN).
|
12 |
|
13 |
2001-03-31 wakaba
|
14 |
- New file.
|
15 |
|
16 |
=cut
|
17 |
|
18 |
package H2H;
|
19 |
|
20 |
sub toHTML {
|
21 |
my $class = shift;
|
22 |
my ($options, @h2h) = @_;
|
23 |
my $ret;
|
24 |
if ($h2h[0] =~ /^H2H\/[\d\.]+/) {
|
25 |
$options->{version} = shift(@h2h);
|
26 |
$options->{version} =~ tr/\x0d\x0a//d;
|
27 |
}
|
28 |
unless ($options->{version}) {
|
29 |
$options->{version} = $options->{version_default} || 'H2H/0.9';
|
30 |
}
|
31 |
if ($options->{version} eq 'H2H/0.9') {
|
32 |
require H2H::V090;
|
33 |
$H2H::themepath = $options->{theme09_directory};
|
34 |
require $H2H::themepath.'default/theme.ph';
|
35 |
require $H2H::themepath.$options->{theme09}.'/theme.ph'
|
36 |
if $options->{theme09} && -e $H2H::themepath.$options->{theme09}.'/theme.ph';
|
37 |
$ret = H2H::V090->parse($options, @h2h);
|
38 |
if ($ret) {
|
39 |
$H2H::Page::options = $options;
|
40 |
$ret = ($options->{noheader}? '': &H2H::Page::start())
|
41 |
.$ret.
|
42 |
($options->{nofooter}? '': &H2H::Page::end());
|
43 |
}
|
44 |
} else{ #if ($options->{version} eq 'H2H/1.0') {
|
45 |
require H2H::V100;
|
46 |
$ret = H2H::V100->parse($options, @h2h);
|
47 |
}
|
48 |
$ret;
|
49 |
}
|
50 |
|
51 |
sub header {
|
52 |
my $class = shift;
|
53 |
my $options = shift;
|
54 |
$options->{version} ||= 'H2H/0.9';
|
55 |
my $ret;
|
56 |
if ($options->{version} eq 'H2H/0.9') {
|
57 |
require H2H::V090;
|
58 |
$H2H::themepath = $options->{theme09_directory};
|
59 |
require $H2H::themepath.'default/theme.ph';
|
60 |
require $H2H::themepath.$options->{theme09}.'/theme.ph'
|
61 |
if $options->{theme09} && -e $H2H::themepath.$options->{theme09}.'/theme.ph';
|
62 |
$ret = H2H::Page::start();
|
63 |
} else{ #if ($options->{version} eq 'H2H/1.0') {
|
64 |
require H2H::V100;
|
65 |
$ret = H2H::V100->header($options);
|
66 |
}
|
67 |
$ret;
|
68 |
}
|
69 |
|
70 |
sub footer {
|
71 |
my $class = shift;
|
72 |
my $options = shift;
|
73 |
$options->{version} ||= 'H2H/0.9';
|
74 |
my $ret;
|
75 |
if ($options->{version} eq 'H2H/0.9') {
|
76 |
require H2H::V090;
|
77 |
$H2H::themepath = $options->{theme09_directory};
|
78 |
require $H2H::themepath.'default/theme.ph';
|
79 |
require $H2H::themepath.$options->{theme09}.'/theme.ph'
|
80 |
if $options->{theme09} && -e $H2H::themepath.$options->{theme09}.'/theme.ph';
|
81 |
$ret = H2H::Page::end();
|
82 |
} else{ #if ($options->{version} eq 'H2H/1.0') {
|
83 |
require H2H::V100;
|
84 |
$ret = H2H::V100->footer($options);
|
85 |
}
|
86 |
$ret;
|
87 |
}
|
88 |
|
89 |
1;
|