1 |
|
#!/usr/bin/perl |
2 |
use strict; |
use strict; |
3 |
{require SuikaWiki::Markup::SuikaWikiConfig20::Parser; |
our $SCRIPT_NAME = 'mkdtds'; |
4 |
|
our $VERSION = do{my @r=(q$Revision$=~/\d+/g);sprintf "%d."."%02d" x $#r,@r}; |
5 |
|
{require Message::Markup::SuikaWikiConfig20::Parser; |
6 |
|
|
7 |
my $parser = new SuikaWiki::Markup::SuikaWikiConfig20::Parser; |
my $parser = new Message::Markup::SuikaWikiConfig20::Parser; |
8 |
local $/ = undef; |
local $/ = undef; |
9 |
my $src = $parser->parse_text (scalar <>); |
my $src = $parser->parse_text (scalar <>); |
10 |
my $Info = {}; |
my $Info = {}; |
11 |
|
|
12 |
for my $src ($src->get_attribute ('ModuleSet') |
for my $src ($src->get_attribute ('ModuleSet') |
13 |
|| $src->get_attribute ('DocumentType')) { |
|| $src->get_attribute ('DocumentType')) { |
14 |
for (qw/ID Copyright BaseURI/) { |
for (qw/Description/) { |
15 |
$Info->{$_} = $src->get_attribute_value ($_); |
$Info->{$_} = $src->get_attribute_value ($_); |
16 |
} |
} |
17 |
$Info->{Name} = $src->get_attribute_value ('Name') |
for (qw/Name ID Copyright BaseURI Version/) { |
18 |
.' '.$src->get_attribute_value ('Version'); |
$Info->{$_} = normalize_wsp ($src->get_attribute_value ($_)); |
19 |
|
} |
20 |
|
$Info->{realname} = $Info->{Name}; |
21 |
|
$Info->{Name} .= ' ' . $Info->{Version} if length $Info->{Version}; |
22 |
$Info->{ns} = $src->get_attribute ('Namespace'); |
$Info->{ns} = $src->get_attribute ('Namespace'); |
23 |
} |
} |
24 |
|
|
33 |
submodule ($_, $Info); |
submodule ($_, $Info); |
34 |
} elsif ($_->local_name eq 'Model') { |
} elsif ($_->local_name eq 'Model') { |
35 |
model_module ($_, $Info); |
model_module ($_, $Info); |
36 |
|
$Info->{has_model} = 1; |
37 |
} elsif ($_->local_name eq 'Driver') { |
} elsif ($_->local_name eq 'Driver') { |
38 |
dtd_driver ($_, $Info); |
dtd_driver ($_, $Info); |
39 |
} |
} |
44 |
} |
} |
45 |
exit} |
exit} |
46 |
|
|
47 |
|
sub normalize_wsp ($;%) { |
48 |
|
my $s = shift; |
49 |
|
$s =~ s/\s+/ /g; |
50 |
|
$s =~ s/^ +//; |
51 |
|
$s =~ s/ +$//; |
52 |
|
$s; |
53 |
|
} |
54 |
|
sub make_paragraphs ($;%) { |
55 |
|
my ($para, %opt) = @_; |
56 |
|
join "\n\n", map { |
57 |
|
my $s = $_; |
58 |
|
$s =~ s/\n+$//g; |
59 |
|
$s =~ s/\n/\n$opt{indent}/g; |
60 |
|
$opt{indent}.$s; |
61 |
|
} grep {length} @$para; |
62 |
|
} |
63 |
|
|
64 |
|
sub dot_padding ($%) { |
65 |
|
my ($s, %opt) = @_; |
66 |
|
if ($opt{length} - length $s > 0) { |
67 |
|
return $s . ( ($opt{dot} or q(.)) x ($opt{length} - length $s) ); |
68 |
|
} else { |
69 |
|
return $s; |
70 |
|
} |
71 |
|
} |
72 |
|
|
73 |
sub submodule_id_of ($$;%) { |
sub submodule_id_of ($$;%) { |
74 |
my ($src, $Info, %opt) = @_; |
my ($src, $Info, %opt) = @_; |
75 |
my $id = $src->get_attribute_value ('ID') || $opt{default}; |
my $id = $src->get_attribute_value ('ID') || $opt{default}; |
84 |
$type =~ s/\s+//g; |
$type =~ s/\s+//g; |
85 |
$type; |
$type; |
86 |
} |
} |
87 |
|
sub system_id_of ($$;%) { |
88 |
|
my ($src, $Info, %opt) = @_; |
89 |
|
my $sysid = $src->get_attribute_value ('SYSTEM'); |
90 |
|
if ($sysid =~ /<([^>]+)>/) { |
91 |
|
return $1; |
92 |
|
} else { |
93 |
|
return $opt{base}.($sysid || $opt{default}); |
94 |
|
} |
95 |
|
} |
96 |
sub external_id_of ($$;%) { |
sub external_id_of ($$;%) { |
97 |
my ($src, $Info, %opt) = @_; |
my ($src, $Info, %opt) = @_; |
98 |
my $sysid = $opt{base}.($src->get_attribute_value ('SYSTEM') || $opt{default}); |
my $sysid = system_id_of ($src, $Info, %opt); |
99 |
my $pubid = $src->get_attribute_value ('PUBLIC'); |
my $pubid = $src->get_attribute_value ('PUBLIC'); |
100 |
if ($pubid) { |
if ($pubid) { |
101 |
if ($sysid) { |
if ($sysid) { |
157 |
$model =~ s/(?<![%#.])((?:\$|\b)$nonsymbol+(?::$nonsymbol+)?|\$?:$nonsymbol+|"[^"]+")/get_model_token ($1, $Info)/ge; |
$model =~ s/(?<![%#.])((?:\$|\b)$nonsymbol+(?::$nonsymbol+)?|\$?:$nonsymbol+|"[^"]+")/get_model_token ($1, $Info)/ge; |
158 |
$model; |
$model; |
159 |
} |
} |
160 |
|
sub sparalit ($) { |
161 |
|
my $s = paralit (shift); |
162 |
|
$s =~ s/&/&/g; |
163 |
|
$s =~ s/%/%/g; |
164 |
|
$s; |
165 |
|
} |
166 |
sub paralit ($) { |
sub paralit ($) { |
167 |
my $s = shift; |
my $s = shift; |
168 |
if ($s =~ /"/) { |
if ($s =~ /"/) { |
193 |
$desc = qq(<!-- $desc -->\n) if $desc; |
$desc = qq(<!-- $desc -->\n) if $desc; |
194 |
$desc; |
$desc; |
195 |
} |
} |
196 |
|
sub xml_condition_section ($$;%) { |
197 |
|
my ($condition, $content, %opt) = @_; |
198 |
|
qq(<![%$condition;[\n) |
199 |
|
. $content |
200 |
|
. qq(<!-- end of $condition -->]]>\n); |
201 |
|
} |
202 |
|
sub xml_parameter_ENTITY ($%) { |
203 |
|
my ($name, %opt) = @_; |
204 |
|
qq(<!ENTITY % $name @{[paralit $opt{value}]}>\n); |
205 |
|
} |
206 |
|
|
207 |
|
sub entity_declaration ($$;%) { |
208 |
|
my ($src, $Info, %opt) = @_; |
209 |
|
my $val; |
210 |
|
if ($src->get_attribute_value ('ID') |
211 |
|
|| $src->get_attribute_value ('SYSTEM') |
212 |
|
|| $src->get_attribute_value ('PUBLIC')) { |
213 |
|
$val = "\n\t".external_id_of ($src, $Info, default => $src->get_attribute_value ('ID')); |
214 |
|
} elsif (ref $src->get_attribute ('Declaration')) { |
215 |
|
$val = "\n\t".sparalit submodule_declarations ($src->get_attribute ('Declaration'), $Info); |
216 |
|
} else { |
217 |
|
$val = paralit $src->get_attribute_value ('EntityValue'); |
218 |
|
} |
219 |
|
my $s = <<EOH; |
220 |
|
@{[description ($src, $Info)]}<!ENTITY @{[$opt{param}?'% ':'']}@{[$src->get_attribute_value ('Name')]} $val> |
221 |
|
|
222 |
|
EOH |
223 |
|
$s; |
224 |
|
} |
225 |
|
|
226 |
|
sub parameter_entity_declaration ($$%) { |
227 |
|
my ($src, $Info, %opt) = @_; |
228 |
|
my $name = name_of $src, $Info, %opt; |
229 |
|
if (my $sysid = $src->get_attribute_value ('SYSTEM')) { |
230 |
|
if ($sysid =~ /^\s*<([^<>]+)>\s*$/) { |
231 |
|
$sysid = $1; |
232 |
|
$sysid =~ s/([%"])/sprintf '&#x%02X;', ord $1/ge; |
233 |
|
} elsif ($sysid =~ /^([^:]*):(.*)$/) { |
234 |
|
my $ns = $1; |
235 |
|
$sysid = $2; |
236 |
|
$sysid =~ s/([%"])/sprintf '&#x%02X;', ord $1/ge; |
237 |
|
$sysid = '%' . ($ns ? $ns . '.' : '') . 'sysid.base;' . $sysid; |
238 |
|
} else { |
239 |
|
$sysid = '%XHTML.sysid.base;' . $sysid; |
240 |
|
} |
241 |
|
my $r; |
242 |
|
if (my $pubid = $src->get_attribute_value ('PUBLIC')) { |
243 |
|
$r = qq{<!ENTITY % $name.sysid "$sysid">\n} . |
244 |
|
qq{<!ENTITY % $name.fpi "$pubid">\n} . |
245 |
|
qq{<!ENTITY % $name.fpi.defined "INCLUDE">\n}; |
246 |
|
} else { |
247 |
|
$r = qq{<!ENTITY % $name.sysid "$sysid">\n} . |
248 |
|
qq{<!ENTITY % $name.fpi "">\n} . |
249 |
|
qq{<!ENTITY % $name.fpi.defined "IGNORE">\n}; |
250 |
|
} |
251 |
|
return <<EOH; |
252 |
|
@{[get_desc ($src, $Info, prefix => qq(%$name: ), |
253 |
|
padding_length => 51, padding_dot => q(.), |
254 |
|
default => qq(%$name)) |
255 |
|
]}$r |
256 |
|
<![%$name.fpi.defined;[ |
257 |
|
<!ENTITY % $name.decl |
258 |
|
\t'PUBLIC "%$name.fpi;" |
259 |
|
\t\t"%$name.sysid;"'> |
260 |
|
]]> |
261 |
|
<!ENTITY % $name.decl |
262 |
|
\t'SYSTEM "%$name.sysid;"'> |
263 |
|
<!ENTITY % $name %$name.decl;> |
264 |
|
<!-- @{[dot_padding qq<%$name >, length => 51, dot => q<.>]} --> |
265 |
|
EOH |
266 |
|
} else { |
267 |
|
my $s = get_desc ($src, $Info); |
268 |
|
$s .= qq{<!ENTITY % $name } . |
269 |
|
paralit $src->get_attribute_value ('EntityValue'); |
270 |
|
$s .= ">\n"; |
271 |
|
return $s; |
272 |
|
} |
273 |
|
} |
274 |
|
|
275 |
sub dtd_driver ($$) { |
sub dtd_driver ($$) { |
276 |
my ($src, $Info) = @_; |
my ($src, $Info) = @_; |
280 |
for my $src (@{$src->child_nodes}) { |
for my $src (@{$src->child_nodes}) { |
281 |
if ($src->local_name eq 'Module') { |
if ($src->local_name eq 'Module') { |
282 |
$s .= dtd_driver_load_module ($src, $Info); |
$s .= dtd_driver_load_module ($src, $Info); |
283 |
|
} elsif ($src->local_name eq 'DTD') { |
284 |
|
$s .= dtd_driver_load_dtd ($src, $Info); |
285 |
} elsif ($src->local_name eq 'ModuleSet') { |
} elsif ($src->local_name eq 'ModuleSet') { |
286 |
push @module_set, $src; |
push @module_set, $src; |
287 |
} elsif ($src->local_name =~ /^(?:QName|Attribute|Datatype|Notation)Module/) { |
} elsif ($src->local_name =~ /^(?:QName|Attribute|Datatype|Notation)Module/) { |
288 |
$s{$src->local_name} .= dtd_driver_load_module ($src, $Info); |
$s{$src->local_name} .= dtd_driver_load_module ($src, $Info); |
289 |
|
|
290 |
} elsif ($src->local_name eq 'IfModuleSet') { |
} elsif ($src->local_name eq 'IfModuleSet') { |
291 |
$s .= qq(<![%@{[$src->get_attribute_value ('ModuleSet')]}.module;[\n); |
my $ms = name_of $src, $Info, key => $src->get_attribute_value ('ID') ? |
292 |
|
'ID' : 'ModuleSet'; |
293 |
|
$s .= qq(<![%$ms.module;[\n); |
294 |
$s .= submodule_declarations ($src, $Info); |
$s .= submodule_declarations ($src, $Info); |
295 |
$s .= qq(]]>\n); |
$s .= qq(<!-- end of $ms -->]]>\n\n); |
296 |
|
|
297 |
|
} elsif ($src->local_name eq 'IfModule') { |
298 |
|
my $ms = name_of $src, $Info, key => 'ID'; |
299 |
|
$s .= qq(<![%$ms.module;[\n); |
300 |
|
$s .= submodule_declarations ($src, $Info); |
301 |
|
$s .= qq(<!-- end of $ms -->]]>\n\n); |
302 |
|
} elsif ($src->local_name eq 'ElementSwitch') { |
303 |
|
$s .= qq(<!ENTITY % @{[name_of ($src, $Info)]}.element "@{[$src->get_attribute_value ('Use')>0?'INCLUDE':'IGNORE']}">\n); |
304 |
|
} elsif ($src->local_name eq 'AttributeSwitch') { |
305 |
|
$s .= qq(<!ENTITY % @{[name_of ($src, $Info)]}.attlist "@{[$src->get_attribute_value ('Use')>0?'INCLUDE':'IGNORE']}">\n); |
306 |
|
} elsif ($src->local_name eq 'ModuleSwitch') { |
307 |
|
$s .= qq(<!ENTITY % @{[name_of ($src, $Info)]}.module "@{[$src->get_attribute_value ('Use')>0?'INCLUDE':'IGNORE']}">\n); |
308 |
|
} elsif ($src->local_name eq 'Switch') { |
309 |
|
$s .= qq(<!ENTITY % @{[name_of ($src, $Info)]} "@{[$src->get_attribute_value ('Use')>0?'INCLUDE':'IGNORE']}">\n); |
310 |
} elsif ($src->local_name eq 'GeneralEntity') { |
} elsif ($src->local_name eq 'GeneralEntity') { |
311 |
$s .= qq(@{[description ($src, $Info)]}<!ENTITY @{[$src->get_attribute_value ('Name')]} @{[paralit $src->get_attribute_value ('EntityValue')]}>\n\n); |
$s .= entity_declaration ($src, $Info, param => 0); |
312 |
} elsif ($src->local_name eq 'ParameterEntity') { |
} elsif ($src->local_name eq 'ParameterEntity') { |
313 |
$s .= qq(@{[description ($src, $Info)]}<!ENTITY % @{[$src->get_attribute_value ('Name')]} @{[paralit $src->get_attribute_value ('EntityValue')]}>\n\n); |
$s .= parameter_entity_declaration ($src, $Info); |
314 |
} |
} |
315 |
} |
} |
316 |
|
|
317 |
$s{ModelModule} = <<EOH; |
$s{ModelModule} = $src->get_attribute_value ('NoModelModule') ? '' : |
318 |
|
$Info->{has_model} ? <<EOH : ''; |
319 |
<!-- Document Model module --> |
<!-- Document Model module --> |
320 |
<!ENTITY % $Info->{ID}-model.module "INCLUDE"> |
<!ENTITY % $Info->{ID}-model.module "INCLUDE"> |
321 |
<![%$Info->{ID}-model.module;[ |
<![%$Info->{ID}-model.module;[ |
373 |
]]> |
]]> |
374 |
<!ENTITY % $module_set->{ID}.xmlns.decl.attrib "">\n\n); |
<!ENTITY % $module_set->{ID}.xmlns.decl.attrib "">\n\n); |
375 |
} |
} |
376 |
|
$s .= <<EOH; |
377 |
|
<!-- Declare a parameter entity %XSI.prefix as a prefix to use for |
378 |
|
XML Schema Instance attributes. --> |
379 |
|
<!ENTITY % XSI.prefix "xsi"> |
380 |
|
|
381 |
|
<!ENTITY % XSI.pfx "%XSI.prefix;:"> |
382 |
|
|
383 |
|
<!ENTITY % XSI.xmlns "http://www.w3.org/2001/XMLSchema-instance"> |
384 |
|
|
385 |
|
<!-- Declare a parameter entity %XSI.xmlns.attrib as support for |
386 |
|
the schemaLocation attribute. --> |
387 |
|
<!ENTITY % XSI.xmlns.attrib |
388 |
|
"xmlns:%XSI.prefix; %URI.datatype; #FIXED '%XSI.xmlns;'"> |
389 |
|
EOH |
390 |
$s .= qq(\n<!ENTITY % NS.decl.attrib |
$s .= qq(\n<!ENTITY % NS.decl.attrib |
391 |
").join ("\n\t", (map {qq(%$_->{ID}.xmlns.decl.attrib;)} @src), |
").join ("\n\t", (map {qq(%$_->{ID}.xmlns.decl.attrib;)} @src), |
392 |
map {qq(%$_->{ID}.xmlns.extra.attrib;)} @src).qq(">\n); |
map {qq(%$_->{ID}.xmlns.extra.attrib;)} @src) |
393 |
|
.qq(\n\t%XSI.xmlns.attrib;">\n); |
394 |
$s .= qq(\n); |
$s .= qq(\n); |
395 |
for my $module_set (@src) { |
for my $module_set (@src) { |
396 |
$s .= qq(<!ENTITY % $module_set->{ID}.xmlns.attrib "%NS.decl.attrib;">\n); |
$s .= qq(<!ENTITY % $module_set->{ID}.xmlns.attrib "%NS.decl.attrib;">\n); |
408 |
|
|
409 |
my $s .= <<EOH; |
my $s .= <<EOH; |
410 |
@{[description ($src, $Info, context => 'load_module', id => $src->local_name)]}<![%$module_set_name.module;[ |
@{[description ($src, $Info, context => 'load_module', id => $src->local_name)]}<![%$module_set_name.module;[ |
411 |
<!ENTITY % $module_name.module "INCLUDE"> |
<!ENTITY % $module_name.module "@{[$src->get_attribute_value ('Default') >= 0 ? 'INCLUDE' : 'IGNORE']}"> |
412 |
<![%$module_name.module;[ |
<![%$module_name.module;[ |
413 |
@{[submodule_declarations ($src, $Info)]}<!ENTITY % $module_name.decl |
@{[submodule_declarations ($src, $Info)]}<!ENTITY % $module_name.decl |
414 |
@{[paralit external_id_of ($src, $Info, default => qq($module_hyphen_name.mod), base => qq(%$module_set_name.sysid.base;))]}> |
@{[paralit external_id_of ($src, $Info, default => qq($module_hyphen_name.mod), base => qq(%$module_set_name.sysid.base;))]}> |
419 |
EOH |
EOH |
420 |
$s; |
$s; |
421 |
} |
} |
422 |
|
|
423 |
|
sub dtd_driver_load_dtd ($$) { |
424 |
|
my ($src, $Info) = @_; |
425 |
|
my $module_set_name = $src->get_attribute_value ('ID'); |
426 |
|
|
427 |
|
my $s .= <<EOH; |
428 |
|
@{[description ($src, $Info)]}<![%$module_set_name.module;[ |
429 |
|
@{[submodule_declarations ($src, $Info)]}<!ENTITY % $module_set_name.dtd.sysid "@{[system_id_of ($src, $Info, default => $src->get_attribute_value ('ID').'.dtd', base => qq(%$module_set_name.sysid.base;))]}"> |
430 |
|
@{[do{ |
431 |
|
my $pubid = $src->get_attribute_value ('PUBLIC'); |
432 |
|
if ($pubid) { |
433 |
|
qq(<!ENTITY % $module_set_name.dtd.fpi "$pubid">\n<!ENTITY % $module_set_name.dtd.fpi.defined "INCLUDE">\n); |
434 |
|
} else { |
435 |
|
qq(<!ENTITY % $module_set_name.dtd.fpi "">\n<!ENTITY % $module_set_name.dtd.fpi.defined "IGNORE">\n); |
436 |
|
} |
437 |
|
}]} |
438 |
|
<![%$module_set_name.dtd.fpi.defined;[ |
439 |
|
<!ENTITY % $module_set_name.dtd.decl |
440 |
|
'PUBLIC "%$module_set_name.dtd.fpi;" |
441 |
|
"%$module_set_name.dtd.sysid;"'> |
442 |
|
]]> |
443 |
|
<!ENTITY % $module_set_name.dtd.decl |
444 |
|
'SYSTEM "%$module_set_name.dtd.sysid;"'> |
445 |
|
<!ENTITY % $module_set_name.dtd %$module_set_name.dtd.decl;> |
446 |
|
%$module_set_name.dtd;]]> |
447 |
|
|
448 |
|
EOH |
449 |
|
$s; |
450 |
|
} |
451 |
|
|
452 |
sub model_module ($$) { |
sub model_module ($$) { |
453 |
my ($src, $Info) = @_; |
my ($src, $Info) = @_; |
454 |
my $s = ''; |
my $s = ''; |
455 |
for my $src (@{$src->child_nodes}) { |
for my $src (@{$src->child_nodes}) { |
456 |
if ($src->local_name eq 'Class') { |
if ($src->local_name eq 'Class') { |
457 |
$s .= qq(@{[get_desc ($src, $Info)]}<!ENTITY % @{[class_name_of ($src, $Info)]} @{[paralit convert_content_model ($src, $Info)]}>\n\n); |
$s .= qq(@{[description ($src, $Info)]}<!ENTITY % @{[class_name_of ($src, $Info)]} @{[paralit convert_content_model ($src, $Info)]}>\n\n); |
458 |
} elsif ($src->local_name eq 'Content') { |
} elsif ($src->local_name eq 'Content') { |
459 |
$s .= element_content_def ($src, $Info); |
$s .= element_content_def ($src, $Info); |
460 |
} |
} |
489 |
my $ID = $Info->{ID}; |
my $ID = $Info->{ID}; |
490 |
my $ns = $src->get_attribute ('Namespace'); |
my $ns = $src->get_attribute ('Namespace'); |
491 |
my $s = <<EOH; |
my $s = <<EOH; |
492 |
|
<!ENTITY % sgml.tag.minimizable "IGNORE"> |
493 |
|
|
494 |
<!ENTITY % NS.prefixed "@{[$ns->get_attribute_value ('UsePrefix')==1? |
<!ENTITY % NS.prefixed "@{[$ns->get_attribute_value ('UsePrefix')==1? |
495 |
q(INCLUDE):q(IGNORE)]}"> |
q(INCLUDE):q(IGNORE)]}"> |
496 |
|
|
497 |
|
<!-- Section A: XML Namespace Framework :::::::::::::::::::::::::: --> |
498 |
|
|
499 |
|
<!-- 1. Declare a %$ID.prefixed; conditional section keyword, used |
500 |
|
to activate namespace prefixing. --> |
501 |
<!ENTITY % $ID.prefixed "@{[$ns->get_attribute_value ('UsePrefix')==1? |
<!ENTITY % $ID.prefixed "@{[$ns->get_attribute_value ('UsePrefix')==1? |
502 |
q(INCLUDE): |
q(INCLUDE): |
503 |
$ns->get_attribute_value ('UsePrefix')==-1? |
$ns->get_attribute_value ('UsePrefix')==-1? |
504 |
q(IGNORE): |
q(IGNORE): |
505 |
q(%NS.prefixed;)]}"> |
q(%NS.prefixed;)]}"> |
506 |
|
|
507 |
|
<!ENTITY % $ID.global.attrs.prefixed "@{[$ns->get_attribute_value ('UsePrefix')==1? |
508 |
|
q(INCLUDE): |
509 |
|
$ns->get_attribute_value ('UsePrefix')==-1? |
510 |
|
q(IGNORE): |
511 |
|
q(%NS.prefixed;)]}"> |
512 |
|
|
513 |
|
<!ENTITY % $ID.xsi.attrs "INCLUDE"> |
514 |
|
|
515 |
|
<!-- 2. Declare a parameter entity %$ID.xmlns; containing |
516 |
|
the URI reference used to identity the namespace. --> |
517 |
<!ENTITY % $ID.xmlns "@{[$ns->get_attribute_value ('Name')]}"> |
<!ENTITY % $ID.xmlns "@{[$ns->get_attribute_value ('Name')]}"> |
518 |
|
|
519 |
|
<!-- 3. Declare parameter entity %$ID.prefix; containing |
520 |
|
the default namespace prefix string to use when prefixing |
521 |
|
is enabled. This may be overridden in the DTD driver or the |
522 |
|
internal subset of a document instance. |
523 |
|
|
524 |
|
NOTE: As specified in XML Namespace speficications, the namespace |
525 |
|
prefix serves as a proxy for the URI reference, and is not in itself |
526 |
|
significant. --> |
527 |
<!ENTITY % $ID.prefix "@{[$ns->get_attribute_value ('DefaultPrefix')]}"> |
<!ENTITY % $ID.prefix "@{[$ns->get_attribute_value ('DefaultPrefix')]}"> |
528 |
|
|
529 |
|
<!-- 4. Declare parameter entity %$ID.pfx; containing the |
530 |
|
colonized prefix (e.g, '%$ID.prefix;:') used when |
531 |
|
prefixing is active, an empty string when it is not. --> |
532 |
<![%$ID.prefixed;[ |
<![%$ID.prefixed;[ |
533 |
<!ENTITY % $ID.pfx "%$ID.prefix;:"> |
<!ENTITY % $ID.pfx "%$ID.prefix;:"> |
534 |
]]> |
]]> |
535 |
<!ENTITY % $ID.pfx ""> |
<!ENTITY % $ID.pfx ""> |
536 |
|
|
537 |
|
<!-- declare qualified name extensions here ............ --> |
538 |
|
<!ENTITY % ${ID}-qname-extra.mod ""> |
539 |
|
%${ID}-qname-extra.mod; |
540 |
|
|
541 |
|
<!-- 5. The parameter entity %$ID.xmlns.extra.attrib; may be |
542 |
|
redeclared to contain any foreign namespace declaration |
543 |
|
attributes for namespaces embedded. The default |
544 |
|
is an empty string. --> |
545 |
<!ENTITY % $ID.xmlns.extra.attrib ""> |
<!ENTITY % $ID.xmlns.extra.attrib ""> |
546 |
|
|
547 |
|
<!-- The parameter entity %URI.datatype; should already be defined in |
548 |
|
Datatype module. --> |
549 |
|
<!ENTITY % URI.datatype "CDATA"> |
550 |
|
|
551 |
<![%$ID.prefixed;[ |
<![%$ID.prefixed;[ |
552 |
<!ENTITY % $ID.xmlns.decl.attrib |
<!ENTITY % $ID.xmlns.decl.attrib |
553 |
"xmlns:%$ID.prefix; %URI.datatype; #FIXED '%$ID.xmlns;'"> |
"xmlns:%$ID.prefix; %URI.datatype; #FIXED '%$ID.xmlns;'"> |
555 |
<!ENTITY % $ID.xmlns.decl.attrib |
<!ENTITY % $ID.xmlns.decl.attrib |
556 |
"xmlns %URI.datatype; #FIXED '%$ID.xmlns;'"> |
"xmlns %URI.datatype; #FIXED '%$ID.xmlns;'"> |
557 |
|
|
558 |
|
<!-- Declare a parameter entity %XSI.prefix as a prefix to use for |
559 |
|
XML Schema Instance attributes. --> |
560 |
|
<!ENTITY % XSI.prefix "xsi"> |
561 |
|
|
562 |
|
<!ENTITY % XSI.pfx "%XSI.prefix;:"> |
563 |
|
|
564 |
|
<!ENTITY % XSI.xmlns "http://www.w3.org/2001/XMLSchema-instance"> |
565 |
|
|
566 |
|
<!-- Declare a parameter entity %XSI.xmlns.attrib as support for |
567 |
|
the schemaLocation attribute. --> |
568 |
|
<!ENTITY % XSI.xmlns.attrib |
569 |
|
"xmlns:%XSI.prefix; %URI.datatype; #FIXED '%XSI.xmlns;'"> |
570 |
|
|
571 |
<![%$ID.prefixed;[ |
<![%$ID.prefixed;[ |
572 |
<!ENTITY % NS.decl.attrib |
<!ENTITY % NS.decl.attrib |
573 |
"%$ID.xmlns.decl.attrib; |
"%$ID.xmlns.decl.attrib; |
574 |
%$ID.xmlns.extra.attrib;"> |
%$ID.xmlns.extra.attrib; |
575 |
|
%XSI.xmlns.attrib;"> |
576 |
]]> |
]]> |
577 |
<!ENTITY % NS.decl.attrib |
<!ENTITY % NS.decl.attrib |
578 |
"%$ID.xmlns.extra.attrib;"> |
"%$ID.xmlns.extra.attrib; |
579 |
|
%XSI.xmlns.attrib;"> |
580 |
|
|
581 |
|
<!-- Declare a parameter entity containing all XML namespace declaration |
582 |
|
attributes used, including a default xmlns declaration when prefixing |
583 |
|
is inactive. --> |
584 |
<![%$ID.prefixed;[ |
<![%$ID.prefixed;[ |
585 |
<!ENTITY % $ID.xmlns.attrib |
<!ENTITY % $ID.xmlns.attrib |
586 |
"%NS.decl.attrib;"> |
"%NS.decl.attrib;"> |
589 |
"%$ID.xmlns.decl.attrib; |
"%$ID.xmlns.decl.attrib; |
590 |
%NS.decl.attrib;"> |
%NS.decl.attrib;"> |
591 |
|
|
592 |
|
<!-- @{[dot_padding qq(Section B: $Info->{realname} Qualified Names ), |
593 |
|
length => 71-9, dot => q(:)]} --> |
594 |
|
|
595 |
|
<!-- placeholder for qualified name redeclarations --> |
596 |
|
<!ENTITY % ${ID}-qname.redecl ""> |
597 |
|
%${ID}-qname.redecl; |
598 |
|
|
599 |
|
<!-- 6. This section declare parameter entities used to provide |
600 |
|
namespace-qualified names for all element types and global |
601 |
|
attribute names. --> |
602 |
EOH |
EOH |
603 |
for my $lname (keys %{$Info->{QName}}) { |
for my $lname (sort keys %{$Info->{QName}}) { |
604 |
$s .= qq(<!ENTITY % $Info->{ID}.$lname.qname "%$Info->{ID}.pfx;$lname">\n); |
$s .= qq(<!ENTITY % ) |
605 |
|
. (dot_padding qq($Info->{ID}.$lname.qname), |
606 |
|
length => 15 + length ($Info->{ID}), dot => ' ') |
607 |
|
. qq( "%$Info->{ID}.pfx;$lname">\n); |
608 |
} |
} |
609 |
$s .= qq(\n); |
$s .= qq(\n); |
610 |
for my $lname (keys %{$Info->{QNameA}}) { |
for my $lname (sort keys %{$Info->{QNameA}}) { |
611 |
$s .= qq(<!ENTITY % $Info->{ID}.$lname.attrib.qname "%$Info->{ID}.prefix;:$lname">\n); |
$s .= qq(<!ENTITY % ) |
612 |
|
. (dot_padding qq($Info->{ID}.$lname.attrib.qname), |
613 |
|
length => 15 + length ($Info->{ID}), dot => ' ') |
614 |
|
. qq( "%$Info->{ID}.prefix;:$lname">\n); |
615 |
} |
} |
616 |
$s .= qq(\n); |
$s .= qq(\n); |
617 |
for my $lname (keys %{$Info->{QNameB}}) { |
for my $lname (sort keys %{$Info->{QNameB}}) { |
618 |
$s .= qq(<!ENTITY % $Info->{ID}.$lname.attribute.qname "%$Info->{ID}.pfx;$lname">\n); |
$s .= qq(<!ENTITY % ) |
619 |
|
. (dot_padding qq($Info->{ID}.$lname.attribute.qname), |
620 |
|
length => 15 + length ($Info->{ID}), dot => ' ') |
621 |
|
. qq( "%$Info->{ID}.pfx;$lname">\n); |
622 |
} |
} |
623 |
make_module ($src, $Info, 'qname', $s); |
make_module ($src->get_attribute ('QName', make_new_node => 1), $Info, 'qname', $s); |
624 |
} |
} |
625 |
|
|
626 |
sub get_name ($$;$) { |
sub get_name ($$;$) { |
680 |
$name; |
$name; |
681 |
} |
} |
682 |
|
|
683 |
sub get_desc ($$) { |
sub get_desc ($$;%) { |
684 |
my ($src, $Info) = @_; |
my ($src, $Info, %opt) = @_; |
685 |
my $desc = $src->get_attribute_value ('Description'); |
my $desc = $src->get_attribute_value ('Description'); |
686 |
$desc =~ s/\n/\n /g; |
$desc =~ s/--/- - /g; |
687 |
$desc = qq(<!-- $desc -->\n) if $desc; |
$desc =~ s/\n/\n /g; |
688 |
|
if (length $desc) { |
689 |
|
$desc = qq($opt{prefix}$desc); |
690 |
|
$desc .= q( ) if $opt{padding_length}; |
691 |
|
$desc = q(<!-- ).(dot_padding $desc, length => $opt{padding_length}, |
692 |
|
dot => $opt{padding_dot}).qq( -->\n); |
693 |
|
} elsif (length $opt{default}) { |
694 |
|
$desc = $opt{default}; |
695 |
|
$desc .= q( ) if $opt{padding_length}; |
696 |
|
$desc = q(<!-- ).(dot_padding $desc, length => $opt{padding_length}, |
697 |
|
dot => $opt{padding_dot}).qq( -->\n); |
698 |
|
} |
699 |
$desc; |
$desc; |
700 |
} |
} |
701 |
|
|
774 |
'xml:base' => q<xml:base %URI.datatype; #IMPLIED>, |
'xml:base' => q<xml:base %URI.datatype; #IMPLIED>, |
775 |
'xml:lang' => q<xml:lang %LanguageCode.datatype; #IMPLIED>, |
'xml:lang' => q<xml:lang %LanguageCode.datatype; #IMPLIED>, |
776 |
'xml:space' => q<xml:space (default|preserve) #IMPLIED>, |
'xml:space' => q<xml:space (default|preserve) #IMPLIED>, |
777 |
|
'xsi:nil' => q<%XSI.prefix;:nil (true|false|1|0) #IMPLIED>, |
778 |
|
'xsi:noNamespaceSchemaLocation' => q<%XSI.prefix;:noNamespaceSchemaLocation CDATA #IMPLIED>, |
779 |
|
'xsi:schemaLocation' => q<%XSI.prefix;:schemaLocation CDATA #IMPLIED>, |
780 |
|
'xsi:type' => q<%XSI.prefix;:type NMTOKEN #IMPLIED>, |
781 |
}->{$src->value}; |
}->{$src->value}; |
782 |
} |
} |
783 |
|
|
784 |
sub submodule ($$) { |
sub submodule ($$) { |
785 |
my ($src, $Info) = @_; |
my ($src, $Info) = @_; |
786 |
|
local $Info->{elements} = []; |
787 |
my $s = submodule_declarations ($src, $Info); |
my $s = submodule_declarations ($src, $Info); |
788 |
make_module ($src, $Info, $src->get_attribute_value ('ID'), $s); |
make_module ($src, $Info, $src->get_attribute_value ('ID'), $s); |
789 |
} |
} |
798 |
$s .= attlist_def ($src, $Info); |
$s .= attlist_def ($src, $Info); |
799 |
} elsif ($src->local_name eq 'AttributeSet') { |
} elsif ($src->local_name eq 'AttributeSet') { |
800 |
$s .= attset_def ($src, $Info); |
$s .= attset_def ($src, $Info); |
801 |
|
} elsif ($src->local_name eq 'Class') { |
802 |
|
$s .= qq(@{[description ($src, $Info)]}<!ENTITY % @{[class_name_of ($src, $Info)]} @{[paralit convert_content_model ($src, $Info)]}>\n\n); |
803 |
} elsif ($src->local_name eq 'Content') { |
} elsif ($src->local_name eq 'Content') { |
804 |
$s .= element_content_def ($src, $Info); |
$s .= element_content_def ($src, $Info); |
805 |
} elsif ($src->local_name eq 'IfModuleSet') { |
} elsif ($src->local_name eq 'IfModuleSet') { |
806 |
$s .= qq(<![%@{[$src->get_attribute_value ('ModuleSet')]}.module;[\n); |
my $ms = name_of $src, $Info, key => $src->get_attribute_value ('ID') ? |
807 |
|
'ID' : 'ModuleSet'; |
808 |
|
$s .= qq(<![%$ms.module;[\n); |
809 |
$s .= submodule_declarations ($src, $Info); |
$s .= submodule_declarations ($src, $Info); |
810 |
$s .= qq(]]>\n); |
$s .= qq(<!-- end of $ms -->]]>\n\n); |
811 |
|
|
812 |
|
} elsif ($src->local_name eq 'IfModule') { |
813 |
|
my $ms = name_of $src, $Info, key => 'ID'; |
814 |
|
$s .= qq(<![%$ms.module;[\n); |
815 |
|
$s .= submodule_declarations ($src, $Info); |
816 |
|
$s .= qq(<!-- end of $ms -->]]>\n\n); |
817 |
} elsif ($src->local_name eq 'ElementSwitch') { |
} elsif ($src->local_name eq 'ElementSwitch') { |
818 |
$s .= qq(<!ENTITY % @{[name_of ($src, $Info)]}.element "@{[$src->get_attribute_value ('Use')>0?'INCLUDE':'IGNORE']}">\n); |
$s .= qq(<!ENTITY % @{[name_of ($src, $Info)]}.element "@{[$src->get_attribute_value ('Use')>0?'INCLUDE':'IGNORE']}">\n); |
819 |
} elsif ($src->local_name eq 'AttributeSwitch') { |
} elsif ($src->local_name eq 'AttributeSwitch') { |
820 |
$s .= qq(<!ENTITY % @{[name_of ($src, $Info)]}.attlist "@{[$src->get_attribute_value ('Use')>0?'INCLUDE':'IGNORE']}">\n); |
$s .= qq(<!ENTITY % @{[name_of ($src, $Info)]}.attlist "@{[$src->get_attribute_value ('Use')>0?'INCLUDE':'IGNORE']}">\n); |
821 |
|
} elsif ($src->local_name eq 'ModuleSwitch') { |
822 |
|
$s .= qq(<!ENTITY % @{[name_of ($src, $Info)]}.module "@{[$src->get_attribute_value ('Use')>0?'INCLUDE':'IGNORE']}">\n); |
823 |
|
} elsif ($src->local_name eq 'Switch') { |
824 |
|
$s .= qq(<!ENTITY % @{[name_of ($src, $Info)]} "@{[$src->get_attribute_value ('Use')>0?'INCLUDE':'IGNORE']}">\n); |
825 |
|
} elsif ($src->local_name eq 'GeneralEntity') { |
826 |
|
$s .= entity_declaration ($src, $Info, param => 0); |
827 |
} elsif ($src->local_name eq 'ParameterEntity') { |
} elsif ($src->local_name eq 'ParameterEntity') { |
828 |
$s .= qq(@{[description ($src, $Info)]}<!ENTITY % @{[$src->get_attribute_value ('Name')]} @{[paralit $src->get_attribute_value ('EntityValue')]}>\n); |
$s .= parameter_entity_declaration ($src, $Info); |
829 |
|
} elsif ($src->local_name eq 'Module') { |
830 |
|
$s .= dtd_driver_load_module ($src, $Info); |
831 |
|
} elsif ($src->local_name eq 'DTD') { |
832 |
|
$s .= dtd_driver_load_dtd ($src, $Info); |
833 |
} |
} |
834 |
} |
} |
835 |
$s; |
$s; |
844 |
my ($src, $Info) = @_; |
my ($src, $Info) = @_; |
845 |
my $name = get_name ($src, $Info); |
my $name = get_name ($src, $Info); |
846 |
my $mname = $name =~ /^\Q$Info->{ID}.\E/ ? $name : qq($Info->{ID}.$name); |
my $mname = $name =~ /^\Q$Info->{ID}.\E/ ? $name : qq($Info->{ID}.$name); |
847 |
$Info->{QName}->{$1} = 1 if $name =~ /^\Q$Info->{ID}\E\.(.+)/; |
my $short_name = $name; |
848 |
my $s = <<EOH; |
if ($name =~ /^\Q$Info->{ID}\E\.(.+)/) { |
849 |
@{[get_desc ($src, $Info)]}<!ENTITY % $mname.element "INCLUDE"> |
$Info->{QName}->{$1} = 1; |
850 |
<![%$mname.element;[ |
push @{$Info->{elements}}, $1; |
851 |
<!ENTITY % $name.content @{[paralit convert_content_model ($src, $Info, default => 'EMPTY')]}> |
$short_name = $1; |
852 |
<!ELEMENT %$name.qname; %$name.content;> |
} |
853 |
]]> |
my $s = get_desc $src, $Info, prefix => qq($short_name: ), |
854 |
EOH |
padding_length => 51, padding_dot => q(.), |
855 |
|
default => qq($short_name); |
856 |
|
$s .= "\n"; |
857 |
|
$s .= xml_parameter_ENTITY qq($mname.element), value => 'INCLUDE'; |
858 |
|
my $cm = convert_content_model ($src, $Info, default => 'EMPTY'); |
859 |
|
$s .= xml_condition_section (qq($mname.element) => |
860 |
|
xml_parameter_ENTITY (qq($name.content), value => $cm) |
861 |
|
. xml_parameter_ENTITY (qq($name.qname), value => $short_name) |
862 |
|
. xml_parameter_ENTITY (qq($name.tagmin.start), value => q<->) |
863 |
|
. xml_parameter_ENTITY (qq($name.tagmin.end), value => $cm eq 'EMPTY' ? q<o> : q<->) |
864 |
|
. xml_condition_section (qq(sgml.tag.minimizable) => |
865 |
|
xml_parameter_ENTITY (qq($name.tagmin), |
866 |
|
value => qq"%$name.tagmin.start; %$name.tagmin.end;")) |
867 |
|
. xml_parameter_ENTITY (qq($name.tagmin), value => q"") |
868 |
|
. qq(<!ELEMENT %$name.qname; %$name.tagmin; %$name.content;>\n)); |
869 |
|
$s .= "\n"; |
870 |
$s .= attlist_def (scalar $src->get_attribute ('Attribute', make_new_node => 1), $Info, $mname); |
$s .= attlist_def (scalar $src->get_attribute ('Attribute', make_new_node => 1), $Info, $mname); |
871 |
$s; |
$s; |
872 |
} |
} |
896 |
$mname = ($name =~ /^\Q$Info->{ID}.\E/ ? $name : qq($Info->{ID}.$name)) |
$mname = ($name =~ /^\Q$Info->{ID}.\E/ ? $name : qq($Info->{ID}.$name)) |
897 |
if $mname eq "$Info->{ID}."; |
if $mname eq "$Info->{ID}."; |
898 |
$Info->{QName}->{$1} = 1 if $name =~ /^\Q$Info->{ID}\E\.(.+)/; |
$Info->{QName}->{$1} = 1 if $name =~ /^\Q$Info->{ID}\E\.(.+)/; |
899 |
my $s = qq(@{[description ($src, $Info)]}<!ENTITY % $mname.attlist "INCLUDE"> |
my $s = qq(<!ATTLIST %$name.qname;); |
|
<![%$mname.attlist;[ |
|
|
<!ATTLIST %$name.qname;); |
|
900 |
for my $src (@{$src->child_nodes}) { |
for my $src (@{$src->child_nodes}) { |
901 |
## Attribute Definition |
## Attribute Definition |
902 |
if ($src->local_name eq 'Attribute') { |
if ($src->local_name eq 'Attribute') { |
911 |
if ($_[2]) { |
if ($_[2]) { |
912 |
$s .= qq(\n\t%$Info->{ID}.common.attrib;); |
$s .= qq(\n\t%$Info->{ID}.common.attrib;); |
913 |
} |
} |
914 |
$s .= qq(> |
$s .= qq(>\n); |
915 |
]]> |
qq(@{[description ($src, $Info)]}<!ENTITY % $mname.attlist "INCLUDE">\n) |
916 |
|
. xml_condition_section (qq($mname.attlist) => $s) |
917 |
); |
. "\n"; |
|
$s; |
|
918 |
} |
} |
919 |
|
|
920 |
sub make_module ($$$$) { |
sub make_module ($$$$;%) { |
921 |
my ($src, $Info, $id, $s) = @_; |
my ($src, $Info, $id, $s, %opt) = @_; |
922 |
my $name = $src->get_attribute_value ('Name') |
my $name = $src->get_attribute_value ('Name') |
923 |
|| {attribs => q/Common Attributes/, |
|| {arch => q/Base Architecture/, |
924 |
|
attribs => q/Common Attributes/, |
925 |
|
blkphras => q/Block Phrasal/, |
926 |
|
blkpres => q/Block Presentation/, |
927 |
|
blkstruct => q/Block Structural/, |
928 |
|
charent => q/Character Entities/, |
929 |
datatype => q/Datatypes/, |
datatype => q/Datatypes/, |
930 |
|
framework => q/Modular Framework/, |
931 |
|
inlphras => q/Inline Phrasal/, |
932 |
|
inlpres => q/Inline Presentation/, |
933 |
|
inlstruct => q/Inline Structural/, |
934 |
|
legacy => q/Legacy Markup/, |
935 |
|
list => q/Lists/, |
936 |
|
meta => q/Metainformation/, |
937 |
model => q/Document Model/, |
model => q/Document Model/, |
938 |
qname => q/QName/, |
notations => q/Notations/, |
939 |
struct => q/Structual/, |
pres => q/Presentation/, |
940 |
|
qname => q/QName (Qualified Name)/, |
941 |
|
struct => q/Document Structure/, |
942 |
|
text => q/Text/, |
943 |
}->{$id} |
}->{$id} |
944 |
|| $id; |
|| $id; |
945 |
|
return unless $s; |
946 |
|
|
947 |
my $r = <<EOH; |
my $r = <<EOH; |
948 |
<!-- $Info->{Name} : $name Module |
<!-- ...................................................................... --> |
949 |
|
<!-- @{[do{ |
950 |
|
my $s = qq($Info->{Name} $name Module ); |
951 |
|
if (70 - length $s > 0) { |
952 |
|
$s = dot_padding $s, length => 70, dot => q(.); |
953 |
|
} else { |
954 |
|
$s = qq( $name Module ); |
955 |
|
$s = qq($Info->{Name}\n ) . dot_padding $s, length => 70, dot => q(.); |
956 |
|
} |
957 |
|
$s; |
958 |
|
}]} --> |
959 |
|
<!-- file: $Info->{ID}-$id.mod |
960 |
|
|
961 |
|
@{[make_paragraphs [$Info->{Description}], indent => q< >]} |
962 |
|
|
963 |
|
Copyright @{[(gmtime)[5]+1900]} $Info->{Copyright}, All Rights Reserved. |
964 |
|
|
965 |
|
Permission to use, copy, modify and distribute this DTD and its |
966 |
|
accompanying documentation for any purpose and without fee is hereby |
967 |
|
granted in perpetuity, provided that the above copyright notice and |
968 |
|
this paragraph appear in all copies. The copyright holders make no |
969 |
|
representation about the suitability of the DTD for any purpose. |
970 |
|
|
971 |
|
It is provided "as is" without expressed or implied warranty. |
972 |
|
|
|
Copyright @{[(gmtime)[5]+1900]} $Info->{Copyright} |
|
973 |
Revision: @{[sprintf '%04d-%02d-%02dT%02d:%02d:%02d+00:00', |
Revision: @{[sprintf '%04d-%02d-%02dT%02d:%02d:%02d+00:00', |
974 |
(gmtime)[5]+1900, (gmtime)[4]+1, (gmtime)[3,2,1,0]]} |
(gmtime)[5]+1900, (gmtime)[4]+1, (gmtime)[3,2,1,0] |
975 |
|
]} (Generated by $SCRIPT_NAME/$VERSION) |
976 |
|
|
977 |
|
This DTD module is identified by the SYSTEM identifier: |
978 |
|
|
979 |
|
SYSTEM "$Info->{BaseURI}$Info->{ID}-$id.mod" |
980 |
|
|
981 |
SYSTEM "$Info->{BaseURI}$Info->{ID}-$id.mod" |
...................................................................... --> |
982 |
--> |
|
983 |
|
EOH |
984 |
|
## TODO: Support PUBLIC identifier. |
985 |
|
|
986 |
|
## Module description |
987 |
|
my @para = ({ |
988 |
|
arch => (join "\n", |
989 |
|
q!This optional module includes declarations that enable to be used!, |
990 |
|
q!as a base architecture according to the 'Architectural Forms Definition!, |
991 |
|
q!Requirements' (Annex A.3, ISO/IEC 10744, 2nd edition). For more!, |
992 |
|
q!information on use of architectural forms, see the HyTime web site at!, |
993 |
|
q!<http://www.hytime.org/>.!), |
994 |
|
attribs => q/This module declares many of the common attributes./, |
995 |
|
blkphras => qq/This module declares the element types and their attributes used\n/. |
996 |
|
q/to support block-level phrasal markup./, |
997 |
|
blkpres => qq/This module declares the element types and their attributes used\n/. |
998 |
|
q/to support block-level presentational markup./, |
999 |
|
blkstruct => qq/This module declares the element types and their attributes used\n/. |
1000 |
|
q/to support block-level structural markup./, |
1001 |
|
charent => q/This module declares the set of character entities./, |
1002 |
|
datatype => q/This module defines containers for the datatypes./, |
1003 |
|
framework => qq/This module imstantiates the modules needed to support\n/. |
1004 |
|
q/the modularization model./, |
1005 |
|
inlphras => qq/This module declares the element types and their attributes used\n/. |
1006 |
|
q/to support inline phrasal markup./, |
1007 |
|
inlpres => qq/This module declares the element types and their attributes used\n/. |
1008 |
|
q/to support inline presentational markup./, |
1009 |
|
inlstruct => qq/This module declares the element types and their attributes used\n/. |
1010 |
|
q/to support inline structural markup./, |
1011 |
|
legacy => q/This module declares additional markup that is considered obsolete./, |
1012 |
|
list => qq/This module declares the list-oriented element types\n/. |
1013 |
|
q/and their attributes./, |
1014 |
|
meta => qq/This module declares the element types and their attributes\n/. |
1015 |
|
q/to support metainformation markup./, |
1016 |
|
model => qq/This model describes the groupings of element types that\n/. |
1017 |
|
q/make up common content models./, |
1018 |
|
pres => qq/This module declares the element types and their attributes used\n/. |
1019 |
|
q/to support presentational markup./, |
1020 |
|
qname => (join "\n", |
1021 |
|
q!This module is contained in two parts, labeled Section 'A' and 'B':!, |
1022 |
|
q!!, |
1023 |
|
q! Section A declares parameter entities to support namespace-qualified!, |
1024 |
|
q! names, namespace declarations, and name prefixing.!, |
1025 |
|
q!!, |
1026 |
|
q! Section B declares parameter entities used to provide namespace-qualified!, |
1027 |
|
q! names for all element types and global attribute names.!), |
1028 |
|
struct => qq/This module defines the major structural element types and\n/. |
1029 |
|
q/their attributes./, |
1030 |
|
}->{$id}, $src->get_attribute_value ('Description')); |
1031 |
|
unshift @para, ' '.join ', ', sort @{$Info->{elements}||[]} if @{$Info->{elements}||[]}; |
1032 |
|
if (@para) { |
1033 |
|
$name = qq($Info->{realname} QName (Qualified Name) Module) |
1034 |
|
if $id eq 'qname'; |
1035 |
|
$r .= <<EOH; |
1036 |
|
<!-- $name |
1037 |
|
|
1038 |
|
@{[make_paragraphs \@para, indent => ' ']} |
1039 |
|
--> |
1040 |
|
|
1041 |
EOH |
EOH |
1042 |
|
} |
1043 |
|
|
1044 |
$r .= $s; |
$r .= $s; |
1045 |
|
|
1057 |
$id = "-$id" if $id; |
$id = "-$id" if $id; |
1058 |
|
|
1059 |
my $r = <<EOH; |
my $r = <<EOH; |
1060 |
<!-- $Info->{Name} : Document Type Definition |
<!-- ....................................................................... --> |
1061 |
|
<!-- @{[do{ |
1062 |
Copyright @{[(gmtime)[5]+1900]} $Info->{Copyright} |
my $s = qq($Info->{Name} DTD ); |
1063 |
Revision: @{[sprintf '%04d-%02d-%02dT%02d:%02d:%02d+00:00', |
if (70 - length $s > 0) { |
1064 |
(gmtime)[5]+1900, (gmtime)[4]+1, (gmtime)[3,2,1,0]]} |
$s = dot_padding $s, length => 70, dot => q(.); |
1065 |
|
} else { |
1066 |
|
$s = qq( $Info->{Version} DTD ); |
1067 |
|
$s = qq($Info->{realname}\n ) . dot_padding $s, length => 70, dot => q(.); |
1068 |
|
} |
1069 |
|
$s; |
1070 |
|
}]} --> |
1071 |
|
<!-- file: $Info->{ID}.dtd |
1072 |
|
--> |
1073 |
|
|
1074 |
|
<!-- $Info->{Name} DTD |
1075 |
|
|
1076 |
|
@{[make_paragraphs [$Info->{Description}], indent => q< >]} |
1077 |
|
|
1078 |
|
Copyright @{[(gmtime)[5]+1900]} $Info->{Copyright}, All Rights Reserved. |
1079 |
|
|
1080 |
|
Permission to use, copy, modify and distribute this DTD and its |
1081 |
|
accompanying documentation for any purpose and without fee is hereby |
1082 |
|
granted in perpetuity, provided that the above copyright notice and |
1083 |
|
this paragraph appear in all copies. The copyright holders make no |
1084 |
|
representation about the suitability of the DTD for any purpose. |
1085 |
|
|
1086 |
|
It is provided "as is" without expressed or implied warranty. |
1087 |
|
|
1088 |
|
Revision: @{[sprintf '%04d-%02d-%02dT%02d:%02d:%02d+00:00', |
1089 |
|
(gmtime)[5]+1900, (gmtime)[4]+1, (gmtime)[3,2,1,0]]} |
1090 |
|
|
1091 |
|
--> |
1092 |
|
<!-- This is the driver file for the $Info->{Name} DTD. |
1093 |
|
|
1094 |
|
This DTD is identified by the SYSTEM identifier: |
1095 |
|
|
1096 |
SYSTEM "$Info->{BaseURI}$Info->{ID}$id.dtd" |
SYSTEM "$Info->{BaseURI}$Info->{ID}$id.dtd" |
1097 |
--> |
--> |
1098 |
|
|
1099 |
EOH |
EOH |
1100 |
|
|
1101 |
$r .= $s; |
$r .= $s; |
1112 |
|
|
1113 |
=head1 NAME |
=head1 NAME |
1114 |
|
|
1115 |
mkdtds.pl --- Moduralized XML Document Type Definition Generator |
mkdtds.pl - Modularized XML Document Type Definition (DTD) Generator |
1116 |
|
|
1117 |
=head1 DESCRIPTION |
=head1 DESCRIPTION |
1118 |
|
|
1119 |
This script can be used to generate XML DTD modules and driver |
This script generates XML DTD module implementations and/or DTD drivers, |
1120 |
which is interoperable with XHTML DTD modules. |
that can be used with modularized XHTML DTDs. |
1121 |
|
|
1122 |
=head1 USAGE |
=head1 USAGE |
1123 |
|
|
1134 |
|
|
1135 |
(((See examples on <http://suika.fam.cx/gate/cvs/markup/>))) |
(((See examples on <http://suika.fam.cx/gate/cvs/markup/>))) |
1136 |
|
|
1137 |
=head1 REQUIRED MODULE |
=head1 REQUIRED MODULES |
1138 |
|
|
1139 |
This script uses SuikaWiki::Markup::SuikaWikiConfig20 and |
This script uses C<Message::Markup::SuikaWikiConfig20::Node> and |
1140 |
SuikaWiki::Markup::SuikaWikiConfig20::Parser. |
C<Message::Markup::SuikaWikiConfig20::Parser>. Please retrive it from |
1141 |
Please get it from <http://suika.fam.cx/gate/cvs/suikawiki/script/lib/> |
<http://suika.fam.cx/gate/cvs/messaging/manakai/lib/Message/Markup/SuikaWikiConfig20/> |
1142 |
and put into your lib directory. |
and put into your C<lib> directory. |
1143 |
|
|
1144 |
=head1 AUTHOR |
=head1 AUTHOR |
1145 |
|
|
1147 |
|
|
1148 |
=head1 LICENSE |
=head1 LICENSE |
1149 |
|
|
1150 |
Copyright 2003 Wakaba <w@suika.fam.cx> |
Copyright 2003-2004 Wakaba <w@suika.fam.cx> |
1151 |
|
|
1152 |
This program is free software; you can redistribute it and/or |
This program is free software; you can redistribute it and/or |
1153 |
modify it under the same terms as Perl itself. |
modify it under the same terms as Perl itself. |
1154 |
|
|
1155 |
Note that author claims no right about DTD modules generated by this script. |
Note that author claims no copyright with regard to DTD modules/drivers generated |
1156 |
Author(s) of DTD modules should be explicily state their license terms. |
by this script. Author(s) of DTD modules/drivers should explicily state their |
1157 |
|
license terms in them and their documentation (if any). |
1158 |
|
|
1159 |
=cut |
=cut |