Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有办法从字符串中获取值?
例如:
"SomeString" has the value "Edward".
输入:
{% assign variable = 'SomeString' %} {{ variable }}
输出:
SomeString
注意:SomeString是运行时构造的字符串,所以我实际上需要从字符串中获取值-->我无法删除赋值中的引号。
DotLiquid 中没有任何内容允许这样做,但是始终可以创建自己Tag的模板或在运行时构建模板。
Tag
public sealed class RuntimeAssign : Tag { ... } Template.RegisterTag<RuntimeAssign>("runtimeassign");