Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions third_party/packages/mustache_template/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.0.2

* Emoji support.

## 2.0.1

* Transfers the package source from https://github.com/jonahwilliams/mustache
Expand Down
8 changes: 4 additions & 4 deletions third_party/packages/mustache_template/lib/src/scanner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,12 @@ class Scanner {
if (_c == _EOF) {
return '';
}
final int start = _offset;

final StringBuffer buffer = StringBuffer();
while (_peek() != _EOF && test(_peek())) {
_read();
buffer.writeCharCode(_read());
}
final int end = _peek() == _EOF ? _source.length : _offset;
return _source.substring(start, end);
return buffer.toString();
}

void _expect(int expectedCharCode) {
Expand Down
2 changes: 1 addition & 1 deletion third_party/packages/mustache_template/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: mustache_template
description: A templating library that implements the Mustache template specification
repository: https://github.com/flutter/packages/tree/main/third_party/packages/mustache_template
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+mustache_template%22
version: 2.0.1
version: 2.0.2

environment:
sdk: ^3.7.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ void main() {
).renderString(<dynamic, dynamic>{});
expect(output, equals('__'));
});
test('Emoji', () {
final String output = parse(
'Hello! 🖖👍🏽\nBye! 🏳️‍🌈',
).renderString(<dynamic, dynamic>{});
expect(output, equals('Hello! 🖖👍🏽\nBye! 🏳️‍🌈'));
});
});
group('Section', () {
test('Map', () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,14 @@ void main() {
]);
});

test('emoji', () {
const String source = 'Hello! 🖖👍🏽🏳️‍🌈\nEmoji';
final Parser parser = Parser(source, 'foo', '{{ }}');
final List<Node> nodes = parser.parse();
// End offset includes emoji sizes
expectNodes(nodes, <Node>[TextNode('Hello! 🖖👍🏽🏳️‍🌈\nEmoji', 0, 20)]);
});

test('toString', () {
TextNode('foo', 1, 3).toString();
VariableNode('foo', 1, 3).toString();
Expand Down