line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package XML::Handler::Dtd2DocBook;
|
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
953
|
use base qw(XML::Handler::Dtd2Html);
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
1988
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use vars qw($VERSION);
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
$VERSION="0.41";
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new {
|
11
|
|
|
|
|
|
|
my $proto = shift;
|
12
|
|
|
|
|
|
|
my $class = ref($proto) || $proto;
|
13
|
|
|
|
|
|
|
my $self = {
|
14
|
|
|
|
|
|
|
doc => new XML::Handler::Dtd2DocBook::Document(),
|
15
|
|
|
|
|
|
|
comments => []
|
16
|
|
|
|
|
|
|
};
|
17
|
|
|
|
|
|
|
bless($self, $class);
|
18
|
|
|
|
|
|
|
return $self;
|
19
|
|
|
|
|
|
|
}
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
###############################################################################
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
package XML::Handler::Dtd2DocBook::Document;
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
use HTML::Template;
|
26
|
|
|
|
|
|
|
use File::Basename;
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
use base qw(XML::Handler::Dtd2Html::DocumentBook);
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub new {
|
31
|
|
|
|
|
|
|
my $proto = shift;
|
32
|
|
|
|
|
|
|
my $class = ref($proto) || $proto;
|
33
|
|
|
|
|
|
|
my $self = $class->SUPER::new();
|
34
|
|
|
|
|
|
|
$self->{hlink} = 0;
|
35
|
|
|
|
|
|
|
$self->{preformatted} = "programlisting";
|
36
|
|
|
|
|
|
|
$self->{emphasis} = "emphasis";
|
37
|
|
|
|
|
|
|
$self->{width} = 65;
|
38
|
|
|
|
|
|
|
bless($self, $class);
|
39
|
|
|
|
|
|
|
return $self;
|
40
|
|
|
|
|
|
|
}
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub _process_args {
|
43
|
|
|
|
|
|
|
my $self = shift;
|
44
|
|
|
|
|
|
|
my %hash = @_;
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
$self->SUPER::_process_args(@_);
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
$self->{generator} = "dtd2db " . $XML::Handler::Dtd2DocBook::VERSION . " (Perl " . $] . ")";
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
if (defined $hash{path_tmpl}) {
|
51
|
|
|
|
|
|
|
$self->{path_tmpl} = [ $hash{path_tmpl} ];
|
52
|
|
|
|
|
|
|
} else {
|
53
|
|
|
|
|
|
|
my $language = $hash{language} || 'en';
|
54
|
|
|
|
|
|
|
my $path = $INC{'XML/Handler/Dtd2DocBook.pm'};
|
55
|
|
|
|
|
|
|
$path =~ s/\.pm$//i;
|
56
|
|
|
|
|
|
|
$self->{path_tmpl} = [ $path . '/' . $language, $path ];
|
57
|
|
|
|
|
|
|
}
|
58
|
|
|
|
|
|
|
}
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub _mk_text_anchor {
|
61
|
|
|
|
|
|
|
my $self = shift;
|
62
|
|
|
|
|
|
|
my($type, $name) = @_;
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
my $linkend = $type . "." . $name;
|
65
|
|
|
|
|
|
|
return "" . $name . "";
|
66
|
|
|
|
|
|
|
}
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub _mk_index_anchor {
|
69
|
|
|
|
|
|
|
my $self = shift;
|
70
|
|
|
|
|
|
|
my($type, $name) = @_;
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
return $name;
|
73
|
|
|
|
|
|
|
}
|
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub _mk_outfile {
|
76
|
|
|
|
|
|
|
my $self = shift;
|
77
|
|
|
|
|
|
|
my($type, $name) = @_;
|
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
my $uri_name = $name;
|
80
|
|
|
|
|
|
|
$uri_name =~ s/[ :]/_/g;
|
81
|
|
|
|
|
|
|
$uri_name = $self->_mk_filename($uri_name);
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
return $self->{outfile} . "." . $type . "." . $uri_name . ".gen";
|
84
|
|
|
|
|
|
|
}
|
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub _mk_system {
|
87
|
|
|
|
|
|
|
my $self = shift;
|
88
|
|
|
|
|
|
|
my($type, $name) = @_;
|
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
my $uri_name = $name;
|
91
|
|
|
|
|
|
|
$uri_name =~ s/[ :]/_/g;
|
92
|
|
|
|
|
|
|
$uri_name = $self->_mk_filename($uri_name);
|
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
return $self->{basename} . "." . $type . "." . $uri_name . ".gen";
|
95
|
|
|
|
|
|
|
}
|
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub _get_doc_attrs {
|
98
|
|
|
|
|
|
|
my $self = shift;
|
99
|
|
|
|
|
|
|
my ($name) = @_;
|
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
my @doc_attrs = ();
|
102
|
|
|
|
|
|
|
my @attrs = ();
|
103
|
|
|
|
|
|
|
if (exists $self->{hash_attr}->{$name}) {
|
104
|
|
|
|
|
|
|
foreach my $attr (@{$self->{hash_attr}->{$name}}) {
|
105
|
|
|
|
|
|
|
my @doc = ();
|
106
|
|
|
|
|
|
|
my @tag = ();
|
107
|
|
|
|
|
|
|
if ($self->{flag_comment} and exists $attr->{comments}) {
|
108
|
|
|
|
|
|
|
foreach my $comment (@{$attr->{comments}}) {
|
109
|
|
|
|
|
|
|
my ($doc, $r_tags) = $self->_extract_doc($comment);
|
110
|
|
|
|
|
|
|
if (defined $doc) {
|
111
|
|
|
|
|
|
|
my $data = $self->_process_text($doc, $name);
|
112
|
|
|
|
|
|
|
push @doc, { data => $data };
|
113
|
|
|
|
|
|
|
}
|
114
|
|
|
|
|
|
|
foreach (@{$r_tags}) {
|
115
|
|
|
|
|
|
|
my ($href, $entry, $data) = @{$_};
|
116
|
|
|
|
|
|
|
unless ( uc($entry) eq "BRIEF"
|
117
|
|
|
|
|
|
|
or uc($entry) eq "HIDDEN" ) {
|
118
|
|
|
|
|
|
|
if ($entry =~ /^SAMPLE($|\s)/i) {
|
119
|
|
|
|
|
|
|
$entry =~ s/^SAMPLE\s*//i;
|
120
|
|
|
|
|
|
|
$data = "<$self->{preformatted}>" . $self->_mk_example($data) . "$self->{preformatted}>";
|
121
|
|
|
|
|
|
|
push @tag, {
|
122
|
|
|
|
|
|
|
entry => $entry,
|
123
|
|
|
|
|
|
|
data => $data,
|
124
|
|
|
|
|
|
|
};
|
125
|
|
|
|
|
|
|
} else {
|
126
|
|
|
|
|
|
|
$data = $self->_process_text($data, $name, $href);
|
127
|
|
|
|
|
|
|
push @tag, {
|
128
|
|
|
|
|
|
|
entry => $entry,
|
129
|
|
|
|
|
|
|
data => $data,
|
130
|
|
|
|
|
|
|
};
|
131
|
|
|
|
|
|
|
}
|
132
|
|
|
|
|
|
|
}
|
133
|
|
|
|
|
|
|
}
|
134
|
|
|
|
|
|
|
}
|
135
|
|
|
|
|
|
|
}
|
136
|
|
|
|
|
|
|
push @doc_attrs, {
|
137
|
|
|
|
|
|
|
name_ent => "elt." . $name . "." . $attr->{aName},
|
138
|
|
|
|
|
|
|
name => $attr->{aName},
|
139
|
|
|
|
|
|
|
doc => [ @doc ],
|
140
|
|
|
|
|
|
|
tag => [ @tag ],
|
141
|
|
|
|
|
|
|
};
|
142
|
|
|
|
|
|
|
push @attrs, {
|
143
|
|
|
|
|
|
|
name_ent => "elt." . $name . "." . $attr->{aName},
|
144
|
|
|
|
|
|
|
};
|
145
|
|
|
|
|
|
|
}
|
146
|
|
|
|
|
|
|
}
|
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
return (\@doc_attrs, \@attrs);
|
149
|
|
|
|
|
|
|
}
|
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
sub _mk_tree {
|
152
|
|
|
|
|
|
|
my $self = shift;
|
153
|
|
|
|
|
|
|
my ($name, $depth) = @_;
|
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
return if ($self->{hash_element}->{$name}->{done});
|
156
|
|
|
|
|
|
|
$self->{hash_element}->{$name}->{done} = 1;
|
157
|
|
|
|
|
|
|
die __PACKAGE__,"_mk_tree: INTERNAL ERROR ($name).\n"
|
158
|
|
|
|
|
|
|
unless (defined $self->{hash_element}->{$name}->{uses});
|
159
|
|
|
|
|
|
|
return unless (scalar keys %{$self->{hash_element}->{$name}->{uses}});
|
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
my %done = ();
|
162
|
|
|
|
|
|
|
$self->{_tree_depth} = $depth if ($depth > $self->{_tree_depth});
|
163
|
|
|
|
|
|
|
$self->{_tree} .= "\n";
|
164
|
|
|
|
|
|
|
foreach (keys %{$self->{hash_element}->{$name}->{uses}}) {
|
165
|
|
|
|
|
|
|
next if ($_ eq $name);
|
166
|
|
|
|
|
|
|
next if (exists $done{$_});
|
167
|
|
|
|
|
|
|
$done{$_} = 1;
|
168
|
|
|
|
|
|
|
$self->{_tree} .= " " . $self->_mk_text_anchor("elt", $_) . "\n";
|
169
|
|
|
|
|
|
|
$self->_mk_tree($_, $depth+1);
|
170
|
|
|
|
|
|
|
$self->{_tree} .= " \n";
|
171
|
|
|
|
|
|
|
}
|
172
|
|
|
|
|
|
|
$self->{_tree} .= "\n";
|
173
|
|
|
|
|
|
|
}
|
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
sub generateTree {
|
176
|
|
|
|
|
|
|
my $self = shift;
|
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
$self->{_tree_depth} = 1;
|
179
|
|
|
|
|
|
|
$self->{_tree} = "\n";
|
180
|
|
|
|
|
|
|
$self->{_tree} .= " " . $self->_mk_text_anchor("elt", $self->{root_name}) . "\n";
|
181
|
|
|
|
|
|
|
if (exists $self->{hash_element}->{$self->{root_name}}) {
|
182
|
|
|
|
|
|
|
$self->_mk_tree($self->{root_name}, $self->{_tree_depth});
|
183
|
|
|
|
|
|
|
} else {
|
184
|
|
|
|
|
|
|
warn "$self->{root_name} declared in DOCTYPE is an unknown element.\n";
|
185
|
|
|
|
|
|
|
}
|
186
|
|
|
|
|
|
|
$self->{_tree} .= " \n";
|
187
|
|
|
|
|
|
|
$self->{_tree} .= "\n";
|
188
|
|
|
|
|
|
|
$self->{_tree} = "" if ($self->{_tree_depth} > 7);
|
189
|
|
|
|
|
|
|
$self->{template}->param(
|
190
|
|
|
|
|
|
|
tree => $self->{_tree},
|
191
|
|
|
|
|
|
|
);
|
192
|
|
|
|
|
|
|
delete $self->{_tree};
|
193
|
|
|
|
|
|
|
}
|
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
sub generateEntity {
|
196
|
|
|
|
|
|
|
my $self = shift;
|
197
|
|
|
|
|
|
|
my ($prefix, $r_list) = @_;
|
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
my @ent = ();
|
200
|
|
|
|
|
|
|
foreach (@{$r_list}) {
|
201
|
|
|
|
|
|
|
push @ent, {
|
202
|
|
|
|
|
|
|
name => "&${prefix}.$_;",
|
203
|
|
|
|
|
|
|
};
|
204
|
|
|
|
|
|
|
}
|
205
|
|
|
|
|
|
|
$self->{template}->param(
|
206
|
|
|
|
|
|
|
ent => \@ent,
|
207
|
|
|
|
|
|
|
);
|
208
|
|
|
|
|
|
|
}
|
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
sub GenerateDocBook {
|
211
|
|
|
|
|
|
|
my $self = shift;
|
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
warn "No element declaration captured.\n"
|
214
|
|
|
|
|
|
|
unless (scalar keys %{$self->{hash_element}});
|
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
$self->_process_args(@_);
|
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
$self->_test_sensitive();
|
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
my @elements = sort keys %{$self->{hash_element}};
|
221
|
|
|
|
|
|
|
my @entities = sort keys %{$self->{hash_entity}};
|
222
|
|
|
|
|
|
|
my @notations = sort keys %{$self->{hash_notation}};
|
223
|
|
|
|
|
|
|
my @examples = @{$self->{examples}};
|
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
my $template = "book.tmpl";
|
226
|
|
|
|
|
|
|
$self->{template} = new HTML::Template(
|
227
|
|
|
|
|
|
|
filename => $template,
|
228
|
|
|
|
|
|
|
path => $self->{path_tmpl},
|
229
|
|
|
|
|
|
|
);
|
230
|
|
|
|
|
|
|
die "can't create template with $template ($!).\n"
|
231
|
|
|
|
|
|
|
unless (defined $self->{template});
|
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
$self->{template}->param(
|
234
|
|
|
|
|
|
|
generator => $self->{generator},
|
235
|
|
|
|
|
|
|
date => $self->{now},
|
236
|
|
|
|
|
|
|
);
|
237
|
|
|
|
|
|
|
$self->{template}->param(
|
238
|
|
|
|
|
|
|
name => $self->{basename},
|
239
|
|
|
|
|
|
|
title => $self->{title},
|
240
|
|
|
|
|
|
|
nb_elt => scalar @elements,
|
241
|
|
|
|
|
|
|
nb_ent => scalar @entities,
|
242
|
|
|
|
|
|
|
nb_not => scalar @notations,
|
243
|
|
|
|
|
|
|
nb_ex => scalar @examples,
|
244
|
|
|
|
|
|
|
);
|
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
my $filename = $self->{outfile} . ".xml";
|
247
|
|
|
|
|
|
|
open OUT, "> $filename"
|
248
|
|
|
|
|
|
|
or die "can't open $filename ($!)\n";
|
249
|
|
|
|
|
|
|
print OUT $self->{template}->output();
|
250
|
|
|
|
|
|
|
close OUT;
|
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
$template = "prolog.tmpl";
|
253
|
|
|
|
|
|
|
$self->{template} = new HTML::Template(
|
254
|
|
|
|
|
|
|
filename => $template,
|
255
|
|
|
|
|
|
|
path => $self->{path_tmpl},
|
256
|
|
|
|
|
|
|
);
|
257
|
|
|
|
|
|
|
die "can't create template with $template ($!).\n"
|
258
|
|
|
|
|
|
|
unless (defined $self->{template});
|
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
$self->{template}->param(
|
261
|
|
|
|
|
|
|
generator => $self->{generator},
|
262
|
|
|
|
|
|
|
date => $self->{now},
|
263
|
|
|
|
|
|
|
);
|
264
|
|
|
|
|
|
|
$self->{template}->param(
|
265
|
|
|
|
|
|
|
name => $self->{dtd}->{Name},
|
266
|
|
|
|
|
|
|
publicId => $self->{dtd}->{PublicId},
|
267
|
|
|
|
|
|
|
systemId => $self->{dtd}->{SystemId},
|
268
|
|
|
|
|
|
|
);
|
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
$filename = $self->{outfile} . ".prolog.gen";
|
271
|
|
|
|
|
|
|
open OUT, "> $filename"
|
272
|
|
|
|
|
|
|
or die "can't open $filename ($!)\n";
|
273
|
|
|
|
|
|
|
print OUT $self->{template}->output();
|
274
|
|
|
|
|
|
|
close OUT;
|
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
if (scalar @elements) {
|
277
|
|
|
|
|
|
|
$template = "index.tmpl";
|
278
|
|
|
|
|
|
|
$self->{template} = new HTML::Template(
|
279
|
|
|
|
|
|
|
filename => $template,
|
280
|
|
|
|
|
|
|
path => $self->{path_tmpl},
|
281
|
|
|
|
|
|
|
);
|
282
|
|
|
|
|
|
|
die "can't create template with $template ($!).\n"
|
283
|
|
|
|
|
|
|
unless (defined $self->{template});
|
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
$self->{template}->param(
|
286
|
|
|
|
|
|
|
generator => $self->{generator},
|
287
|
|
|
|
|
|
|
date => $self->{now},
|
288
|
|
|
|
|
|
|
);
|
289
|
|
|
|
|
|
|
$self->{template}->param(
|
290
|
|
|
|
|
|
|
idx_elt => 1,
|
291
|
|
|
|
|
|
|
idx_ent => 0,
|
292
|
|
|
|
|
|
|
idx_not => 0,
|
293
|
|
|
|
|
|
|
lst_ex => 0,
|
294
|
|
|
|
|
|
|
);
|
295
|
|
|
|
|
|
|
$self->generateEntity("elt", \@elements);
|
296
|
|
|
|
|
|
|
$self->generateTree();
|
297
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
$filename = $self->{outfile} . ".elements.gen";
|
299
|
|
|
|
|
|
|
open OUT, "> $filename"
|
300
|
|
|
|
|
|
|
or die "can't open $filename ($!)\n";
|
301
|
|
|
|
|
|
|
print OUT $self->{template}->output();
|
302
|
|
|
|
|
|
|
close OUT;
|
303
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
$template = "element.tmpl";
|
305
|
|
|
|
|
|
|
$self->{template} = new HTML::Template(
|
306
|
|
|
|
|
|
|
filename => $template,
|
307
|
|
|
|
|
|
|
path => $self->{path_tmpl},
|
308
|
|
|
|
|
|
|
loop_context_vars => 1,
|
309
|
|
|
|
|
|
|
);
|
310
|
|
|
|
|
|
|
die "can't create template with $template ($!).\n"
|
311
|
|
|
|
|
|
|
unless (defined $self->{template});
|
312
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
$self->{template}->param(
|
314
|
|
|
|
|
|
|
generator => $self->{generator},
|
315
|
|
|
|
|
|
|
date => $self->{now},
|
316
|
|
|
|
|
|
|
);
|
317
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
$filename = $self->{outfile} . ".elements.ent";
|
319
|
|
|
|
|
|
|
open ENT, "> $filename"
|
320
|
|
|
|
|
|
|
or die "can't open $filename ($!)\n";
|
321
|
|
|
|
|
|
|
|
322
|
|
|
|
|
|
|
foreach my $name (@elements) {
|
323
|
|
|
|
|
|
|
my $decl = $self->{hash_element}->{$name};
|
324
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
my $model = $decl->{Model};
|
326
|
|
|
|
|
|
|
$self->{template}->param(
|
327
|
|
|
|
|
|
|
name => $name,
|
328
|
|
|
|
|
|
|
fname => $self->_mk_filename($name),
|
329
|
|
|
|
|
|
|
f_model => $self->_format_content_model($model),
|
330
|
|
|
|
|
|
|
attrs => $self->_get_attributes($name),
|
331
|
|
|
|
|
|
|
parents => $self->_get_parents($decl),
|
332
|
|
|
|
|
|
|
childs => $self->_get_childs($decl),
|
333
|
|
|
|
|
|
|
is_mixed => ($model =~ /#PCDATA/) ? 1 : 0,
|
334
|
|
|
|
|
|
|
is_element => ($model !~ /(ANY|EMPTY)/) ? 1 : 0,
|
335
|
|
|
|
|
|
|
);
|
336
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
$filename = $self->_mk_outfile("elt", $name);
|
338
|
|
|
|
|
|
|
open OUT, "> $filename"
|
339
|
|
|
|
|
|
|
or die "can't open $filename ($!)\n";
|
340
|
|
|
|
|
|
|
print OUT $self->{template}->output();
|
341
|
|
|
|
|
|
|
close OUT;
|
342
|
|
|
|
|
|
|
my $sys = $self->_mk_system("elt", $name);
|
343
|
|
|
|
|
|
|
print ENT "\n";
|
344
|
|
|
|
|
|
|
}
|
345
|
|
|
|
|
|
|
close ENT;
|
346
|
|
|
|
|
|
|
}
|
347
|
|
|
|
|
|
|
|
348
|
|
|
|
|
|
|
if (scalar @entities) {
|
349
|
|
|
|
|
|
|
$template = "index.tmpl";
|
350
|
|
|
|
|
|
|
$self->{template} = new HTML::Template(
|
351
|
|
|
|
|
|
|
filename => $template,
|
352
|
|
|
|
|
|
|
path => $self->{path_tmpl},
|
353
|
|
|
|
|
|
|
);
|
354
|
|
|
|
|
|
|
die "can't create template with $template ($!).\n"
|
355
|
|
|
|
|
|
|
unless (defined $self->{template});
|
356
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
$self->{template}->param(
|
358
|
|
|
|
|
|
|
generator => $self->{generator},
|
359
|
|
|
|
|
|
|
date => $self->{now},
|
360
|
|
|
|
|
|
|
);
|
361
|
|
|
|
|
|
|
$self->{template}->param(
|
362
|
|
|
|
|
|
|
idx_elt => 0,
|
363
|
|
|
|
|
|
|
idx_ent => 1,
|
364
|
|
|
|
|
|
|
idx_not => 0,
|
365
|
|
|
|
|
|
|
lst_ex => 0,
|
366
|
|
|
|
|
|
|
);
|
367
|
|
|
|
|
|
|
$self->generateEntity("ent", \@entities);
|
368
|
|
|
|
|
|
|
|
369
|
|
|
|
|
|
|
$filename = $self->{outfile} . ".entities.gen";
|
370
|
|
|
|
|
|
|
open OUT, "> $filename"
|
371
|
|
|
|
|
|
|
or die "can't open $filename ($!)\n";
|
372
|
|
|
|
|
|
|
print OUT $self->{template}->output();
|
373
|
|
|
|
|
|
|
close OUT;
|
374
|
|
|
|
|
|
|
|
375
|
|
|
|
|
|
|
$template = "entity.tmpl";
|
376
|
|
|
|
|
|
|
$self->{template} = new HTML::Template(
|
377
|
|
|
|
|
|
|
filename => $template,
|
378
|
|
|
|
|
|
|
path => $self->{path_tmpl},
|
379
|
|
|
|
|
|
|
);
|
380
|
|
|
|
|
|
|
die "can't create template with $template ($!).\n"
|
381
|
|
|
|
|
|
|
unless (defined $self->{template});
|
382
|
|
|
|
|
|
|
|
383
|
|
|
|
|
|
|
$self->{template}->param(
|
384
|
|
|
|
|
|
|
generator => $self->{generator},
|
385
|
|
|
|
|
|
|
date => $self->{now},
|
386
|
|
|
|
|
|
|
);
|
387
|
|
|
|
|
|
|
|
388
|
|
|
|
|
|
|
$filename = $self->{outfile} . ".entities.ent";
|
389
|
|
|
|
|
|
|
open ENT, "> $filename"
|
390
|
|
|
|
|
|
|
or die "can't open $filename ($!)\n";
|
391
|
|
|
|
|
|
|
|
392
|
|
|
|
|
|
|
foreach my $name (@entities) {
|
393
|
|
|
|
|
|
|
my $decl = $self->{hash_entity}->{$name};
|
394
|
|
|
|
|
|
|
|
395
|
|
|
|
|
|
|
$self->{template}->param(
|
396
|
|
|
|
|
|
|
name => $name,
|
397
|
|
|
|
|
|
|
fname => $self->_mk_filename($name),
|
398
|
|
|
|
|
|
|
value => (exists $decl->{Value}) ? ord($decl->{Value}) : undef,
|
399
|
|
|
|
|
|
|
publicId => $decl->{PublicId},
|
400
|
|
|
|
|
|
|
systemId => $decl->{SystemId},
|
401
|
|
|
|
|
|
|
);
|
402
|
|
|
|
|
|
|
|
403
|
|
|
|
|
|
|
$filename = $self->_mk_outfile("ent", $name);
|
404
|
|
|
|
|
|
|
open OUT, "> $filename"
|
405
|
|
|
|
|
|
|
or die "can't open $filename ($!)\n";
|
406
|
|
|
|
|
|
|
print OUT $self->{template}->output();
|
407
|
|
|
|
|
|
|
close OUT;
|
408
|
|
|
|
|
|
|
my $sys = $self->_mk_system("ent", $name);
|
409
|
|
|
|
|
|
|
print ENT "\n";
|
410
|
|
|
|
|
|
|
}
|
411
|
|
|
|
|
|
|
close ENT;
|
412
|
|
|
|
|
|
|
}
|
413
|
|
|
|
|
|
|
|
414
|
|
|
|
|
|
|
if (scalar @notations) {
|
415
|
|
|
|
|
|
|
$template = "index.tmpl";
|
416
|
|
|
|
|
|
|
$self->{template} = new HTML::Template(
|
417
|
|
|
|
|
|
|
filename => $template,
|
418
|
|
|
|
|
|
|
path => $self->{path_tmpl},
|
419
|
|
|
|
|
|
|
);
|
420
|
|
|
|
|
|
|
die "can't create template with $template ($!).\n"
|
421
|
|
|
|
|
|
|
unless (defined $self->{template});
|
422
|
|
|
|
|
|
|
|
423
|
|
|
|
|
|
|
$self->{template}->param(
|
424
|
|
|
|
|
|
|
generator => $self->{generator},
|
425
|
|
|
|
|
|
|
date => $self->{now},
|
426
|
|
|
|
|
|
|
);
|
427
|
|
|
|
|
|
|
$self->{template}->param(
|
428
|
|
|
|
|
|
|
idx_elt => 0,
|
429
|
|
|
|
|
|
|
idx_ent => 0,
|
430
|
|
|
|
|
|
|
idx_not => 1,
|
431
|
|
|
|
|
|
|
lst_ex => 0,
|
432
|
|
|
|
|
|
|
);
|
433
|
|
|
|
|
|
|
$self->generateEntity("not", \@notations);
|
434
|
|
|
|
|
|
|
|
435
|
|
|
|
|
|
|
$filename = $self->{outfile} . ".notations.gen";
|
436
|
|
|
|
|
|
|
open OUT, "> $filename"
|
437
|
|
|
|
|
|
|
or die "can't open $filename ($!)\n";
|
438
|
|
|
|
|
|
|
print OUT $self->{template}->output();
|
439
|
|
|
|
|
|
|
close OUT;
|
440
|
|
|
|
|
|
|
|
441
|
|
|
|
|
|
|
$template = "notation.tmpl";
|
442
|
|
|
|
|
|
|
$self->{template} = new HTML::Template(
|
443
|
|
|
|
|
|
|
filename => $template,
|
444
|
|
|
|
|
|
|
path => $self->{path_tmpl},
|
445
|
|
|
|
|
|
|
);
|
446
|
|
|
|
|
|
|
die "can't create template with $template ($!).\n"
|
447
|
|
|
|
|
|
|
unless (defined $self->{template});
|
448
|
|
|
|
|
|
|
|
449
|
|
|
|
|
|
|
$self->{template}->param(
|
450
|
|
|
|
|
|
|
generator => $self->{generator},
|
451
|
|
|
|
|
|
|
date => $self->{now},
|
452
|
|
|
|
|
|
|
);
|
453
|
|
|
|
|
|
|
|
454
|
|
|
|
|
|
|
$filename = $self->{outfile} . ".notations.ent";
|
455
|
|
|
|
|
|
|
open ENT, "> $filename"
|
456
|
|
|
|
|
|
|
or die "can't open $filename ($!)\n";
|
457
|
|
|
|
|
|
|
|
458
|
|
|
|
|
|
|
foreach my $name (@notations) {
|
459
|
|
|
|
|
|
|
my $decl = $self->{hash_notation}->{$name};
|
460
|
|
|
|
|
|
|
|
461
|
|
|
|
|
|
|
$self->{template}->param(
|
462
|
|
|
|
|
|
|
name => $name,
|
463
|
|
|
|
|
|
|
fname => $self->_mk_filename($name),
|
464
|
|
|
|
|
|
|
publicId => $decl->{PublicId},
|
465
|
|
|
|
|
|
|
systemId => $decl->{SystemId},
|
466
|
|
|
|
|
|
|
);
|
467
|
|
|
|
|
|
|
|
468
|
|
|
|
|
|
|
$filename = $self->_mk_outfile("not", $name);
|
469
|
|
|
|
|
|
|
open OUT, "> $filename"
|
470
|
|
|
|
|
|
|
or die "can't open $filename ($!)\n";
|
471
|
|
|
|
|
|
|
print OUT $self->{template}->output();
|
472
|
|
|
|
|
|
|
close OUT;
|
473
|
|
|
|
|
|
|
my $sys = $self->_mk_system("not", $name);
|
474
|
|
|
|
|
|
|
print ENT "\n";
|
475
|
|
|
|
|
|
|
}
|
476
|
|
|
|
|
|
|
close ENT;
|
477
|
|
|
|
|
|
|
}
|
478
|
|
|
|
|
|
|
|
479
|
|
|
|
|
|
|
if (scalar @examples) {
|
480
|
|
|
|
|
|
|
$template = "index.tmpl";
|
481
|
|
|
|
|
|
|
$self->{template} = new HTML::Template(
|
482
|
|
|
|
|
|
|
filename => $template,
|
483
|
|
|
|
|
|
|
path => $self->{path_tmpl},
|
484
|
|
|
|
|
|
|
);
|
485
|
|
|
|
|
|
|
die "can't create template with $template ($!).\n"
|
486
|
|
|
|
|
|
|
unless (defined $self->{template});
|
487
|
|
|
|
|
|
|
|
488
|
|
|
|
|
|
|
$self->{template}->param(
|
489
|
|
|
|
|
|
|
generator => $self->{generator},
|
490
|
|
|
|
|
|
|
date => $self->{now},
|
491
|
|
|
|
|
|
|
);
|
492
|
|
|
|
|
|
|
$self->{template}->param(
|
493
|
|
|
|
|
|
|
idx_elt => 0,
|
494
|
|
|
|
|
|
|
idx_ent => 0,
|
495
|
|
|
|
|
|
|
idx_not => 0,
|
496
|
|
|
|
|
|
|
lst_ex => 1,
|
497
|
|
|
|
|
|
|
);
|
498
|
|
|
|
|
|
|
$self->generateEntity("ex", \@examples);
|
499
|
|
|
|
|
|
|
|
500
|
|
|
|
|
|
|
$filename = $self->{outfile} . ".examples.gen";
|
501
|
|
|
|
|
|
|
open OUT, "> $filename"
|
502
|
|
|
|
|
|
|
or die "can't open $filename ($!)\n";
|
503
|
|
|
|
|
|
|
print OUT $self->{template}->output();
|
504
|
|
|
|
|
|
|
close OUT;
|
505
|
|
|
|
|
|
|
|
506
|
|
|
|
|
|
|
$template = "example.tmpl";
|
507
|
|
|
|
|
|
|
$self->{template} = new HTML::Template(
|
508
|
|
|
|
|
|
|
filename => $template,
|
509
|
|
|
|
|
|
|
path => $self->{path_tmpl},
|
510
|
|
|
|
|
|
|
);
|
511
|
|
|
|
|
|
|
die "can't create template with $template ($!).\n"
|
512
|
|
|
|
|
|
|
unless (defined $self->{template});
|
513
|
|
|
|
|
|
|
|
514
|
|
|
|
|
|
|
$self->{template}->param(
|
515
|
|
|
|
|
|
|
generator => $self->{generator},
|
516
|
|
|
|
|
|
|
date => $self->{now},
|
517
|
|
|
|
|
|
|
);
|
518
|
|
|
|
|
|
|
|
519
|
|
|
|
|
|
|
$filename = $self->{outfile} . ".examples.ent";
|
520
|
|
|
|
|
|
|
open ENT, "> $filename"
|
521
|
|
|
|
|
|
|
or die "can't open $filename ($!)\n";
|
522
|
|
|
|
|
|
|
|
523
|
|
|
|
|
|
|
foreach my $example (@examples) {
|
524
|
|
|
|
|
|
|
$self->{template}->param(
|
525
|
|
|
|
|
|
|
name => $example,
|
526
|
|
|
|
|
|
|
fname => $self->_mk_filename($example),
|
527
|
|
|
|
|
|
|
page_title => "Example " . $example,
|
528
|
|
|
|
|
|
|
example => $self->_mk_example($example),
|
529
|
|
|
|
|
|
|
);
|
530
|
|
|
|
|
|
|
|
531
|
|
|
|
|
|
|
$filename = $self->_mk_outfile("ex", $example);
|
532
|
|
|
|
|
|
|
open OUT, "> $filename"
|
533
|
|
|
|
|
|
|
or die "can't open $filename ($!)\n";
|
534
|
|
|
|
|
|
|
print OUT $self->{template}->output();
|
535
|
|
|
|
|
|
|
close OUT;
|
536
|
|
|
|
|
|
|
my $sys = $self->_mk_system("ex", $example);
|
537
|
|
|
|
|
|
|
print ENT "\n";
|
538
|
|
|
|
|
|
|
}
|
539
|
|
|
|
|
|
|
close ENT;
|
540
|
|
|
|
|
|
|
}
|
541
|
|
|
|
|
|
|
|
542
|
|
|
|
|
|
|
$filename = $self->{outfile} . ".customs.ent";
|
543
|
|
|
|
|
|
|
unless ( -e $filename) {
|
544
|
|
|
|
|
|
|
$template = "custom.tmpl";
|
545
|
|
|
|
|
|
|
$self->{template} = new HTML::Template(
|
546
|
|
|
|
|
|
|
filename => $template,
|
547
|
|
|
|
|
|
|
path => $self->{path_tmpl},
|
548
|
|
|
|
|
|
|
);
|
549
|
|
|
|
|
|
|
die "can't create template with $template ($!).\n"
|
550
|
|
|
|
|
|
|
unless (defined $self->{template});
|
551
|
|
|
|
|
|
|
|
552
|
|
|
|
|
|
|
my @ent = ();
|
553
|
|
|
|
|
|
|
|
554
|
|
|
|
|
|
|
my ($r_doc, $r_tag) = $self->_get_doc($self->{dtd});
|
555
|
|
|
|
|
|
|
push @ent, {
|
556
|
|
|
|
|
|
|
name => "prolog." . $self->{dtd}->{Name},
|
557
|
|
|
|
|
|
|
brief => $self->_get_brief($self->{dtd}),
|
558
|
|
|
|
|
|
|
doc => $r_doc,
|
559
|
|
|
|
|
|
|
tag => $r_tag,
|
560
|
|
|
|
|
|
|
};
|
561
|
|
|
|
|
|
|
|
562
|
|
|
|
|
|
|
foreach my $name (@elements) {
|
563
|
|
|
|
|
|
|
my $decl = $self->{hash_element}->{$name};
|
564
|
|
|
|
|
|
|
|
565
|
|
|
|
|
|
|
($r_doc, $r_tag) = $self->_get_doc($decl);
|
566
|
|
|
|
|
|
|
my ($r_doc_attrs, $r_attrs) = $self->_get_doc_attrs($name);
|
567
|
|
|
|
|
|
|
push @ent, {
|
568
|
|
|
|
|
|
|
name => "elt." . $name,
|
569
|
|
|
|
|
|
|
brief => $self->_get_brief($decl),
|
570
|
|
|
|
|
|
|
doc => $r_doc,
|
571
|
|
|
|
|
|
|
tag => $r_tag,
|
572
|
|
|
|
|
|
|
attrs => $r_attrs,
|
573
|
|
|
|
|
|
|
doc_attrs => $r_doc_attrs,
|
574
|
|
|
|
|
|
|
};
|
575
|
|
|
|
|
|
|
}
|
576
|
|
|
|
|
|
|
|
577
|
|
|
|
|
|
|
foreach my $name (@entities) {
|
578
|
|
|
|
|
|
|
my $decl = $self->{hash_entity}->{$name};
|
579
|
|
|
|
|
|
|
|
580
|
|
|
|
|
|
|
($r_doc, $r_tag) = $self->_get_doc($decl);
|
581
|
|
|
|
|
|
|
push @ent, {
|
582
|
|
|
|
|
|
|
name => "ent." . $name,
|
583
|
|
|
|
|
|
|
brief => $self->_get_brief($decl),
|
584
|
|
|
|
|
|
|
doc => $r_doc,
|
585
|
|
|
|
|
|
|
tag => $r_tag,
|
586
|
|
|
|
|
|
|
};
|
587
|
|
|
|
|
|
|
}
|
588
|
|
|
|
|
|
|
|
589
|
|
|
|
|
|
|
foreach my $name (@notations) {
|
590
|
|
|
|
|
|
|
my $decl = $self->{hash_notation}->{$name};
|
591
|
|
|
|
|
|
|
|
592
|
|
|
|
|
|
|
($r_doc, $r_tag) = $self->_get_doc($decl);
|
593
|
|
|
|
|
|
|
push @ent, {
|
594
|
|
|
|
|
|
|
name => "not." . $name,
|
595
|
|
|
|
|
|
|
brief => $self->_get_brief($decl),
|
596
|
|
|
|
|
|
|
doc => $r_doc,
|
597
|
|
|
|
|
|
|
tag => $r_tag,
|
598
|
|
|
|
|
|
|
};
|
599
|
|
|
|
|
|
|
}
|
600
|
|
|
|
|
|
|
|
601
|
|
|
|
|
|
|
$self->{template}->param(
|
602
|
|
|
|
|
|
|
ent => \@ent,
|
603
|
|
|
|
|
|
|
);
|
604
|
|
|
|
|
|
|
|
605
|
|
|
|
|
|
|
open OUT, "> $filename"
|
606
|
|
|
|
|
|
|
or die "can't open $filename ($!)\n";
|
607
|
|
|
|
|
|
|
print OUT $self->{template}->output();
|
608
|
|
|
|
|
|
|
close OUT;
|
609
|
|
|
|
|
|
|
}
|
610
|
|
|
|
|
|
|
}
|
611
|
|
|
|
|
|
|
|
612
|
|
|
|
|
|
|
1;
|
613
|
|
|
|
|
|
|
|
614
|
|
|
|
|
|
|
__END__
|