From 0719f3eecd1234f6331cab980088239207e93335 Mon Sep 17 00:00:00 2001 From: William Duclot Date: Fri, 3 Jun 2016 14:32:26 +0200 Subject: userdiff: add built-in pattern for CSS CSS is widely used, motivating it being included as a built-in pattern. It 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. The logic behind this behavior is the following: identifiers in CSS selectors are identifiers in a HTML/XML document. Therefore, the '.'/'#' character are not part of the identifier, but an indicator of the nature of the identifier in HTML/XML (class or id). Diffing ".class1" and ".class2" must show that the class name is changed, but we still are selecting a class. Logic behind the "pattern" regex is: 1. reject lines ending with a colon/semicolon (properties) 2. if a line begins with a name in column 1, pick the whole line Credits to Johannes Sixt (j6t@kdbg.org) for the pattern regex and most of the tests. Signed-off-by: William Duclot Signed-off-by: Matthieu Moy Reviewed-by: Johannes Sixt Signed-off-by: Junio C Hamano --- t/t4018/css-trailing-space | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 t/t4018/css-trailing-space (limited to 't/t4018/css-trailing-space') diff --git a/t/t4018/css-trailing-space b/t/t4018/css-trailing-space new file mode 100644 index 0000000000..32b5606c70 --- /dev/null +++ b/t/t4018/css-trailing-space @@ -0,0 +1,5 @@ +RIGHT label.control-label { + margin:10px; + padding:10px; + border : 10px ChangeMe #C6C6C6; +} -- cgit v1.2.3