-
Notifications
You must be signed in to change notification settings - Fork 138
/
mk_chm.pl
112 lines (91 loc) · 2.23 KB
/
mk_chm.pl
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#! perl
# Copyright (C) 2009, Parrot Foundation.
=head1 TITLE
tools/dev/mk_chm.pl - Create files for HTML Help Workshop
=head1 SYNOPSIS
% perl tools/dev/mk_chm.pl
=head1 DESCRIPTION
Alters files in docs/html and creates the following files :
parrot.hhp
index.hhk
toc.hhc
=cut
use strict;
use warnings;
use lib qw( lib ../lib ../../lib );
use File::Copy;
use File::Find;
use Parrot::Config;
use Parrot::Docs::Section::Parrot;
copy('docs/resources/parrot.css', 'docs/html/parrot.css');
copy('docs/resources/parrot_logo.png', 'docs/html/parrot_logo.png');
copy('docs/pdds/pdd15_object_metamodel.png', 'docs/html/docs/pdds/pdd15_object_metamodel.png');
find(\&alter_html, 'docs/html');
sub alter_html {
return unless (/\.html$/);
system(qq{perl -i.bak -pe "s{\.\./resources/}{};" $_});
}
my $version = $PConfig{VERSION} . $PConfig{DEVEL};
my $docs = Parrot::Docs::Section::Parrot->new;
my $dist = Parrot::Distribution->new;
my $toc = $docs->build_toc_chm( $dist );
my $index = $docs->build_index_chm( $dist );
my $filename = 'docs/html/parrot.hhp';
open my $OUT, '>', $filename
or die "Can't open $filename ($!)";
print $OUT <<"TEXT";
[OPTIONS]
Binary TOC=Yes
Compatibility=1.1 or later
Compiled file=Parrot-$version.chm
Contents file=toc.hhc
Default Window=Main
Default topic=index.html
Display compile progress=Yes
Full-text search=Yes
Index file=index.hhk
Language=0x0409 English (UNITED STATES)
Title=Parrot VM $version
[WINDOWS]
Main=,"toc.hhc","index.hhk","index.html","index.html",,,,,0x22520,,0x60304e,,,,,,,,0
[FILES]
index.html
TEXT
close $OUT;
$filename = 'docs/html/index.hhk';
open $OUT, '>', $filename
or die "Can't open $filename ($!)";
print $OUT <<"TEXT";
<HTML>
<HEAD>
<meta name="generator" content="(Perl $])">
</HEAD><BODY>
<UL>
$index
</UL>
</BODY></HTML>
TEXT
close $OUT;
$filename = 'docs/html/toc.hhc';
open $OUT, '>', $filename
or die "Can't open $filename ($!)";
print $OUT <<"TEXT";
<HTML>
<HEAD>
<meta name="generator" content="(Perl $])">
</HEAD><BODY>
<OBJECT type="text/site properties">
<param name="ImageType" value="Folder">
</OBJECT>
<UL>
$toc
-</UL>
</BODY></HTML>
TEXT
close $OUT;
# Local Variables:
# mode: cperl
# cperl-indent-level: 4
# fill-column: 100
# End:
# vim: expandtab shiftwidth=4: