{"thread":{"id":"42384","subject":"[PATCH/RFC] Add userdiff built-in pattern for CSS code","startedAt":"2016-05-19T10:06:25Z","lastAt":"2016-05-19T18:10:29Z","messageCount":4,"participants":["William Duclot","Matthieu Moy","Eric Sunshine"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"286975","messageId":"20160519100625.7945-1-william.duclot@ensimag.grenoble-inp.fr","threadId":"42384","inReplyTo":null,"subject":"[PATCH/RFC] Add userdiff built-in pattern for CSS code","fromName":"William Duclot","fromEmail":"william.duclot@ensimag.grenoble-inp.fr","sentAt":"2016-05-19T10:06:25Z","receivedAt":"2016-05-19T10:06:25Z","isPatch":true,"sender":{"key":"william.duclot@ensimag.grenoble-inp.fr","avatar":null},"body":"CSS is widely used, motivating it being included as a built-in pattern.\nIt must be noted that the word_regex for CSS (i.e. the regex defining what is a word in the language) does not consider '.' and '#' characters (in CSS selectors) to be part of the word. This behavior is documented by the test t/t4018/css-rule.\n\nAdd the info in documentation that CSS is now built-in.\n---\n Documentation/gitattributes.txt |  2 ++\n t/t4018-diff-funcname.sh        |  1 +\n t/t4018/css-rule                |  4 ++++\n t/t4034-diff-words.sh           |  1 +\n t/t4034/css/expect              | 16 ++++++++++++++++\n t/t4034/css/post                |  9 +++++++++\n t/t4034/css/pre                 |  9 +++++++++\n userdiff.c                      |  8 ++++++++\n 8 files changed, 50 insertions(+)\n create mode 100644 t/t4018/css-rule\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/Documentation/gitattributes.txt b/Documentation/gitattributes.txt\nindex e3b1de8..81f60ad 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 language.\n+\n - `fortran` suitable for source code in the Fortran language.\n \n - `fountain` suitable for Fountain documents.\ndiff --git a/t/t4018-diff-funcname.sh b/t/t4018-diff-funcname.sh\nindex 67373dc..1795ffc 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 \tfountain\n \thtml\ndiff --git a/t/t4018/css-rule b/t/t4018/css-rule\nnew file mode 100644\nindex 0000000..84ed754\n--- /dev/null\n+++ b/t/t4018/css-rule\n@@ -0,0 +1,4 @@\n+RIGHT label.control-label {\n+    margin-top: 10px!important;\n+    border : 10px ChangeMe #C6C6C6;\n+}\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..b025d88\n--- /dev/null\n+++ b/t/t4034/css/expect\n@@ -0,0 +1,16 @@\n+<BOLD>diff --git a/pre b/post<RESET>\n+<BOLD>index 735f301..bdf6a90 100644<RESET>\n+<BOLD>--- a/pre<RESET>\n+<BOLD>+++ b/post<RESET>\n+<CYAN>@@ -1,9 +1,9 @@<RESET>\n+.<RED>class-form<RESET><GREEN>other-form<RESET> label.control-label {\n+    margin-top: <RED>10<RESET><GREEN>15<RESET>px!important;\n+    border : 10px <RED>dashed<RESET><GREEN>dotted<RESET> #C6C6C6;\n+}<RESET>\n+<RED>#CCCCCC<RESET>\n+<RED>padding-bottom<RESET><GREEN>#CCCCCB<RESET>\n+<GREEN>margin-left<RESET>\n+150<RED>px<RESET><GREEN>em<RESET>\n+10px\n+<RED>!important<RESET>\n+<RED>div<RESET><GREEN>li<RESET>.class#id\ndiff --git a/t/t4034/css/post b/t/t4034/css/post\nnew file mode 100644\nindex 0000000..bdf6a90\n--- /dev/null\n+++ b/t/t4034/css/post\n@@ -0,0 +1,9 @@\n+.other-form label.control-label {\n+    margin-top: 15px!important;\n+    border : 10px dotted #C6C6C6;\n+}\n+#CCCCCB\n+margin-left\n+150em\n+10px\n+li.class#id\ndiff --git a/t/t4034/css/pre b/t/t4034/css/pre\nnew file mode 100644\nindex 0000000..735f301\n--- /dev/null\n+++ b/t/t4034/css/pre\n@@ -0,0 +1,9 @@\n+.class-form label.control-label {\n+    margin-top: 10px!important;\n+    border : 10px dashed #C6C6C6;\n+}\n+#CCCCCC\n+padding-bottom\n+150px\n+10px!important\n+div.class#id\ndiff --git a/userdiff.c b/userdiff.c\nindex 6bf2505..715a1fd 100644\n--- a/userdiff.c\n+++ b/userdiff.c\n@@ -148,6 +148,14 @@ PATTERNS(\"csharp\",\n \t \"[a-zA-Z_][a-zA-Z0-9_]*\"\n \t \"|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lL]?\"\n \t \"|[-+*/<>%&^|=!]=|--|\\\\+\\\\+|<<=?|>>=?|&&|\\\\|\\\\||::|->\"),\n+PATTERNS(\"css\",\n+\t \"^([^,{}]+)((,[^}]*\\\\{)|([ \\t]*\\\\{))$\",\n+\t /* -- */\n+\t /* This regex comes from W3C CSS specs. Should theorically also allow ISO 10646 characters U+00A0 and higher,\n+\t  * this not handled in this regex. */\n+\t \"-?[_a-zA-F][-_a-zA-F0-9]*\" /* identifiers */\n+\t \"|-?[0-9]+|\\\\#[0-9a-fA-F]+\" /* numbers */\n+),\n { \"default\", NULL, -1, { NULL, 0 } },\n };\n #undef PATTERNS\n-- \n2.8.2.403.gdc9c9d0.dirty\n"},{"id":"286986","messageId":"840800650.10903639.1463669101272.JavaMail.zimbra@imag.fr","threadId":"42384","inReplyTo":"20160519100625.7945-1-william.duclot@ensimag.grenoble-inp.fr","subject":"Re: [PATCH/RFC] Add userdiff built-in pattern for CSS code","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2016-05-19T14:45:01Z","receivedAt":"2016-05-19T14:45:01Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"> Subject: [PATCH/RFC] Add userdiff built-in pattern for CSS code\n\nWe normally write subject lines as \"<subsystem>: <description\",\nhence that would be:\n\nuserdiff: add built-in pattern for CSS\n\nwilliam.duclot@ensimag.grenoble-inp.fr wrote:\n> CSS is widely used, motivating it being included as a built-in pattern.\n> It must be noted that the word_regex for CSS (i.e. the regex defining what is\n> a word in the language) does not consider '.' and '#' characters (in CSS\n> selectors) to be part of the word. This behavior is documented by the test\n> t/t4018/css-rule.\n\nThis text wasn't properly wrapped. Please wrap around 72 columns (M-q on Emacs,\nor google \"text wrap $youreditor\" for others).\n\nAlso, saying _what_ your patch does is not the most important question here.\nFocus on the _why_ in the commit message.\n\n(We had a real-life off-list discussion about this and I agree that it's a\nsensible behavior, but others may disagree)\n\n> Add the info in documentation that CSS is now built-in.\n\nThis doesn't add much to the patch (we can already see that from the patch\nitself). I'd remove it.\n\nMissing sign-off (yours, and you can add mine to mark the fact that I allow\nyou to contribute to Git as part of your student project).\n\n> +PATTERNS(\"css\",\n> +\t \"^([^,{}]+)((,[^}]*\\\\{)|([ \\t]*\\\\{))$\",\n> +\t /* -- */\n> +\t /* This regex comes from W3C CSS specs. Should theorically also allow ISO\n\ns/theorically/theoretically/\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"287001","messageId":"CAPig+cQcK4x+u=PjxGAAPnAgqCAxLHrvbH8Pqgjgd9aAe85g7g@mail.gmail.com","threadId":"42384","inReplyTo":"840800650.10903639.1463669101272.JavaMail.zimbra@imag.fr","subject":"Re: [PATCH/RFC] Add userdiff built-in pattern for CSS code","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2016-05-19T17:41:18Z","receivedAt":"2016-05-19T17:41:18Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Thu, May 19, 2016 at 10:45 AM, Matthieu Moy\n<matthieu.moy@grenoble-inp.fr> wrote:\n>> Subject: [PATCH/RFC] Add userdiff built-in pattern for CSS code\n>> [...snip...]\n>> Add the info in documentation that CSS is now built-in.\n>\n> This doesn't add much to the patch (we can already see that from the patch\n> itself). I'd remove it.\n\nI think you meant to say this \"doesn't add much to the *commit\nmessage*\", and that the sentence should be removed from the commit\nmessage, while retaining the actual documentation update in the patch.\n"},{"id":"287008","messageId":"666636251.5761714.1463681429687.JavaMail.zimbra@ensimag.grenoble-inp.fr","threadId":"42384","inReplyTo":"CAPig+cQcK4x+u=PjxGAAPnAgqCAxLHrvbH8Pqgjgd9aAe85g7g@mail.gmail.com","subject":"Re: [PATCH/RFC] Add userdiff built-in pattern for CSS code","fromName":"William Duclot","fromEmail":"william.duclot@ensimag.grenoble-inp.fr","sentAt":"2016-05-19T18:10:29Z","receivedAt":"2016-05-19T18:10:29Z","isPatch":true,"sender":{"key":"william.duclot@ensimag.grenoble-inp.fr","avatar":null},"body":"> On Thu, May 19, 2016 at 10:45 AM, Matthieu Moy\n> <matthieu.moy@grenoble-inp.fr> wrote:\n> >> Add the info in documentation that CSS is now built-in.\n> >\n> > This doesn't add much to the patch (we can already see that from the patch\n> > itself). I'd remove it.\n> \n> I think you meant to say this \"doesn't add much to the *commit\n> message*\", and that the sentence should be removed from the commit\n> message, while retaining the actual documentation update in the patch.\n> \nThat's of course how I understood it, but thanks for pointing it out !\n\nBeside that, all of Matthieu Moy comments seem correct to me and will be taken into account.\n"}]}