[TxMt] Editing Kid templates

Graham Ashton graham at effectif.com
Sat Dec 17 23:51:42 UTC 2005


Hi. I've been trying to modify the HTML language so that it understands
embedded Python code, as you find in a Kid template. For example:

<?python
def shoe(potato):
    pass
?>

By default TextMate thinks it's PHP code (source.php.embedded.html).

I thought it would be pretty straightforward, and copied the chunk
of config that appears to setup embedded ruby. I ended up with this,
defined just beneath php-source:

python = 
{	name = 'source.python.embedded.html';
	begin = '(?:^\s*)<\?python(?!.*\?>)';
	end = '\?>(?:\s*$\n)?';
	patterns = (
		{	name = 'comment.line.number-sign.ruby';
			match = '#.*?(?=-?%>)';
		},
		{	include = 'source.python'; },
	);
};

However, when I click "Format" and "Test" in the Bundle Editor the text
in my editor is still marked up as PHP. I removed all the PHP stuff to
see if it was overriding the Python settings, but it didn't help.

What should I be doing for this?

Cheers...

-- 
Graham



More information about the textmate mailing list