Skip to content

Commit 536102f

Browse files
committed
Merge branch 'wd/userdiff-css' into next
Update the funcname definition to support css files. * wd/userdiff-css: userdiff: add built-in pattern for CSS
2 parents 9e7e291 + 0719f3e commit 536102f

15 files changed

+90
-0
lines changed

Documentation/gitattributes.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,8 @@ patterns are available:
527527

528528
- `csharp` suitable for source code in the C# language.
529529

530+
- `css` suitable for cascading style sheets.
531+
530532
- `fortran` suitable for source code in the Fortran language.
531533

532534
- `fountain` suitable for Fountain documents.

t/t4018-diff-funcname.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ diffpatterns="
3030
bibtex
3131
cpp
3232
csharp
33+
css
3334
fortran
3435
fountain
3536
html

t/t4018/css-brace-in-col-1

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
RIGHT label.control-label
2+
{
3+
margin-top: 10px!important;
4+
border : 10px ChangeMe #C6C6C6;
5+
}

t/t4018/css-colon-eol

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
RIGHT h1 {
2+
color:
3+
ChangeMe;
4+
}

t/t4018/css-colon-selector

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
RIGHT a:hover {
2+
margin-top:
3+
10px!important;
4+
border : 10px ChangeMe #C6C6C6;
5+
}

t/t4018/css-common

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
RIGHT label.control-label {
2+
margin-top: 10px!important;
3+
border : 10px ChangeMe #C6C6C6;
4+
}

t/t4018/css-long-selector-list

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
p.header,
2+
label.control-label,
3+
div ul#RIGHT {
4+
margin-top: 10px!important;
5+
border : 10px ChangeMe #C6C6C6;
6+
}

t/t4018/css-prop-sans-indent

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
RIGHT, label.control-label {
2+
margin-top: 10px!important;
3+
padding: 0;
4+
border : 10px ChangeMe #C6C6C6;
5+
}

t/t4018/css-short-selector-list

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
label.control, div ul#RIGHT {
2+
margin-top: 10px!important;
3+
border : 10px ChangeMe #C6C6C6;
4+
}

t/t4018/css-trailing-space

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
RIGHT label.control-label {
2+
margin:10px;
3+
padding:10px;
4+
border : 10px ChangeMe #C6C6C6;
5+
}

t/t4034-diff-words.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ test_language_driver ada
302302
test_language_driver bibtex
303303
test_language_driver cpp
304304
test_language_driver csharp
305+
test_language_driver css
305306
test_language_driver fortran
306307
test_language_driver html
307308
test_language_driver java

t/t4034/css/expect

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<BOLD>diff --git a/pre b/post<RESET>
2+
<BOLD>index b8ae0bb..fe500b7 100644<RESET>
3+
<BOLD>--- a/pre<RESET>
4+
<BOLD>+++ b/post<RESET>
5+
<CYAN>@@ -1,10 +1,10 @@<RESET>
6+
.<RED>class-form<RESET><GREEN>other-form<RESET> label.control-label {
7+
margin-top: <RED>10<RESET><GREEN>15<RESET>px!important;
8+
border : 10px <RED>dashed<RESET><GREEN>dotted<RESET> #C6C6C6;
9+
}<RESET>
10+
<RED>#CCCCCC<RESET><GREEN>#CCCCCB<RESET>
11+
10em<RESET>
12+
<RED>padding-bottom<RESET><GREEN>margin-left<RESET>
13+
150<RED>px<RESET><GREEN>em<RESET>
14+
10px
15+
<RED>!important<RESET>
16+
<RED>div<RESET><GREEN>li<RESET>.class#id

t/t4034/css/post

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.other-form label.control-label {
2+
margin-top: 15px!important;
3+
border : 10px dotted #C6C6C6;
4+
}
5+
#CCCCCB
6+
10em
7+
margin-left
8+
150em
9+
10px
10+
li.class#id

t/t4034/css/pre

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.class-form label.control-label {
2+
margin-top: 10px!important;
3+
border : 10px dashed #C6C6C6;
4+
}
5+
#CCCCCC
6+
10em
7+
padding-bottom
8+
150px
9+
10px!important
10+
div.class#id

userdiff.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,18 @@ PATTERNS("csharp",
148148
"[a-zA-Z_][a-zA-Z0-9_]*"
149149
"|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lL]?"
150150
"|[-+*/<>%&^|=!]=|--|\\+\\+|<<=?|>>=?|&&|\\|\\||::|->"),
151+
IPATTERN("css",
152+
"![:;][[:space:]]*$\n"
153+
"^[_a-z0-9].*$",
154+
/* -- */
155+
/*
156+
* This regex comes from W3C CSS specs. Should theoretically also
157+
* allow ISO 10646 characters U+00A0 and higher,
158+
* but they are not handled in this regex.
159+
*/
160+
"-?[_a-zA-Z][-_a-zA-Z0-9]*" /* identifiers */
161+
"|-?[0-9]+|\\#[0-9a-fA-F]+" /* numbers */
162+
),
151163
{ "default", NULL, -1, { NULL, 0 } },
152164
};
153165
#undef PATTERNS

0 commit comments

Comments
 (0)