[TxMt] substitute space w/ underscore within snippets

Yann Bettremieux textmate at minimaldesign.net
Sat Mar 10 00:03:50 UTC 2007


I made a HTML snippet that takes a list such as:

Home
Info
Contact

and turns it into:

<ol id="navbar">
    <li class="home"><a href="home.php" title="Go to the Home  
page">Home</a></li>
    <li class="info"><a href="info.php" title="Go to the Info  
page">Info</a></li>
    <li class="contact"><a href="contact.php" title="Go to the  
Contact page">Contact</a></li>
</ol>

That's what I got so far:

<ol id="navbar">
${TM_SELECTED_TEXT/.+/   <li class="\L$0"><a href="$0\E.php"  
title="Go to the $0 page">$0<\/a><\/li>/g}
</ol>

My problem is if one of the menu item is more than one word, I'd like  
to replace the space in the name with an underscore in the URI.  
Anyone's got the code for that?

Thanks!



More information about the textmate mailing list