在 FreeMarker 消息中间插入内联样式
我正在使用 FreeMarker 来模板发送电子邮件以通知用户有新消息。我想要做的是能够以这种格式和强调显示一条消息:
“Hello User 1!您收到了一条来自用户 2 的新消息消息标题”
为此,我'我将消息分成两部分,然后将消息标题放在中间的跨度中,字体样式:斜体,如下所示:
${message("MsgNotificationEmail.receivedNewMsg1"), recipientName}
<span style="font-style:italic;">${msgTitle}</span>
${message("MsgNotificationEmail.receivedNewMsg2", senderName)}
是否有一种更简洁的方法在中间应用样式消息而不需要像这样分解它?
I'm using FreeMarker to template emails being sent out to notify users of new messages. What I'd like to do is be able to display a message with this formatting and emphasis:
"Hello User 1! You've received a new message Message Title from User 2"
To do this I'm splitting the message up into two bits, then putting the Message Title in a span in the middle with font-style: italic, like so:
${message("MsgNotificationEmail.receivedNewMsg1"), recipientName}
<span style="font-style:italic;">${msgTitle}</span>
${message("MsgNotificationEmail.receivedNewMsg2", senderName)}
Is there a neater way to apply styles in the middle of a message without needing to break it up like this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 FreeMarker 的典型应用程序中,它看起来像这样:
也就是说,您没有
receivedNewMsg1
加上receivedNewMsg2
加上模板,只有一个模板。In a typical application of FreeMarker it would look like this:
That is, you don't have
receivedNewMsg1
plusreceivedNewMsg2
plus a template, just a single template.