diff --git a/angel_jael/pubspec.yaml b/angel_jael/pubspec.yaml index dba03b78..13850fc7 100644 --- a/angel_jael/pubspec.yaml +++ b/angel_jael/pubspec.yaml @@ -1,5 +1,5 @@ name: angel_jael -version: 1.0.0-alpha+2 +version: 1.0.0 description: Angel support for the Jael templating engine. author: Tobe O homepage: https://github.com/angel-dart/jael/tree/master/jael diff --git a/jael/lib/src/text/scanner.dart b/jael/lib/src/text/scanner.dart index 1eff17f8..8df86d9c 100644 --- a/jael/lib/src/text/scanner.dart +++ b/jael/lib/src/text/scanner.dart @@ -1,3 +1,4 @@ +import 'package:charcode/ascii.dart'; import 'package:string_scanner/string_scanner.dart'; import '../ast/ast.dart'; @@ -127,7 +128,27 @@ class _Scanner implements Scanner { var lastToken = _scanFrom(_htmlPatterns, textStart); - if (lastToken?.type == TokenType.equals || + if (lastToken?.type == TokenType.gt) { + if (!_scanner.isDone) { + var state = _scanner.state; + var ch = _scanner.peekChar(); + + if (ch != $space && ch != $cr && ch != $lf && ch != $tab) { + while (!_scanner.isDone) { + var ch = _scanner.peekChar(); + + if (ch == $lt || (ch == $open_brace && _scanner.peekChar() == $open_brace)) { + var span = _scanner.spanFrom(state); + tokens.add(new Token(TokenType.text, span)); + break; + } else + _scanner.readChar(); + } + } + } + } + + else if (lastToken?.type == TokenType.equals || lastToken?.type == TokenType.nequ) { textStart = null; scanExpressionTokens(); diff --git a/jael/pubspec.yaml b/jael/pubspec.yaml index 4116cde6..f831741e 100644 --- a/jael/pubspec.yaml +++ b/jael/pubspec.yaml @@ -1,5 +1,5 @@ name: jael -version: 1.0.0-beta+3 +version: 1.0.0 description: A simple server-side HTML templating engine for Dart. author: Tobe O homepage: https://github.com/angel-dart/jael/tree/master/jael diff --git a/jael/test/text/scan_test.dart b/jael/test/text/scan_test.dart index dee9f806..4ecae16d 100644 --- a/jael/test/text/scan_test.dart +++ b/jael/test/text/scan_test.dart @@ -18,6 +18,21 @@ main() { expect(tokens[6], isToken(TokenType.gt)); }); + test('single quotes', () { + var tokens = scan('

It\'s lit

', sourceUrl: 'test.jl').tokens; + tokens.forEach(print); + + expect(tokens, hasLength(8)); + expect(tokens[0], isToken(TokenType.lt)); + expect(tokens[1], isToken(TokenType.id, 'p')); + expect(tokens[2], isToken(TokenType.gt)); + expect(tokens[3], isToken(TokenType.text, 'It\'s lit')); + expect(tokens[4], isToken(TokenType.lt)); + expect(tokens[5], isToken(TokenType.slash)); + expect(tokens[6], isToken(TokenType.id, 'p')); + expect(tokens[7], isToken(TokenType.gt)); + }); + test('text node', () { var tokens = scan('

Hello\nworld

', sourceUrl: 'test.jl').tokens; tokens.forEach(print); diff --git a/jael_preprocessor/pubspec.yaml b/jael_preprocessor/pubspec.yaml index d3c29ca0..48c743d5 100644 --- a/jael_preprocessor/pubspec.yaml +++ b/jael_preprocessor/pubspec.yaml @@ -1,5 +1,5 @@ name: jael_preprocessor -version: 1.0.0-alpha+2 +version: 1.0.0 description: A pre-processor for resolving blocks and includes within Jael templates. author: Tobe O homepage: https://github.com/angel-dart/jael/tree/master/jael_processor