Skip to content

Commit

Permalink
userdiff: expand detected chunk headers for css
Browse files Browse the repository at this point in the history
Added support for classes, ids, :root selectors
as well as @-based statements (ex: @page, @media
and @Keyframes ).

Also added tests for the same.

Signed-off-by: Sohom Datta <sohom.datta@learner.manipal.edu>
  • Loading branch information
sohomdatta1 committed Oct 7, 2020
1 parent d98273b commit ca178c0
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 1 deletion.
4 changes: 4 additions & 0 deletions t/t4018/css-attribute-value-selector
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[class*="RIGHT"] {
background : #000;
border : 10px ChangeMe #C6C6C6;
}
10 changes: 10 additions & 0 deletions t/t4018/css-block-level-@-statements
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@keyframes RIGHT {
from {
background : #000;
border : 10px ChangeMe #C6C6C6;
}
to {
background : #fff;
border : 10px solid #C6C6C6;
}
}
4 changes: 4 additions & 0 deletions t/t4018/css-class-selector
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.RIGHT {
background : #000;
border : 10px ChangeMe #C6C6C6;
}
4 changes: 4 additions & 0 deletions t/t4018/css-id-selector
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#RIGHT {
background : #000;
border : 10px ChangeMe #C6C6C6;
}
4 changes: 4 additions & 0 deletions t/t4018/css-root-selector
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
:RIGHT {
background : #000;
border : 10px ChangeMe #C6C6C6;
}
2 changes: 1 addition & 1 deletion userdiff.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ PATTERNS("csharp",
"|[-+*/<>%&^|=!]=|--|\\+\\+|<<=?|>>=?|&&|\\|\\||::|->"),
IPATTERN("css",
"![:;][[:space:]]*$\n"
"^[_a-z0-9].*$",
"^(([_a-z0-9]|[:[@.#][_a-z0-9]).*)$",
/* -- */
/*
* This regex comes from W3C CSS specs. Should theoretically also
Expand Down

0 comments on commit ca178c0

Please sign in to comment.