| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package CSS::Adaptor; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
$VERSION = 1.01; |
|
4
|
|
|
|
|
|
|
|
|
5
|
8
|
|
|
8
|
|
41
|
use strict; |
|
|
8
|
|
|
|
|
16
|
|
|
|
8
|
|
|
|
|
260
|
|
|
6
|
8
|
|
|
8
|
|
41
|
use warnings; |
|
|
8
|
|
|
|
|
12
|
|
|
|
8
|
|
|
|
|
243
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
8
|
|
|
8
|
|
38
|
use Carp qw(croak confess); |
|
|
8
|
|
|
|
|
15
|
|
|
|
8
|
|
|
|
|
2739
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new { |
|
11
|
0
|
|
|
0
|
1
|
0
|
my $class = shift; |
|
12
|
0
|
|
|
|
|
0
|
my $self = bless {}, $class; |
|
13
|
0
|
|
|
|
|
0
|
return $self; |
|
14
|
|
|
|
|
|
|
} |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub output_rule { |
|
17
|
2
|
|
|
2
|
1
|
5
|
my ($self, $rule) = @_; |
|
18
|
2
|
|
|
|
|
14
|
return $rule->selectors.' { '.$rule->properties." }\n" ; |
|
19
|
|
|
|
|
|
|
} |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub output_selectors { |
|
22
|
3
|
|
|
3
|
1
|
6
|
my ($self, $selectors) = @_; |
|
23
|
3
|
|
|
|
|
6
|
return join ', ', map {$_->{name}} @{$selectors} |
|
|
4
|
|
|
|
|
47
|
|
|
|
3
|
|
|
|
|
8
|
|
|
24
|
|
|
|
|
|
|
} |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub output_properties { |
|
27
|
2
|
|
|
2
|
1
|
5
|
my ($self, $properties) = @_; |
|
28
|
2
|
|
|
|
|
5
|
return join '; ', map {$_->{property}.": ".$_->values} @{$properties}; |
|
|
5
|
|
|
|
|
24
|
|
|
|
2
|
|
|
|
|
6
|
|
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub output_values { |
|
32
|
6
|
|
|
6
|
1
|
10
|
my ($self, $values) = @_; |
|
33
|
6
|
|
|
|
|
10
|
return join '', map {$_->{value}} @{$values}; |
|
|
6
|
|
|
|
|
86
|
|
|
|
6
|
|
|
|
|
12
|
|
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
1; |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
__END__ |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 NAME |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
CSS::Adaptor - Arbitrarily map CSS data for use in another context. |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
use CSS; |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
# create a CSS object with an adaptor |
|
49
|
|
|
|
|
|
|
my $css = new CSS({ |
|
50
|
|
|
|
|
|
|
'adaptor' => 'CSS::Adaptor', |
|
51
|
|
|
|
|
|
|
}); |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
# load some CSS data |
|
55
|
|
|
|
|
|
|
$css->read_file( "my_file.css" ); |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# change the adaptor |
|
59
|
|
|
|
|
|
|
$css->set_adaptor( "CSS::Adaptor::Pretty" ); |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
# output CSS object using the current adaptor |
|
63
|
|
|
|
|
|
|
print $css->output(); |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
This class is used by CSS to translate a CSS object to a string. This |
|
69
|
|
|
|
|
|
|
allows CSS data to be easily mapped into other formats. |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
This documentation is for people who want to write their own CSS::Adaptor |
|
72
|
|
|
|
|
|
|
module. For usage information, see the documentation for CSS. |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 METHODS |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head2 CONSTRUCTOR |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=over 4 |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=item C<new()> |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Called without options. |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=back |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head2 FUNCTIONS |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=over 4 |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=item C<output_rule( $rule )> |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
returns a string containing a formatted CSS::Style object, passed as an object ref |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=item C<output_selectors( $selectors )> |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
returns a string containing a formatted list of CSS::Selector objects, passed as an array ref |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=item C<output_properties( $properties )> |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
returns a string containing a formatted list of CSS::Property objects, passed as an array ref |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=item C<output_values( $values )> |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
returns a string containing a formatted list of CSS::Value objects, passed as an array ref |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=back |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 AUTHORS |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Copyright (C) 2001-2002, Allen Day <allenday@ucla.edu> |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
Copyright (C) 2003-2004, Cal Henderson <cal@iamcal.com> |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
L<CSS> |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=cut |