Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pquery
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
pquery
Commits
96ebf9f8
Commit
96ebf9f8
authored
Jan 04, 2012
by
Taddeus Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added support for double use of CSS rules within a single block.
parent
65b55aee
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
3 deletions
+15
-3
utils/CssParser.php
utils/CssParser.php
+15
-3
No files found.
utils/CssParser.php
View file @
96ebf9f8
...
...
@@ -147,6 +147,10 @@ class CssNode {
}
function
compress
(
$value
,
$rule
)
{
// Double rule names
if
(
preg_match
(
'/^([^#]+)#\d+$/'
,
$rule
,
$m
)
)
$rule
=
$m
[
1
];
// Compress colors
if
(
self
::
$config
[
'compress_colors'
]
&&
preg_match
(
'/color$/'
,
$rule
)
)
$value
=
self
::
compress_color
(
$value
);
...
...
@@ -177,8 +181,16 @@ class CssNode {
foreach
(
preg_split
(
'/\s*;\s*/'
,
trim
(
$rules
))
as
$rule
)
{
$split
=
preg_split
(
'/\s*:\s*/'
,
$rule
,
2
);
if
(
count
(
$split
)
==
2
&&
strlen
(
$split
[
0
])
&&
strlen
(
$split
[
1
])
)
$this
->
rules
[
$split
[
0
]]
=
$split
[
1
];
if
(
count
(
$split
)
==
2
&&
strlen
(
$split
[
0
])
&&
strlen
(
$split
[
1
])
)
{
list
(
$name
,
$value
)
=
$split
;
$i
=
1
;
// Double rule names
while
(
isset
(
$this
->
rules
[
$name
])
)
$name
.=
'#'
.
(
$i
++
);
$this
->
rules
[
$name
]
=
$value
;
}
}
}
...
...
@@ -206,7 +218,7 @@ class CssNode {
$selector
=
$current_node
->
selector
.
(
$self
?
''
:
' '
)
.
$child_selectors
;
}
$current_node
=
$current_node
->
children
[]
=
new
CssNode
(
$selector
,
$m
[
2
]
,
$current_node
);
$current_node
=
$current_node
->
children
[]
=
new
CssNode
(
$selector
,
''
,
$current_node
);
$line
=
$m
[
2
];
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment