/[suikacvs]/markup/html/html5/spec-ja/make2.pl
Suika

Diff of /markup/html/html5/spec-ja/make2.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by wakaba, Sun Oct 26 08:44:19 2008 UTC revision 1.8 by wakaba, Fri Oct 31 06:32:25 2008 UTC
# Line 36  my $source_text; Line 36  my $source_text;
36  }  }
37    
38  my $part = 'cover';  my $part = 'cover';
 clear_fallback_entries ();  
39    
40  my $status = {};  my $status = {};
41  my $all_status = {};  my $all_status = {};
42  my $tbt_added = {};  my $tbt_added = {};
43    
44  warn "Generating...\n";  warn "Generating...\n";
45  $source_text =~ s{(<(?>p(?>re)?|li|d[td]|t[dh]|h[1-6])(?>\s[^>]*)?>)((?>(?!</?(?>p(?>re)?|li|d(?>[tdl]|iv)|t(?>[dr]|h(?>ead)?|able|body|foot)|h[1-6r]|ul|ol)(?>\s[^>]*)?>).)+)}  $source_text =~ s{(<(?>p(?>re)?|li|d[td]|t[dh]|h[1-6]|caption)(?>\s[^>]*)?>)((?>(?!</?(?>p(?>re)?|li|d(?>[tdl]|iv)|t(?>[dr]|h(?>ead)?|able|b(?>ody|lockquote)|foot)|h[1-6r]|ul|ol|caption|section)(?>\s[^>]*)?>).)+)}
46  {  {
47    my ($tag, $text) = ($1, $2);    my ($tag, $text) = ($1, $2);
48    my $prefix = '';    my $prefix = '';
# Line 65  $source_text =~ s{(<(?>p(?>re)?|li|d[td] Line 64  $source_text =~ s{(<(?>p(?>re)?|li|d[td]
64      if (defined $ja_text) {      if (defined $ja_text) {
65        $status->{ja}++;        $status->{ja}++;
66        $all_status->{$part}->{ja}++;        $all_status->{$part}->{ja}++;
67    
68          my $jt = $ja_text->[0];
69          $jt =~ s{\[\[([A-Z ]+):([^]]+)\]\]}
70              {<em class=rfc2119 title="$1">$2</em>}gs;
71    
72        add_class ($tag, 'has-ja-translation', $ja_text->[1]) .        add_class ($tag, 'has-ja-translation', $ja_text->[1]) .
73        q[<span class=en-original lang=en>] .        q[<span class=en-original lang=en>] .
74        $prefix .        $prefix .
75        escape_id ($text, 'en-') . q[</span>] .        escape_id ($text, 'en-') . q[</span>] .
76        q[<span class=ja-translation lang=ja>] .        q[<span class=ja-translation lang=ja>] .
77        $prefix .        $prefix . $jt . q[</span>];
       $ja_text->[0] . q[</span>];  
78      } else {      } else {
79        my $v;        my $v;
80        for my $pattern (@pattern) {        for my $pattern (@pattern) {
81          if ($n_text =~ /^$pattern$/) {          if ($n_text =~ /^$pattern$/) {
82            $status->{ja}++;            $status->{ja}++;
83            $all_status->{$part}->{ja}++;            $all_status->{$part}->{ja}++;
84    
85              my $jt = replace_pattern2 ($pattern{$pattern}->[0],
86                                         $1, $2, $3, $4, $5, $6, $7, $8, $9);
87              $jt =~ s{\[\[([A-Z ]+):([^]]+)\]\]}
88                  {<em class=rfc2119 title="$1">$2</em>}gs;
89    
90            my $real_hash = get_hash ($n_text);            my $real_hash = get_hash ($n_text);
91            $v = add_class ($tag, 'has-ja-translation',            $v = add_class ($tag, 'has-ja-translation',
92                            $pattern{$pattern}->[1], $real_hash) .                            $pattern{$pattern}->[1], $real_hash) .
# Line 85  $source_text =~ s{(<(?>p(?>re)?|li|d[td] Line 94  $source_text =~ s{(<(?>p(?>re)?|li|d[td]
94                $prefix .                $prefix .
95                escape_id ($text, 'en-') . q[</span>] .                escape_id ($text, 'en-') . q[</span>] .
96                q[<span class=ja-translation lang=ja>] .                q[<span class=ja-translation lang=ja>] .
97                $prefix .                $prefix . $jt .
               replace_pattern2 ($pattern{$pattern}->[0], $1, $2, $3, $4, $5) .  
98                q[</span>];                q[</span>];
99    
100            unless ($tbt_added->{$n_text}) {            unless ($tbt_added->{$n_text}) {
# Line 116  $source_text =~ s{(<(?>p(?>re)?|li|d[td] Line 124  $source_text =~ s{(<(?>p(?>re)?|li|d[td]
124      $1 . $2;      $1 . $2;
125    }    }
126  }ges;  }ges;
127  $source_text =~ s{(<(?>link|img|script)\s[^>]+>)}{  $source_text =~ s{(<((?>link|img|script))\s[^>]+>)}{
128    my $tag = $1;    my $tag = $1;
129      my $tag_name = $2;
130    my $n_text = normalize ($tag);    my $n_text = normalize ($tag);
131    my $ja_text = $data{$n_text};    my $ja_text = $data{$n_text};
132    if (defined $ja_text) {    if (defined $ja_text) {
133      $ja_text->[0];      $ja_text->[0];
134    } else {    } else {
135        unless ($tbt_added->{$n_text}) {
136          set_fallback_entry (scalar (get_hash ($n_text)),
137                              {en => $tag, tags => [$tag_name . '-tag']});
138          $tbt_added->{$n_text} = 1;
139        }
140      $tag;      $tag;
141    }    }
142  }ges;  }ges;
143    
 $source_text =~ s{\[\[([A-Z ]+):([^]]+)\]\]}  
 {<em class=rfc2119 title="$1">$2</em>}gs;  
   
144  #$source_text =~ s[<title>][<base href="http://www.whatwg.org/specs/web-apps/current-work/"><title>];  #$source_text =~ s[<title>][<base href="http://www.whatwg.org/specs/web-apps/current-work/"><title>];
145    
146  {  {
# Line 201  sub escape_id ($$) { Line 212  sub escape_id ($$) {
212    
213    return $content;    return $content;
214  } # escape_id  } # escape_id
215    
216    ## Author: Wakaba <w@suika.fam.cx>.
217    ## License: Copyright 2008 Wakaba.  You are granted a license to use,
218    ##     reproduce and create derivative works of this script.
219    ## $Date$

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.8

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24