Monday, October 1, 2012

Re: Syntax highlight wrong closing XML tag?

On Fri, Sep 28, 2012 at 03:52:40PM -0300, Silas Silva wrote:
> One of my needs was to highlight tags that don't match its closing tag.
> For example:
>
> <foo> text <bar> text </foo> text </bar>
>
> It should highlight the first <foo></bar> pair, since they don't match.

A not complete workable way I found is having the following syntax
rules:

syn match wrongTag "</[a-z]*>" contained
syn region myRegion start='<\z(\w*\)>' end='</\(\z1\)>' contains=wrongTag keepend

hi def link wrongTag Error

The problem is that it doesn't only matches wrong tags inside myRegion
but also the closing tag of the region. How to make it not match the
closing tag?

Thank you.

--
Silas Silva

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment