@@ -25,15 +25,30 @@ export default {
25
25
} ,
26
26
27
27
render : async function ( ctx : Context , hash : Hash , emitter : Emitter ) {
28
+ const r = this . liquid . renderer
28
29
for ( let i = 0 ; i < this . cases . length ; i ++ ) {
29
30
const branch = this . cases [ i ]
30
- const val = new Expression ( branch . val ) . value ( ctx )
31
- const cond = new Expression ( this . cond ) . value ( ctx )
31
+ const val = await new Expression ( branch . val ) . value ( ctx )
32
+ const cond = await new Expression ( this . cond ) . value ( ctx )
32
33
if ( val === cond ) {
33
- this . liquid . renderer . renderTemplates ( branch . templates , ctx , emitter )
34
+ await r . renderTemplates ( branch . templates , ctx , emitter )
34
35
return
35
36
}
36
37
}
37
- this . liquid . renderer . renderTemplates ( this . elseTemplates , ctx , emitter )
38
+ await r . renderTemplates ( this . elseTemplates , ctx , emitter )
39
+ } ,
40
+
41
+ renderSync : function ( ctx : Context , hash : Hash , emitter : Emitter ) {
42
+ const r = this . liquid . renderer
43
+ for ( let i = 0 ; i < this . cases . length ; i ++ ) {
44
+ const branch = this . cases [ i ]
45
+ const val = new Expression ( branch . val ) . valueSync ( ctx )
46
+ const cond = new Expression ( this . cond ) . valueSync ( ctx )
47
+ if ( val === cond ) {
48
+ r . renderTemplatesSync ( branch . templates , ctx , emitter )
49
+ return
50
+ }
51
+ }
52
+ r . renderTemplatesSync ( this . elseTemplates , ctx , emitter )
38
53
}
39
54
} as ITagImplOptions
0 commit comments