Wikia

Vim Tips Wiki

Changes: Quote unquoted HTML attributes

Edit

Back to page

(Adjust previous/next navigation + minor manual clean)
(adjust previous/next navigation + minor manual clean)
 
Line 3: Line 3:
 
|id=662
 
|id=662
 
|previous=660
 
|previous=660
|next=663
+
|next=667
 
|created=2004
 
|created=2004
 
|complexity=basic
 
|complexity=basic
 
|author=James Childers
 
|author=James Childers
|version=5.7
+
|version=6.0
 
|rating=14/8
 
|rating=14/8
 
|category1=HTML
 
|category1=HTML

Latest revision as of 05:24, August 11, 2011

Tip 662 Printable Monobook Previous Next

created 2004 · complexity basic · author James Childers · version 6.0


This is a simple regex that can be used to search an HTML file and replace all unquoted attributes with their quoted version.

map <F9> :%s/\([^&^?]\)\(\<[[:alnum:]-]\{-}\)=\([[:alnum:]-#%]\+\)/\1\2="\3"/g<CR>

CommentsEdit

I use this regex and abbreviate it to "reg1".

cabbrev reg1 %s/=\([^"][^> ]\{0,40\}\)/="\1"/gc

Around Wikia's network

Random Wiki