Skip to content

Commit 3c6962f

Browse files
committed
Add support for trenni templates.
1 parent ac203c4 commit 3c6962f

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed

dist/jquery.syntax.brush.trenni.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// brush: "html" aliases: []
2+
3+
// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License.
4+
// Copyright (c) 2011 Samuel G. D. Williams. <http://www.oriontransfer.co.nz>
5+
// See <jquery.syntax.js> for licensing details.
6+
7+
Syntax.brushes.dependency('trenni', 'xml');
8+
Syntax.brushes.dependency('trenni', 'ruby');
9+
10+
Syntax.register('trenni', function(brush) {
11+
brush.push({
12+
pattern: /((<\?r)([\s\S]*?)(\?>))/gm,
13+
matches: Syntax.extractMatches(
14+
{klass: 'ruby-tag', allow: ['keyword', 'ruby']},
15+
{klass: 'keyword'},
16+
{brush: 'ruby'},
17+
{klass: 'keyword'}
18+
)
19+
});
20+
21+
brush.push({
22+
pattern: /((#{)([\s\S]*?)(}))/gm,
23+
matches: Syntax.extractMatches(
24+
{klass: 'ruby-tag', allow: ['keyword', 'ruby']},
25+
{klass: 'keyword'},
26+
{brush: 'ruby'},
27+
{klass: 'keyword'}
28+
)
29+
});
30+
31+
// The position of this statement is important - it determines at what point the rules of the parent are processed.
32+
// In this case, the rules for xml are processed after the rules for html.
33+
brush.derives('xml');
34+
});
35+

source/jquery.syntax.brush.trenni.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// brush: "html" aliases: []
2+
3+
// This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License.
4+
// Copyright (c) 2011 Samuel G. D. Williams. <http://www.oriontransfer.co.nz>
5+
// See <jquery.syntax.js> for licensing details.
6+
7+
Syntax.brushes.dependency('trenni', 'xml');
8+
Syntax.brushes.dependency('trenni', 'ruby');
9+
10+
Syntax.register('trenni', function(brush) {
11+
brush.push({
12+
pattern: /((<\?r)([\s\S]*?)(\?>))/gm,
13+
matches: Syntax.extractMatches(
14+
{klass: 'ruby-tag', allow: ['keyword', 'ruby']},
15+
{klass: 'keyword'},
16+
{brush: 'ruby'},
17+
{klass: 'keyword'}
18+
)
19+
});
20+
21+
brush.push({
22+
pattern: /((#{)([\s\S]*?)(}))/gm,
23+
matches: Syntax.extractMatches(
24+
{klass: 'ruby-tag', allow: ['keyword', 'ruby']},
25+
{klass: 'keyword'},
26+
{brush: 'ruby'},
27+
{klass: 'keyword'}
28+
)
29+
});
30+
31+
// The position of this statement is important - it determines at what point the rules of the parent are processed.
32+
// In this case, the rules for xml are processed after the rules for html.
33+
brush.derives('xml');
34+
});
35+

0 commit comments

Comments
 (0)