I am wondering how I would go about overriding the contextual links HTML. I think I can override the list items within the menu using hook_menu_contextual_links_alter.

I can't find where the wrapper div and the a button (gear) is being generated. I am trying to create this: http://getbootstrap.com/components/#btn-dropdowns.

I am using the tweme theme that I upgraded manually to use bootstrap 3 instead of 2.x. Any help with this would be appreciated.