{"thread":{"id":"38754","subject":"[GSoC][PATCH 2/2] attrs: add \"css\" to the list of userdiff bulit-in patterns","startedAt":"2015-03-08T11:03:43Z","lastAt":"2015-03-08T23:08:31Z","messageCount":4,"participants":["Hiroyuki Sano","Eric Sunshine"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"257319","messageId":"1425812624-6671-1-git-send-email-sh19910711@gmail.com","threadId":"38754","inReplyTo":null,"subject":"[GSoC][PATCH 1/2] userdiff: add built-in patterns for CSS","fromName":"Hiroyuki Sano","fromEmail":"sh19910711@gmail.com","sentAt":"2015-03-08T11:03:43Z","receivedAt":"2015-03-08T11:03:43Z","isPatch":true,"sender":{"key":"sh19910711@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1015222?v=4"},"body":"Add regex patterns for CSS. The word regex maches selectors, properties,\nand values. On the other hand, the funcname regex matches lines contains\nthe curly brace character.\n\nSigned-off-by: Hiroyuki Sano <sh19910711@gmail.com>\n---\n t/t4018-diff-funcname.sh |  1 +\n t/t4034-diff-words.sh    |  1 +\n t/t4034/css/expect       | 35 +++++++++++++++++++++++++++++++++++\n t/t4034/css/post         | 32 ++++++++++++++++++++++++++++++++\n t/t4034/css/pre          | 32 ++++++++++++++++++++++++++++++++\n userdiff.c               |  3 +++\n 6 files changed, 104 insertions(+)\n create mode 100644 t/t4034/css/expect\n create mode 100644 t/t4034/css/post\n create mode 100644 t/t4034/css/pre\n\ndiff --git a/t/t4018-diff-funcname.sh b/t/t4018-diff-funcname.sh\nindex 1dbaa38..29fe220 100755\n--- a/t/t4018-diff-funcname.sh\n+++ b/t/t4018-diff-funcname.sh\n@@ -30,6 +30,7 @@ diffpatterns=\"\n \tbibtex\n \tcpp\n \tcsharp\n+\tcss\n \tfortran\n \thtml\n \tjava\ndiff --git a/t/t4034-diff-words.sh b/t/t4034-diff-words.sh\nindex f2f55fc..912df91 100755\n--- a/t/t4034-diff-words.sh\n+++ b/t/t4034-diff-words.sh\n@@ -302,6 +302,7 @@ test_language_driver ada\n test_language_driver bibtex\n test_language_driver cpp\n test_language_driver csharp\n+test_language_driver css\n test_language_driver fortran\n test_language_driver html\n test_language_driver java\ndiff --git a/t/t4034/css/expect b/t/t4034/css/expect\nnew file mode 100644\nindex 0000000..8bc6dfd\n--- /dev/null\n+++ b/t/t4034/css/expect\n@@ -0,0 +1,35 @@\n+<BOLD>diff --git a/pre b/post<RESET>\n+<BOLD>index c53f20b..7e64463 100644<RESET>\n+<BOLD>--- a/pre<RESET>\n+<BOLD>+++ b/post<RESET>\n+<CYAN>@@ -2,7 +2,7 @@<RESET> <RESET><MAGENTA>elm1, elm2 {<RESET>\n+prop: first-value;<RESET>\n+prop: value;<RESET>\n+prop: value;<RESET>\n+prop: <RED>value<RESET><GREEN>NEW-VALUE<RESET>;\n+prop: last-value;<RESET>\n+}<RESET>\n+\n+<CYAN>@@ -10,7 +10,7 @@<RESET> <RESET><MAGENTA>elm3, elm4 {<RESET>\n+prop: first-value;<RESET>\n+prop: value;<RESET>\n+prop: value;<RESET>\n+<RED>prop<RESET><GREEN>NEW-PROP<RESET>: value;\n+prop: last-value;<RESET>\n+}<RESET>\n+\n+<CYAN>@@ -19,7 +19,7 @@<RESET> <RESET><MAGENTA>elm6 {<RESET>\n+prop: first-value;<RESET>\n+prop: value;<RESET>\n+prop: value;<RESET>\n+<RED>prop<RESET><GREEN>NEW-PROP<RESET>: <RED>value<RESET><GREEN>NEW-VALUE<RESET>;\n+prop: last-value;<RESET>\n+}<RESET>\n+\n+<CYAN>@@ -27,6 +27,6 @@<RESET> <RESET><MAGENTA>.class, elm:hover, elm:first-child, elm:lang(en), #id, elm#id, .num123{<RESET>\n+prop: first-value;<RESET>\n+prop: value;<RESET>\n+prop: value;<RESET>\n+<RED>prop<RESET><GREEN>NUM-PROP<RESET>: <RED>value<RESET><GREEN>999<RESET>;\n+prop: last-value;<RESET>\n+}<RESET>\ndiff --git a/t/t4034/css/post b/t/t4034/css/post\nnew file mode 100644\nindex 0000000..7e64463\n--- /dev/null\n+++ b/t/t4034/css/post\n@@ -0,0 +1,32 @@\n+elm1, elm2 {\n+prop: first-value;\n+prop: value;\n+prop: value;\n+prop: NEW-VALUE;\n+prop: last-value;\n+}\n+\n+elm3, elm4 {\n+prop: first-value;\n+prop: value;\n+prop: value;\n+NEW-PROP: value;\n+prop: last-value;\n+}\n+\n+elm5,\n+elm6 {\n+prop: first-value;\n+prop: value;\n+prop: value;\n+NEW-PROP: NEW-VALUE;\n+prop: last-value;\n+}\n+\n+.class, elm:hover, elm:first-child, elm:lang(en), #id, elm#id, .num123{\n+prop: first-value;\n+prop: value;\n+prop: value;\n+NUM-PROP: 999;\n+prop: last-value;\n+}\ndiff --git a/t/t4034/css/pre b/t/t4034/css/pre\nnew file mode 100644\nindex 0000000..c53f20b\n--- /dev/null\n+++ b/t/t4034/css/pre\n@@ -0,0 +1,32 @@\n+elm1, elm2 {\n+prop: first-value;\n+prop: value;\n+prop: value;\n+prop: value;\n+prop: last-value;\n+}\n+\n+elm3, elm4 {\n+prop: first-value;\n+prop: value;\n+prop: value;\n+prop: value;\n+prop: last-value;\n+}\n+\n+elm5,\n+elm6 {\n+prop: first-value;\n+prop: value;\n+prop: value;\n+prop: value;\n+prop: last-value;\n+}\n+\n+.class, elm:hover, elm:first-child, elm:lang(en), #id, elm#id, .num123{\n+prop: first-value;\n+prop: value;\n+prop: value;\n+prop: value;\n+prop: last-value;\n+}\ndiff --git a/userdiff.c b/userdiff.c\nindex 2ccbee5..8374a2a 100644\n--- a/userdiff.c\n+++ b/userdiff.c\n@@ -37,6 +37,9 @@ IPATTERN(\"fortran\",\n \t \"|//|\\\\*\\\\*|::|[/<>=]=\"),\n PATTERNS(\"html\", \"^[ \\t]*(<[Hh][1-6][ \\t].*>.*)$\",\n \t \"[^<>= \\t]+\"),\n+PATTERNS(\"css\",\n+\t \"^.*[{].*$\",\n+\t \"[-_\\\\.,#a-zA-Z0-9]+\"),\n PATTERNS(\"java\",\n \t \"!^[ \\t]*(catch|do|for|if|instanceof|new|return|switch|throw|while)\\n\"\n \t \"^[ \\t]*(([A-Za-z_][A-Za-z_0-9]*[ \\t]+)+[A-Za-z_][A-Za-z_0-9]*[ \\t]*\\\\([^;]*)$\",\n-- \n2.3.1\n"},{"id":"257318","messageId":"1425812624-6671-2-git-send-email-sh19910711@gmail.com","threadId":"38754","inReplyTo":"1425812624-6671-1-git-send-email-sh19910711@gmail.com","subject":"[GSoC][PATCH 2/2] attrs: add \"css\" to the list of userdiff bulit-in patterns","fromName":"Hiroyuki Sano","fromEmail":"sh19910711@gmail.com","sentAt":"2015-03-08T11:03:44Z","receivedAt":"2015-03-08T11:03:44Z","isPatch":true,"sender":{"key":"sh19910711@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1015222?v=4"},"body":"Signed-off-by: Hiroyuki Sano <sh19910711@gmail.com>\n---\n Documentation/gitattributes.txt | 2 ++\n 1 file changed, 2 insertions(+)\n\ndiff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt\nindex c892ffa..8904a2a 100644\n--- a/Documentation/gitattributes.txt\n+++ b/Documentation/gitattributes.txt\n@@ -525,6 +525,8 @@ patterns are available:\n \n - `csharp` suitable for source code in the C# language.\n \n+- `css` suitable for source code in the CSS documents.\n+\n - `fortran` suitable for source code in the Fortran language.\n \n - `html` suitable for HTML/XHTML documents.\n-- \n2.3.1\n"},{"id":"257351","messageId":"CAPig+cTTy+Thkpb-jR9e5PGq_NN2Z+wgRB=csgo5Z0Y39M_ZFg@mail.gmail.com","threadId":"38754","inReplyTo":"1425812624-6671-2-git-send-email-sh19910711@gmail.com","subject":"Re: [GSoC][PATCH 2/2] attrs: add \"css\" to the list of userdiff bulit-in patterns","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2015-03-08T23:02:44Z","receivedAt":"2015-03-08T23:02:44Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Sun, Mar 8, 2015 at 7:03 AM, Hiroyuki Sano <sh19910711@gmail.com> wrote:\n> attrs: add \"css\" to the list of userdiff bulit-in patterns\n\ns/bulit/built/\n\n> Signed-off-by: Hiroyuki Sano <sh19910711@gmail.com>\n> ---\n> diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt\n> index c892ffa..8904a2a 100644\n> --- a/Documentation/gitattributes.txt\n> +++ b/Documentation/gitattributes.txt\n> @@ -525,6 +525,8 @@ patterns are available:\n>\n>  - `csharp` suitable for source code in the C# language.\n>\n> +- `css` suitable for source code in the CSS documents.\n\nTaking a hint from the 'html' case, it might make more sense to say:\n\n    `css` suitable for CSS documents.\n\nConsidering how directly related this change is to those in patch 1,\nit's not clear why this change needs a separate patch, so folding them\ninto a single patch might be sensible.\n\n> +\n>  - `fortran` suitable for source code in the Fortran language.\n>\n>  - `html` suitable for HTML/XHTML documents.\n> --\n> 2.3.1\n"},{"id":"257352","messageId":"CAPig+cTEbX+cD39-_5EC8o7uciBw7uL58C31ePMXCJ3SLzYJtg@mail.gmail.com","threadId":"38754","inReplyTo":"1425812624-6671-1-git-send-email-sh19910711@gmail.com","subject":"Re: [GSoC][PATCH 1/2] userdiff: add built-in patterns for CSS","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2015-03-08T23:08:31Z","receivedAt":"2015-03-08T23:08:31Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Sun, Mar 8, 2015 at 7:03 AM, Hiroyuki Sano <sh19910711@gmail.com> wrote:\n> Add regex patterns for CSS. The word regex maches selectors, properties,\n> and values. On the other hand, the funcname regex matches lines contains\n> the curly brace character.\n>\n> Signed-off-by: Hiroyuki Sano <sh19910711@gmail.com>\n> ---\n> diff --git a/t/t4034/css/post b/t/t4034/css/post\n> new file mode 100644\n> index 0000000..7e64463\n> --- /dev/null\n> +++ b/t/t4034/css/post\n> @@ -0,0 +1,32 @@\n> [...]\n> +.class, elm:hover, elm:first-child, elm:lang(en), #id, elm#id, .num123{\n\nMental note: colon and parentheses are present\n\n> diff --git a/userdiff.c b/userdiff.c\n> index 2ccbee5..8374a2a 100644\n> --- a/userdiff.c\n> +++ b/userdiff.c\n> @@ -37,6 +37,9 @@ IPATTERN(\"fortran\",\n>          \"|//|\\\\*\\\\*|::|[/<>=]=\"),\n>  PATTERNS(\"html\", \"^[ \\t]*(<[Hh][1-6][ \\t].*>.*)$\",\n>          \"[^<>= \\t]+\"),\n> +PATTERNS(\"css\",\n> +        \"^.*[{].*$\",\n> +        \"[-_\\\\.,#a-zA-Z0-9]+\"),\n\nIs the intention that this should match \"elm:lang(en)\" as an atom, or\nseparately match \"elm\", \"lang\", and \"en\"?\n\n>  PATTERNS(\"java\",\n>          \"!^[ \\t]*(catch|do|for|if|instanceof|new|return|switch|throw|while)\\n\"\n>          \"^[ \\t]*(([A-Za-z_][A-Za-z_0-9]*[ \\t]+)+[A-Za-z_][A-Za-z_0-9]*[ \\t]*\\\\([^;]*)$\",\n> --\n"}]}