I was trying to figure out how I could write a snippet that would wrap a bunch of lines into a HTML list... lets say you got this text:
item 01 item 02 item 03
then the snippet would output:
<ul> <li>item 01</li> <li>item 02</li> <li>item 03</li> </ul>
I'm kinda stuck on how to get the recursive thing to adapt to the number of list items... Any thoughts? Thanks! :) ......................................... m i n i m a l d e s i g n 244 Fifth Avenue - Suite P233 New York, NY 10001-7604 USA
tel / fax: 212.931.8525 email: work@minimaldesign.net site: http://minimaldesign.net/
On Sep 9, 2005, at 11:54 AM, minimal.design wrote:
I was trying to figure out how I could write a snippet that would wrap a bunch of lines into a HTML list... lets say you got this text:
item 01 item 02 item 03
then the snippet would output:
<ul> <li>item 01</li> <li>item 02</li> <li>item 03</li> </ul>
I'm kinda stuck on how to get the recursive thing to adapt to the number of list items... Any thoughts? Thanks! :)
How about a macro that does a find/replace non-empty lines in the selection to wrap <li>...</li>, and then wraps the whole selection with <ul>...</ul>
On 09/09/2005, at 19.54, minimal.design wrote:
I was trying to figure out how I could write a snippet that would wrap a bunch of lines into a HTML list... lets say you got this text: [...] I'm kinda stuck on how to get the recursive thing to adapt to the number of list items... Any thoughts? Thanks! :)
Make a new snippet like this:
<ul> ${TM_SELECTED_TEXT/.+/ <li>$0</li>/g}</ul>
That should do it :-).
-- Sune.
On 10/09/2005, at 8.40, Sune Foldager wrote:
Make a new snippet like this:
<ul> ${TM_SELECTED_TEXT/.+/ <li>$0<\/li>/g}</ul> That should do it :-).
By the way, this only works in the TextMate snapshot starting from revision 369. You can grab the (currently) latest snapshot here: http://macromates.com/textmate/build/TextMate_r369.zip
-- Sune.