[TxMt] [ANN] Select Balanced HTML Tag!!!1!
Hans-Jörg Bibiko
bibiko at eva.mpg.de
Fri Nov 16 11:38:13 UTC 2007
On 16.11.2007, at 12:23, Thomas Aylott - subtleGradient wrote:
> Thanks!
>
> Yeah, I've already come across most of this stuff too.
> I just finally found something that half-worked and wanted to get
> it out in the world before I got bored or too busy to finish it.
>
> Some sort of native functionality is what I would prefer.
> It's almost shameful that TextMate doesn't offer this natively.
>
> For the updated version, I'll probly have it escape all brackets in
> the doc first, and then do another pass to put back only those
> brackets that are most likely to give the best balancing results.
> And then do all the business with selections and whatever. That
> should make it much more robust and capable of handling rhtml and
> embedded source and stuff.
>
> The current version is only really useful on REALLY clean pages,
> and then only sometimes ;)
>
> I'd also like to build up some nice testcases to check against
> anytime I make any changes.
> I bet I could use TMTOOLS to automate testing since it can move
> the caret around and run macros.
I attached a very FIRST approach using TMTOOLS for that.
Mainly I took the ruby script 'Insert close Tag' := $TAG
[It has some tiny hooks but at the first glance it works quite well]
Then I created a SIMPLE regexp:
REGEXP="(?m)<$TAG\b.*?>\\/$TAG>"
[One has to enhance it later!!]
Then I took that regexp for two macro:
-findNext regexp
-findPrevious regexp
Maybe you find some hints in it ;)
Of course, that command has no 'go backwards' function.
Cheers,
--Hans
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Select Balanced XHTML Tag FIRST APPROACH.tmCommand
Type: application/octet-stream
Size: 3843 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20071116/167e44b9/attachment.tmCommand>
More information about the textmate
mailing list