Skip to content

Commit 746d2a2

Browse files
committed
One more fix
1 parent 465311f commit 746d2a2

File tree

4 files changed

+59
-1
lines changed

4 files changed

+59
-1
lines changed

test/mustachio/foo.aot_renderers_for_md.dart

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,49 @@ import 'foo.dart';
1919

2020
String renderFoo(Foo context0) {
2121
final buffer = StringBuffer();
22+
buffer.write(_renderFoo_partial_foo_header_0(context0));
23+
buffer.write('''
24+
25+
s1: ''');
26+
buffer.write(htmlEscape.convert(context0.s1.toString()));
27+
buffer.write('''
28+
b1? ''');
29+
if (context0.b1 == true) {
30+
buffer.write('''yes''');
31+
}
32+
if (context0.b1 != true) {
33+
buffer.write('''no''');
34+
}
35+
buffer.write('''
36+
l1:''');
37+
var context1 = context0.l1;
38+
if (context1 != null) {
39+
for (var context2 in context1) {
40+
buffer.write('''item: ''');
41+
buffer.write(htmlEscape.convert(context2.toString()));
42+
}
43+
}
44+
if (context0.l1?.isEmpty ?? true) {
45+
buffer.write('''no items''');
46+
}
47+
buffer.write('''
48+
baz:''');
49+
var context3 = context0.baz;
50+
if (context3 != null) {
51+
buffer.write('''
52+
Baz has a ''');
53+
buffer.write(htmlEscape.convert(context3.bar.s2.toString()));
54+
}
55+
if (context0.baz == null) {
56+
buffer.write('''baz is null''');
57+
}
58+
return buffer.toString();
59+
}
60+
61+
String _renderFoo_partial_foo_header_0(Foo context0) {
62+
final buffer = StringBuffer();
63+
buffer.write('''l1: ''');
64+
buffer.write(htmlEscape.convert(context0.l1.toString()));
2265
return buffer.toString();
2366
}
2467

test/mustachio/templates/foo.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{{ >foo_header }}
2+
3+
s1: {{ s1 }}
4+
b1? {{ #b1 }}yes{{ /b1 }}{{ ^b1 }}no{{ /b1 }}
5+
l1:
6+
{{ #l1 }}item: {{.}}{{ /l1 }}
7+
{{ ^l1 }}no items{{ /l1 }}
8+
baz:
9+
{{ #baz }}
10+
Baz has a {{ bar.s2 }}
11+
{{ /baz }}
12+
{{ ^baz }}baz is null{{ /baz }}

tool/mustachio/codegen_aot_compiler.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,10 @@ class _BlockCompiler {
414414
// Blank lines happen a lot; just indicate them as such.
415415
writeln('buffer.writeln();');
416416
} else {
417-
content = content.replaceAll("'", "\\'").replaceAll(r'$', r'\\$');
417+
content = content
418+
.replaceAll(r'\', r'\\')
419+
.replaceAll("'", r"\'")
420+
.replaceAll(r'$', r'\$');
418421
if (_multipleWhitespacePattern.hasMatch(content)) {
419422
write("buffer.write('");
420423
write(content.replaceAll('\n', '\\n'));

0 commit comments

Comments
 (0)