feat: add option for keeping variable type in output

This commit is contained in:
Alex de Wergifosse
2020-12-16 10:20:10 +08:00
committed by Jun Yang
parent e84fbf32ad
commit cd92e77726
11 changed files with 42 additions and 21 deletions
+5 -1
View File
@@ -16,6 +16,10 @@ export class Output extends TemplateImpl<OutputToken> implements Template {
}
public * render (ctx: Context, emitter: Emitter) {
const val = yield this.value.value(ctx)
emitter.write(stringify(toValue(val)))
if (ctx.opts.keepOutputType) {
emitter.write(toValue(val))
} else {
emitter.write(stringify(toValue(val)))
}
}
}