/[suikacvs]/markup/html/whatpm/Whatpm/CSS/Parser.pm
Suika

Diff of /markup/html/whatpm/Whatpm/CSS/Parser.pm

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

revision 1.55 by wakaba, Sun Jan 27 08:58:05 2008 UTC revision 1.56 by wakaba, Sun Jan 27 10:14:52 2008 UTC
# Line 563  my $default_serializer = sub { Line 563  my $default_serializer = sub {
563      push @v, 'blink' if $value->[4];      push @v, 'blink' if $value->[4];
564      return 'none' unless @v;      return 'none' unless @v;
565      return join ' ', @v;      return join ' ', @v;
566      } elsif ($value->[0] eq 'QUOTES') {
567        return join ' ', map {'"'.$_.'"'} map {$_->[0], $_->[1]} @{$value->[1]};
568        ## NOTE: The result string might not be a <'quotes'> if it contains
569        ## e.g. '"'.  In addition, it might not be a <'quotes'> if
570        ## @{$value->[1]} is empty (which is unlikely as long as the implementation
571        ## is not broken).
572    } else {    } else {
573      return '';      return '';
574    }    }
# Line 5949  $Prop->{'text-decoration'} = { Line 5955  $Prop->{'text-decoration'} = {
5955  $Attr->{text_decoration} = $Prop->{'text-decoration'};  $Attr->{text_decoration} = $Prop->{'text-decoration'};
5956  $Key->{text_decoration} = $Prop->{'text-decoration'};  $Key->{text_decoration} = $Prop->{'text-decoration'};
5957    
5958    $Attr->{quotes} =
5959    $Key->{quotes} =
5960    $Prop->{quotes} = {
5961      css => 'quotes',
5962      dom => 'quotes',
5963      key => 'quotes',
5964      parse => sub {
5965        my ($self, $prop_name, $tt, $t, $onerror) = @_;
5966    
5967        my @v;
5968        A: {
5969          if ($t->{type} == STRING_TOKEN) {
5970            my $open = $t->{value};
5971            $t = $tt->get_next_token;
5972    
5973            $t = $tt->get_next_token while $t->{type} == S_TOKEN;
5974            if ($t->{type} == STRING_TOKEN) {
5975              push @v, [$open, $t->{value}];
5976              $t = $tt->get_next_token;
5977            } else {
5978              last A;
5979            }
5980          } elsif (not @v and $t->{type} == IDENT_TOKEN) {
5981            my $value = lc $t->{value}; ## TODO: case
5982            if ($value eq 'none' or $value eq '-manakai-default') {
5983              $t = $tt->get_next_token;
5984              return ($t, {$prop_name => ['KEYWORD', $value]});
5985            } elsif ($value eq 'inherit') {
5986              $t = $tt->get_next_token;
5987              return ($t, {$prop_name => ['INHERIT']});
5988            } else {
5989              last A;
5990            }
5991          } else {
5992            if (@v) {
5993              return ($t, {$prop_name => ['QUOTES', \@v]});
5994            } else {
5995              last A;
5996            }
5997          }
5998    
5999          $t = $tt->get_next_token while $t->{type} == S_TOKEN;
6000          redo A;
6001        }
6002        
6003        $onerror->(type => "syntax error:'$prop_name'",
6004                   level => $self->{must_level},
6005                   uri => \$self->{href},
6006                   token => $t);
6007        return ($t, undef);
6008      },
6009      serialize => $default_serializer,
6010      initial => ['KEYWORD', '-manakai-default'],
6011      inherited => 1,
6012      compute => $compute_as_specified,
6013    };
6014    
6015  1;  1;
6016  ## $Date$  ## $Date$

Legend:
Removed from v.1.55  
changed lines
  Added in v.1.56

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24