This commit is contained in:
Tobe O 2017-10-16 17:01:02 -04:00
parent 9d0c89f376
commit f16f2918a3
4 changed files with 14 additions and 10 deletions

View file

@ -16,5 +16,6 @@
</content>
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Dart SDK" level="project" />
<orderEntry type="library" name="Dart Packages" level="project" />
</component>
</module>

View file

@ -31,7 +31,7 @@ final Map<Pattern, TokenType> _htmlPatterns = {
'!=': TokenType.nequ,
_string1: TokenType.string,
_string2: TokenType.string,
new RegExp(r'([A-Za-z][A-Za-z0-9]*-)*([A-Za-z][A-Za-z0-9]*)'): TokenType.id,
new RegExp(r'(([A-Za-z][A-Za-z0-9]*-)*([A-Za-z][A-Za-z0-9]*))'): TokenType.id,
};
final Map<Pattern, TokenType> _expressionPatterns = {

View file

@ -1,5 +1,5 @@
name: jael
version: 1.0.0-beta
version: 1.0.0-beta+1
description: A simple server-side HTML templating engine for Dart.
author: Tobe O <thosakwe@gmail.com>
homepage: https://github.com/angel-dart/jael/tree/master/jael

View file

@ -65,7 +65,7 @@ main() {
test('script tag interpolation', () {
var tokens = scan(
'''
<script>
<script aria-label="script">
window.alert('a string');
</script>
''',
@ -74,15 +74,18 @@ main() {
.tokens;
tokens.forEach(print);
expect(tokens, hasLength(8));
expect(tokens, hasLength(11));
expect(tokens[0], isToken(TokenType.lt));
expect(tokens[1], isToken(TokenType.id, 'script'));
expect(tokens[2], isToken(TokenType.gt));
expect(tokens[2], isToken(TokenType.id, 'aria-label'));
expect(tokens[3], isToken(TokenType.equals));
expect(tokens[4], isToken(TokenType.string));
expect(tokens[5], isToken(TokenType.gt));
expect(
tokens[3], isToken(TokenType.text, "\n window.alert('a string');\n"));
expect(tokens[4], isToken(TokenType.lt));
expect(tokens[5], isToken(TokenType.slash));
expect(tokens[6], isToken(TokenType.id, 'script'));
expect(tokens[7], isToken(TokenType.gt));
tokens[6], isToken(TokenType.text, "\n window.alert('a string');\n"));
expect(tokens[7], isToken(TokenType.lt));
expect(tokens[8], isToken(TokenType.slash));
expect(tokens[9], isToken(TokenType.id, 'script'));
expect(tokens[10], isToken(TokenType.gt));
});
}