Here's what I'm doing with the repeating tab stops, using </ul> as the tab trigger. I end up creating one of these on every site I design, so this will make things easier. They all follow the same format, and if there are multiple lists, they just change ids. I have not yet accounted for nested or dropdown menus.
Brett
----------------------------------------------- Create Navbar: ----------------------------------------------- <ul id="${1:navbar}"}> <li class="${2/[[:alpha:]]+|( )/(?1:_:\L$0)/g}"><a href="${3:#}">$2</ a></li> </ul>$0
Tab Trigger: Navbar
----------------------------------------------- Create Navbar Menu Item: -----------------------------------------------
<li class="${1/[[:alpha:]]+|( )/(?1:_:\L$0)/g}"><a href="${2:#}">$1</ a></li> </ul>$0
Tab Trigger: </ul>
Ehm, what's with the big regexp in the class attribute? What does it do :)
Andreas
It creates a lowercase class name without spaces based on the text of the link (I borrowed it from the "Heading" snippets), the idea being that when I create a navbar I add a class--say if the link is Home, the class would be "home"--and then add a body id to each linked page that allows me to easily highlight the current menu item without using PHP. It's the "Andy Budd" method. Like I said, it's just proof of concept, I actually use the concept more often to just create unordered lists without all the extra code...
Brett
On Oct 26, 2006, at 4:21 AM, Andreas Wahlin wrote:
Ehm, what's with the big regexp in the class attribute? What does it do :)
Andreas
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
Brett Terpstra : Art Director Circle Six Design, Inc. 111 Riverfront Dr, Suite 204 .................................................. p: 507.459.4398 877.858.4332 f: 1.866.540.3063 e: brett@circlesixdesign.com http://www.circlesixdesign.com ..................................................
Andreas' question got me thinking about the regexp in the Heading [1,2] snippets and in my HTML Navbar snippet. I came up with these two replacements:
/(\w)+|( )+|([[:punct:]])+/(?1:\L$0)(?2:_)(?3:)/g
pulls out punctuation, lowercases everything and replaces spaces with underscores. Basically the same as before but with punctuation stripped and multiple spaces treated as a single underscore. "It's Getting Dark" becomes its_getting_dark.
/(\w)+|([[[:punct:]]|\s]+(\w))|([[[:punct:]]|\s])+/(?1:\L$0)(?2:\u$3) (?4:)/g
Camelcase regexp, strips whitespaces and punctuation and capitalizes the character after a space. Seems to work well, but I'm admittedly poor at regular expressions. "It's getting darker and darker" becomes itsGettingDarkerAndDarker.
Brett
On Oct 26, 2006, at 5:02 AM, Brett Terpstra wrote:
It creates a lowercase class name without spaces based on the text of the link (I borrowed it from the "Heading" snippets), the idea being that when I create a navbar I add a class--say if the link is Home, the class would be "home"--and then add a body id to each linked page that allows me to easily highlight the current menu item without using PHP. It's the "Andy Budd" method. Like I said, it's just proof of concept, I actually use the concept more often to just create unordered lists without all the extra code...
Brett
On Oct 26, 2006, at 4:21 AM, Andreas Wahlin wrote:
Ehm, what's with the big regexp in the class attribute? What does it do :)
Andreas
_ For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
Brett Terpstra : Art Director Circle Six Design, Inc. 111 Riverfront Dr, Suite 204 .................................................. p: 507.459.4398 877.858.4332 f: 1.866.540.3063 e: brett@circlesixdesign.com http://www.circlesixdesign.com ..................................................
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate