我有大豆模板,如果长度超过 30 个字符,我只需要 28 个字符?怎么得到?
{if $attributes.subAccountNumber.length < 30}
<td>{$attributes.subAccountNumber}</td>
{else}
</td>{$attributes.subAccountNumber.substring(0,28)}</td>
{/if}
但是在编译时它会抛出异常,
Exception in thread "main" com.google.template.soy.base.SoySyntaxException: In file war/js/Application/Reports/ViewTemplates/ReportsViewTemplate.soy:518, template acti.workflow.reports.transcriptCard: Not all code is in Soy V2 syntax (found tag {$attributes.subAccountNumber.substring(0,28)} not in Soy V2 syntax).
at com.google.template.soy.base.SoySyntaxException.createWithoutMetaInfo(SoySyntaxException.java:52)
at com.google.template.soy.soytree.SoySyntaxExceptionUtils.createWithNode(SoySyntaxExceptionUtils.java:48)
at com.google.template.soy.sharedpasses.AssertSyntaxVersionV2Visitor.visitSoyNode(AssertSyntaxVersionV2Visitor.java:105)
at com.google.template.soy.soytree.AbstractSoyNodeVisitor.visitPrintNode(AbstractSoyNodeVisitor.java:221)
at com.google.template.soy.soytree.AbstractSoyNodeVisitor.visit(AbstractSoyNodeVisitor.java:85)
at com.google.template.soy.soytree.AbstractSoyNodeVisitor.visit(AbstractSoyNodeVisitor.java:55)
at com.google.template.soy.basetree.AbstractNodeVisitor.visitChildren(AbstractNodeVisitor.java:59)
at com.google.template.soy.soytree.AbstractSoyNodeVisitor.visitChildren(AbstractSoyNodeVisitor.java:126)
at com.google.template.soy.sharedpasses.AssertSyntaxVersionV2Visitor.visitSoyNode(AssertSyntaxVersionV2Visitor.java:112)
at com.google.template.soy.soytree.AbstractSoyNodeVisitor.visitIfElseNode(AbstractSoyNodeVisitor.java:253)
at com.google.template.soy.soytree.AbstractSoyNodeVisitor.visit(AbstractSoyNodeVisitor.java:95)
at com.google.template.soy.soytree.AbstractSoyNodeVisitor.visit(AbstractSoyNodeVisitor.java:55)