Hi all,
I'd like to add support for highlighting the syntax of BBCode, but I'm not really sure where to start. The main feature I'm looking for at the moment is to turn on PHP syntax highlighting when you are inside a [php] code [/php] section.
Where should I start looking for files to edit?
Thanks, Douglas
On 06/08/2005, at 1.20, Douglas Livingstone wrote:
I'd like to add support for highlighting the syntax of BBCode, but I'm not really sure where to start. The main feature I'm looking for at the moment is to turn on PHP syntax highlighting when you are inside a [php] code [/php] section.
Where should I start looking for files to edit?
View -> Language -> Edit Languages…
Start by selecting New Bundle from the + menu. Name it BBCode and then select New Language. This gives you a new language grammar which you can edit. Change scopeName to "text.bbcode", insert potential file types in the fileTypes array and add your patterns to the patterns array.
To match [php]...[/php] you'd add this rule to it (you probably want to remove the two default rules in this array):
{ name = "source.php.embedded.bbcode"; begin = "\[php\]"; end = "\[/php\]"; patterns = ( { include = "source.php"; } ); },
For more information about the format see Help / Syntax Highlight. You may also want to read some of the articles at my blog for supplementary information, e.g. [1] and [2].
And also take a look at some of the other language files.
Hope that helps...
[1] http://macromates.com/blog/archives/2005/07/06/introduction-to- scopes/ [2] http://macromates.com/blog/archives/2005/06/23/language-grammars/
On Aug 5, 2005, at 6:36 PM, Allan Odgaard wrote:
To match [php]...[/php] you'd add this rule to it (you probably want to remove the two default rules in this array):
{ name = "source.php.embedded.bbcode"; begin = "\\[php\\]"; end = "\\[/php\\]"; patterns = ( { include = "source.php"; } ); },
Does this enable folding markers within the nested PHP?
-- Brian Lalor / blalor@bravo5.org Notmeflex (nŏt mē´ flěks) n. The involuntary act of hitting the brakes when you see a cop, regardless of whether you're speeding or not.
On 06/08/2005, at 16.38, Brian Lalor wrote:
To match [php]...[/php] you'd add this rule to it (you probably want to remove the two default rules in this array): [...]
Does this enable folding markers within the nested PHP?
Folding markers are still only set once for the root language, so you'd have to put these in that file (and they'd thus apply to the entire file).
And be sure to share your work with the world :)
Andreas
On Aug 6, 2005, at 1:20 , Douglas Livingstone wrote:
Hi all,
I'd like to add support for highlighting the syntax of BBCode, but I'm not really sure where to start. The main feature I'm looking for at the moment is to turn on PHP syntax highlighting when you are inside a [php] code [/php] section.
Where should I start looking for files to edit?
Thanks, Douglas ______________________________________________________________________ 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