import 'dart:math'; import 'package:code_buffer/code_buffer.dart'; import 'package:jael/jael.dart' as jael; import 'package:symbol_table/symbol_table.dart'; import 'package:test/test.dart'; void main() { test('render into div', () { var template = ''' The square root of {{ n }} is {{ sqrt(n) }}. '''; var html = render(template, {'sqrt': sqrt}); }); } String render(String template, [Map values]) { var doc = jael.parseDocument(template, onError: (e) => throw e); var buffer = new CodeBuffer(); const jael.Renderer().render(doc, buffer, new SymbolTable(values: values)); return buffer.toString(); }