[TxMt] Tiny bug in HTML Bundle command "Insert Close Tag"

Hans-Jörg Bibiko bibiko at eva.mpg.de
Fri Nov 23 22:32:48 UTC 2007


Hi,

I encountered a tiny bug in the Ruby code for:  "Insert Close Tag"

If one has he following HTML code:

<HTML><HEAD><TITLE>foo</TITLE></HEAD><BODY>
<HR>

and press OPT+APPLE+. it will insert </HR> not </BODY>.

The reason is here:

# remove all self-closing tags
if ENV.has_key?('TM_HTML_EMPTY_TAGS') then
   empty_tags = ENV['TM_HTML_EMPTY_TAGS']
   before.gsub!(/<(#{empty_tags})\b[^>]*>/, '')
end

The regexp is not case insensitive! TM_HTML_EMPTY_TAGS are written in  
lower case only.

Ergo:

# remove all self-closing tags
if ENV.has_key?('TM_HTML_EMPTY_TAGS') then
   empty_tags = ENV['TM_HTML_EMPTY_TAGS']
   before.gsub!(/<(#{empty_tags})\b[^>]*>/i, '')
end


Cheers,

--Hans



More information about the textmate mailing list