threads / patch / 15111

patchTeach "git diff" HTML funcname patterns

Subject: [PATCH] Teach "git diff" HTML funcname patterns

## tl;dr

3 messages between Aug 20, 2008 and Aug 20, 2008. Diffs are folded; open one to read it.

replies: 2people: 2as markdown or json

Johan Herland· Aug 20, 2008, 17:27 UTC · lore
Finds lines with <h1>..<h6> tags. The pattern is adapted from the ruby one.
Signed-off-by: Johan Herland <johan@herland.net>
---
 Documentation/gitattributes.txt |    2 ++
 diff.c                          |    1 +
 2 files changed, 3 insertions(+), 0 deletions(-)
Show changes to 2 files +3 −0

Documentation/gitattributes.txt, diff.c

diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt
index db16b0c..8bb05e6 100644
--- a/Documentation/gitattributes.txt
+++ b/Documentation/gitattributes.txt
@@ -320,6 +320,8 @@ patterns are available:
 
 - `tex` suitable for source code for LaTeX documents.
 
+- `html` suitable for HTML/XHTML documents.
+
 
 Performing a three-way merge
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/diff.c b/diff.c
index a6c1432..13ae85d 100644
--- a/diff.c
+++ b/diff.c
@@ -1382,6 +1382,7 @@ static struct builtin_funcname_pattern {
 	{ "bibtex", "\\(@[a-zA-Z]\\{1,\\}[ \t]*{\\{0,1\\}[ \t]*[^ \t\"@',\\#}{~%]*\\).*$" },
 	{ "tex", "^\\(\\\\\\(\\(sub\\)*section\\|chapter\\|part\\)\\*\\{0,1\\}{.*\\)$" },
 	{ "ruby", "^\\s*\\(\\(class\\|module\\|def\\)\\s.*\\)$" },
+	{ "html", "^\\s*\\(<h[1-6]\\s.*>.*\\)$" },
 };
 
 static const char *diff_funcname_pattern(struct diff_filespec *one)
-- 
1.6.0.96.g2fad1
Mike Hommey· Aug 20, 2008, 17:29 UTC · re: Johan Herland · lore

Re: [PATCH] Teach "git diff" HTML funcname patterns

On Wed, Aug 20, 2008 at 07:27:46PM +0200, Johan Herland wrote:
> Finds lines with <h1>..<h6> tags. The pattern is adapted from the ruby one.
Don't you want to catch <H1>...<H6> too ?
Mike
Johan Herland· Aug 20, 2008, 17:49 UTC · re: Mike Hommey · lore

[PATCH v2] Teach "git diff" HTML funcname patterns

Finds lines with <h1>..<h6> tags. The pattern is adapted from the ruby one.
Signed-off-by: Johan Herland <johan@herland.net>
---
On Wednesday 20 August 2008, Mike Hommey wrote:
> On Wed, Aug 20, 2008 at 07:27:46PM +0200, Johan Herland wrote:
> > Finds lines with <h1>..<h6> tags. The pattern is adapted from the
> > ruby one.
> Don't you want to catch <H1>...<H6> too ?
Yes. Thanks.
Have fun!
...Johan
 Documentation/gitattributes.txt |    2 ++
 diff.c                          |    1 +
 2 files changed, 3 insertions(+), 0 deletions(-)
Show changes to 2 files +3 −0

Documentation/gitattributes.txt, diff.c

diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt
index db16b0c..8bb05e6 100644
--- a/Documentation/gitattributes.txt
+++ b/Documentation/gitattributes.txt
@@ -320,6 +320,8 @@ patterns are available:
 
 - `tex` suitable for source code for LaTeX documents.
 
+- `html` suitable for HTML/XHTML documents.
+
 
 Performing a three-way merge
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/diff.c b/diff.c
index a6c1432..9d4b961 100644
--- a/diff.c
+++ b/diff.c
@@ -1382,6 +1382,7 @@ static struct builtin_funcname_pattern {
 	{ "bibtex", "\\(@[a-zA-Z]\\{1,\\}[ \t]*{\\{0,1\\}[ \t]*[^ \t\"@',\\#}{~%]*\\).*$" },
 	{ "tex", "^\\(\\\\\\(\\(sub\\)*section\\|chapter\\|part\\)\\*\\{0,1\\}{.*\\)$" },
 	{ "ruby", "^\\s*\\(\\(class\\|module\\|def\\)\\s.*\\)$" },
+	{ "html", "^\\s*\\(<[Hh][1-6]\\s.*>.*\\)$" },
 };
 
 static const char *diff_funcname_pattern(struct diff_filespec *one)
-- 
1.6.0.96.g2fad1

← back to recent threads