Platinum Partner

Modify TextMate's XML Bundle To Use The HTML And JavaScript Bundle In Google Gadgets

ATTENTION: This is a quick-and-dirty hack. It is not well-tested and unexpected complications can occur when using this hack.

To make use of all of TextMate's hilarious HTML and JavaScript functionality when editing Google Gadgets we need to modify TextMate's XML Bundle.

1. Open TextMate
2. In the menubar go to "Bundles" > "Bundle Editor" > "Edit Languages..."
3. Select "XML" > "XML" in the left drawer
4. Click on the button with two plus signs in the lower left corner of the window
5. Call the new Language definition "XML (Google Gadget)" or something similar
6. In the large text area search for the following code:


{	name = 'string.unquoted.cdata.xml';
	begin = '';
	beginCaptures = { 0 = { name = 'punctuation.definition.string.begin.xml'; }; };
	endCaptures = { 0 = { name = 'punctuation.definition.string.end.xml'; }; };
},


7. Replace these lines with the following code:


{	name = 'text.html.basic.embedded.xml';
	begin = '';
	beginCaptures = { 0 = { name = 'punctuation.definition.string.begin.xml'; }; };
	endCaptures = { 0 = { name = 'punctuation.definition.string.end.xml'; }; };
	patterns = ( { include = 'text.html.basic'; } );
},


8. Apply this new Language definition "XML (Google Gadget)" to every XMl document you like. Everything inside the CDATA section will now be treated as HTML.
{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}