/[suikacvs]/messaging/manakai/doc/template/splitddhtmls.pl
Suika

Contents of /messaging/manakai/doc/template/splitddhtmls.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations) (download)
Sat Sep 29 09:46:15 2007 UTC (18 years, 6 months ago) by wakaba
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -0 lines
File MIME type: text/plain
FILE REMOVED
++ ChangeLog	29 Sep 2007 09:26:20 -0000
2007-09-29  Wakaba  <wakaba@suika.fam.cx>

	* MANIFEST.SKIP: manakai-*.tar.gz is added.

++ manakai/doc/ChangeLog	29 Sep 2007 09:31:49 -0000
2007-09-29  Wakaba  <wakaba@suika.fam.cx>

	* Makefile: Unused rules are removed.

++ manakai/doc/style/ChangeLog	29 Sep 2007 09:40:12 -0000
2007-09-29  Wakaba  <wakaba@suika.fam.cx>

	* disdump-style.css: Removed.

++ manakai/doc/template/ChangeLog	29 Sep 2007 09:45:20 -0000
2007-09-29  Wakaba  <wakaba@suika.fam.cx>

	* ddlist.ja.xsl, ddspec.en.xsl, disdump-test.ja.xhtml, disdump.ja.xsl,
	disdump2htmls.ja.xhtml, splitddhtmls.pl: Removed.

1 wakaba 1.1 #!/usr/bin/perl
2     use strict;
3    
4     my $out = \*STDOUT;
5    
6     my $lang2suffix = {
7     };
8     my $type2suffix = {
9     'text/html' => '.html',
10     'application/xhtml+xml' => '.xhtml',
11     };
12    
13     sub fs ($) {
14     my $s = shift;
15     $s =~ s/([^\w.])/_/g;
16     $s;
17     }
18    
19     sub pdir ($) {
20     my @dir = split m#/#, shift;
21     pop @dir;
22     use File::Path;
23     mkpath ([join '/', @dir], 1, 0711);
24     }
25    
26     while (<>) {
27     if (/^<!\[\[<!\[\[<><\?\?>--<\?\?><>\]\]>\]\]>$/) {
28     my %data;
29     I: while (<>) {
30     if (s/^<>([^:]+):\s*//) {
31     $data{$1} = $_;
32     $data{$1} =~ s/\s+$//;
33     } else {
34     last I;
35     }
36     }
37     my $filename = $data{Name};
38     my $lang = fs ($lang2suffix->{$data{Lang}} or $data{Lang} ? '.' . $data{Lang} : '');
39     $filename .= $lang unless $filename =~ /\b\Q$lang\E\b/;
40     my $type = fs ($type2suffix->{$data{Type}} or $data{Type} ? '.' . $data{Type} : '');
41     $filename .= $type unless $filename =~ /\b\Q$type\E\b/;
42     pdir ($filename);
43     open $out, '>', $filename or die "$0: $ARGV Line $.: $filename: $!";
44     } else {
45     print $out $_;
46     }
47     }
48    
49     __END__
50    
51     =head1 AUTHOR
52    
53     Wakaba <w@suika.fam.cx>
54    
55     =head1 LICENSE
56    
57     Public domain.
58    
59     =cut

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24