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.
给定以下 Cheetah 模板
#filter None {data:[ #for $person in $persons {naam: "#if $person.lastname==None then '' else $person.lastname.replace('"', '\\"')#}, #end for ]} #end filter
用 \\ 替换 " 真是一口难言
任何人都有更简单/更短的方式来编写这个表达式?
I do not know Cheetah, but maybe this works:
{naam: "#$person.lastname and $person.lastname.replace('"', '\\"')#},