gpt4 book ai didi

java - 里面有 thymeleaf [if mso]

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:13:12 25 4
gpt4 key购买 nike

我正在使用 spring thymeleaf 制作电子邮件模板。我需要在我的模板中包含对 MS-outlook [if mso] 的检查。我需要在 block 内设置一个变量。我想知道是否有办法做到这一点。

<!--[if mso]><p style="line-height:0;margin:0;">&nbsp;</p><v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" th:href="@{|${baseUrl}/#/signup?email=${registrationRequest.email}&amp;key=${registrationRequest.registrationToken}|}" style="width:124px" arcsize="8%" strokecolor="#339561" filled="t"><v:fill type="gradient" angle="180" color="#44C781" color2="#3AA96E"></v:fill><v:textbox style="mso-fit-shape-to-text:t" inset="0px,11px,0px,11px"><center style="font-size:14px;line-height:24px;color:#FFFFFF;font-family:Tahoma,sans-serif;font-weight:bold;mso-line-height-rule:exactly;mso-text-raise:4px">Register</center></v:textbox></v:roundrect><![endif]-->

最佳答案

您可以通过变量提供整个 MS Outlook 特定的 HTML 代码块,包括特殊的开始和结束注释,但这样做会消除 Thymeleaf 在该 block 内执行变量替换的能力。

通过使用两个变量而不是一个变量可以很容易地实现保留变量替换:开始 MSO 注释变量和结束 MSO 注释变量 - 它们分别仅生成开始 MSO 和结束 MSO 注释。

将 Outlook 特定代码留在模板中,并将其包装在开始/结束标记中,如下所示:

<div th:remove="tag" th:utext="${startMsoComment}"></div>  

<!-- Outlook specific markup -->
... variable substitution works here
<p style="line-height:0;margin:0;">&nbsp;</p>
<v:roundrect
... variable substitution works here
</v:roundrect>
... variable substitution works here

<div th:remove="tag" th:utext="${endMsoComment}"></div>

关于java - 里面有 thymeleaf [if mso],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40734454/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com