git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] userdiff: fix HTML hunk header regexp

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 24, 2017, 01:15 UTC
Message-ID
<xmqqa81kj3qy.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<CAFU8umjZL0nXUFbuZWVapTaCfAjtAoTT=G3GCKczDE7O8bzAOw@mail.gmail.com>
Ilya Kantor <iliakan@gmail.com> writes:
Show 23 quoted lines
> Current HTML header regexp doesn't match headers without attributes.
>
> So it fails to match <h1>...</h1>, while <h1 class="smth">...</h1> matches.
> The fix makes attributes optional.
> The regexp is still far from perfect, but now it at least handles the
> common case.
>
> Signed-off-by: Ilya Kantor <iliakan@gmail.com>
> ---
>  userdiff.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/userdiff.c b/userdiff.c
> index 6321103ce..dbfb4e13c 100644
> --- a/userdiff.c
> +++ b/userdiff.c
> @@ -38,7 +38,7 @@ IPATTERN("fortran",
>   "|//|\\*\\*|::|[/<>=]="),
>  IPATTERN("fountain", "^((\\.[^.]|(int|ext|est|int\\.?/ext|i/e)[. ]).*)$",
>   "[^ \t-]+"),
> -PATTERNS("html", "^[ \t]*(<[Hh][1-6][ \t].*>.*)$",
> +PATTERNS("html", "^[ \t]*(<[Hh][1-6]([ \t].*)?>.*)$",
>   "[^<>= \t]+"),

What you sent seems to be whitespace damaged, but it was small enough for me to tweak it to apply ;-)

Will queue.  Thanks.
Previous: Ilya Kantor
Message 2 of 2 in “userdiff: fix HTML hunk header regexp”
  1. userdiff: fix HTML hunk header regexpIlya Kantor, Sep 23, 2017
  2. Junio C HamanoSep 24, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.