StringTemplate C#elseif bug?
我使用StringTemplate版本3 我有以下模板:StringTemplate C#elseif bug?,c#,stringtemplate,texttemplate,C#,Stringtemplate,Texttemplate,我使用StringTemplate版本3 我有以下模板: <html> <head> <title>Test</title> <style> .done-ok { background-color : LawnGreen } .done-ignore {
<html>
<head>
<title>Test</title>
<style>
.done-ok {
background-color : LawnGreen
}
.done-ignore {
background-color : Orange
}
.done-fail {
background-color : OrangeRed
}
</style>
</head>
<body class="$if(failedNonEmpty)$done-fail$elseif(needsAttentionNonEmpty)$done-ignore$else$done-ok$endif$">
</body>
</html>
当我编译代码时,一切都正常。奇怪的是,当我将第二个属性更改为:
st.SetAttribute("failedNonEmpty", true);
然后,我突然在st.ToString()一行中得到一个异常,它说:
模板“elseif”中没有文本
有人有同样的问题或知道解决方案吗?据我记忆所及,ST3中没有其他解决方案(这真是让人头疼)。 不过ST4有 编辑: 事实上,elseif是在3.1中添加的(不确定它是否有效) 资料来源:
st.SetAttribute("failedNonEmpty", true);