hi there - I know that there's a way to use different code coloring for different parts of a document according to the scope of the section - for example when I have Javascript code in a <script> tag or CSS in an HTML doc etc etc. I read through the Textmate Help and found that it is possible but admit to being rather confused by how it works. is there a tutorial of any kind? or an example theme I could look at that would illustrate the process? thanks, bennett
On 20 Jul 2010, at 09:47, plastichairdoo wrote:
[...] I know that there's a way to use different code coloring for different parts of a document [...] I read through the Textmate Help and found that it is possible but admit to being rather confused by how it works. is there a tutorial of any kind? or an example theme I could look at that would illustrate the process?
What exactly are you trying to achieve?
Are you writing your own language grammar?
actually no - I'd prefer it if someone has already accomplished this - this functionality exists for PHP and CSS and (sometimes) for JS code inside an HTML page but I was recently working with Processing.js which gets put into <pre> tags and it all gets treated as plain text. here is a screenshot. since I don't really know how to change this or add new tag colors etc it seemed like a good learning opportunity.
On Wed, Jul 21, 2010 at 1:44 AM, Allan Odgaard mailinglist@textmate.orgwrote:
On 20 Jul 2010, at 09:47, plastichairdoo wrote:
[...] I know that there's a way to use different code coloring for
different parts of a document [...] I read through the Textmate Help and found that it is possible but admit to being rather confused by how it works.
is there a tutorial of any kind? or an example theme I could look at that would illustrate the process?
What exactly are you trying to achieve?
Are you writing your own language grammar?
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
On 22 Jul 2010, at 01:10, bennett von bennett wrote:
On Wed, Jul 21, 2010 at 1:44 AM, Allan Odgaard <mailinglist@textmate.org
wrote: On 20 Jul 2010, at 09:47, plastichairdoo wrote:
[...] I know that there's a way to use different code coloring for different parts of a document [...]
[...] Are you writing your own language grammar?
actually no - I'd prefer it if someone has already accomplished this
- this
functionality exists for PHP and CSS and (sometimes) for JS code inside an HTML page but I was recently working with Processing.js which gets put into
<pre> tags and it all gets treated as plain text. here is a screenshot. since I don't really know how to change this or add new tag colors etc it seemed like a good learning opportunity.
For this you need to alter the grammar.
There is one root grammar for your document, e.g. HTML for a HTML file.
This grammar will match tags like <style> and <script> and either include another grammar or put special rules only active inside this context.
If you want text between <pre>…</pre> to be marked up as Processing.js then you need to alter the HTML grammar to match <pre> tags and include a processing grammar for these (or define it inline).
For more info see http://manual.macromates.com/en/language_grammars