Ticket #314: tt.syntax

File tt.syntax, 3.5 KB (added by angel_il, 11 years ago)

Template::Toolkit syntax

Line 
1# HTML entities
2context default
3        keyword &\[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\]; brightgreen
4        keyword &#\{xX\}\[0123456789abcdefABCDEF\]; brightgreen
5        keyword &#\[0123456789\]; brightgreen
6       
7# Although TT is most often used to generate HTML, it's not *only* used for that, so assuming HTML around it may be presumptuous anyway.
8# Since cooledit doesn't support sub-context, we can't have TT *in* HTML, like <img src="[% image_url %]">
9# The best possible workaround, which still sucks, is to uncomment the line below, which will highlight any HTML tags that don't contain a '[', but without special highlight for strings, and without any HTML-specific keywords
10#    keyword <\[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890\s"#$%&'()*+,-.=?@\\\]^_`{|}~\]> green
11        spellcheck
12
13# TT directives - http://template-toolkit.org/docs/manual/Directives.html
14context [% %] red black
15    keyword whole GET yellow
16    keyword whole CALL yellow
17    keyword whole SET yellow
18    keyword whole DEFAULT yellow
19       
20    keyword whole INSERT yellow
21    keyword whole INCLUDE yellow
22    keyword whole PROCESS yellow
23    keyword whole WRAPPER yellow
24        keyword whole BLOCK yellow
25       
26    keyword whole IF yellow
27    keyword whole UNLESS yellow
28    keyword whole ELSIF yellow
29    keyword whole ELSE yellow
30    keyword whole SWITCH yellow
31    keyword whole CASE yellow
32       
33    keyword whole FOREACH yellow
34    keyword whole IN yellow
35    keyword whole WHILE yellow
36
37    keyword whole FILTER yellow
38    keyword whole USE yellow
39    keyword whole MACRO yellow
40    keyword whole PERL yellow
41    keyword whole RAWPERL yellow
42
43    keyword whole TRY yellow
44    keyword whole THROW yellow
45    keyword whole CATCH yellow
46    keyword whole FINAL yellow
47       
48    keyword whole NEXT yellow
49    keyword whole LAST yellow
50    keyword whole RETURN yellow
51    keyword whole STOP yellow
52    keyword whole CLEAR yellow
53    keyword whole META yellow
54    keyword whole TAGS yellow
55    keyword whole DEBUG yellow
56
57    keyword whole END yellow
58
59# AND, OR and NOT are apparently not documented
60    keyword whole AND white
61        keyword whole OR white
62        keyword whole NOT white
63        keyword | white
64
65# TT VMethods - http://template-toolkit.org/docs/manual/VMethods.html
66    keyword .defined brown
67    keyword .length brown
68    keyword .repeat brown
69    keyword .replace brown
70    keyword .remove brown
71    keyword .match brown
72    keyword .search brown
73    keyword .split brown
74    keyword .chunk brown
75    keyword .substr brown
76    keyword .list brown
77    keyword .hash brown
78    keyword .size brown
79    keyword .keys brown
80    keyword .values brown
81    keyword .items brown
82    keyword .each brown
83    keyword .pairs brown
84    keyword .sort brown
85    keyword .nsort brown
86    keyword .import brown
87    keyword .exists brown
88    keyword .delete brown
89    keyword .item brown
90    keyword .first brown
91    keyword .last brown
92    keyword .max brown
93    keyword .reverse brown
94    keyword .join brown
95    keyword .grep brown
96    keyword .unshift brown
97    keyword .push brown
98    keyword .shift brown
99        keyword .pop brown
100    keyword .unique brown
101    keyword .merge brown
102    keyword .slice brown
103    keyword .splice brown
104
105    keyword "*" green
106    keyword '*' brightgreen
107
108# HTML comments
109context <!-- --> brown
110        spellcheck
111
112# HTML DOCTYPE
113context <! > brightred/orange
114        spellcheck
115
116# HTML end tags
117context </ > brightcyan
118
119# HTML open tags - enabling this will hide TT syntax in HTML, e.g. <img src="[% image_url %]">
120#context < > brightcyan
121#   keyword "*" green
122#   keyword = yellow