December 13, 2007
Cleaning up HTML
Kicking out inline styles with regular expressions
So… you have to clean up some code. Let’s say your client copied their old website content to his new content management system. Your content management system. And what he copied looks like this:

Fire up the “find and replace” function of your editor and check the box “Regular expression”. Then in the find field, enter style=".+". Leave the replace field empty. You’re replacing whatever is found with nothing - it’s not very logical, but this is how computers work. So we have to deal with that.
Now press the “replace all” button and your code is pretty clean again.
Extra clean with HTML Tidy
HTML Tidy is pretty helpful when cleaning up code: check it out at http://tidy.sourceforge.net/. Or just select the text you want to run through Tidy and hit CTRL+SHIFT+H in Textmate.
I would love to use Textmate, some of the features really could boost productivity. But I usually edit files straight of a online (testing)server and Textmate doesn’t support tabs in this situation. Only on projects. I did some research but couldn’t find a satisfying solution. And the possibility to work in tabs outweighs the extra features in textmate. That’s why I now use Textwrangler or smultron.
Maybe I should change my habits and do most of my work offline and setup a local server. But still, there will always be situations when working remote.
How do you handle this when working remote? Or do you get used to having all those windows open?
It was strange to me when I first tested Textmate, I took the tabbed windows when working remote from textwrangler and smultron for granted, it never crossed my mind a ‘better’ editor wouldn’t support it.
December 13th, 2007 at 4:58 ∞Working via FTP is a missing feature in Textmate, very true. I only have to edit a couple of files and I’m used to working with all those windows open. I would love to be able to make projects (even through terminal if I have to).
The third party solutions out there are not safe enough to use in my opinion, you don’t want to risk losing files when you’re working on real projects.
December 13th, 2007 at 5:27 ∞@stijn & @wolf
A little google query brought this up:
December 13th, 2007 at 10:34 ∞http://muffinresearch.co.uk/archives/2006/06/13/use-tabs-in-textmate-for-remote-files-opened-by-transmit/
and
http://lists.macromates.com/pipermail/textmate/2006-February/008636.html
Just tried the Transmit workaround. Seems to work, though you do need to open the project file first. And it doesn’t seem to work when you have multiple files selected in the ftp client (only the first document gets added to the tab bar).
December 13th, 2007 at 10:40 ∞With thanks to Regex Mastrrrr Bramus! :P
December 14th, 2007 at 3:09 ∞Thanks Lode, I tried it out with Cyberduck and it seems to work aswell.
December 17th, 2007 at 12:21 ∞