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