简体   繁体   English

我如何从一个大豆模板的对象中准确获取价值?

[英]How do I exact value from an object for soy template?

We are in the process of modifying the JIRA Service Desk 3 notification soy templates to make them more useful while we wait for JSD-218 to be actioned. 我们正在修改JIRA Service Desk 3通知大豆模板,以使其在我们等待JSD-218生效时更加有用。 Primarily we are editing the issue-conversational-notifications.soy. 首先,我们正在编辑issue-conversational-notifications.soy。

We can easily get {$issue.key} and {$issue.summary} to display, but pulling out the value for description is proving a challenge. 我们可以很容易地显示{$ issue.key}和{$ issue.summary},但是提取描述的值却是一个挑战。 Description is nested within the {$issue.fields} object, which looks like: 描述嵌套在{$ issue.fields}对象中,如下所示:

[{id: description, label: Description, value: {html: <p>Testing notification</p>, rawValue: Testing notification }}] 

However the easy assumption of {$issue.fields.value.html} does not work. 但是,{$ issue.fields.value.html}的简单假设不起作用。 Reading through the documentation on closure templates as kind of got me lost on how to pull out the value of HTML for the key value, which is the value of the key fields? 仔细阅读有关闭包模板的文档,让我迷失了如何为关键值(关键字段的值)提取HTML值?

Have also tried: 也尝试过:

  • {$issue[6][2][0]} {$ issue [6] [2] [0]}
  • {$issue.fields['value']['html']} {$ issue.fields ['value'] ['html']}
  • {$issue.fields['value':'html']} {$ issue.fields ['value':'html']}

Has anyone had any success on this front? 有没有人在这方面取得任何成功? I've asked on Atlassian answers to a deafening quiet. 我已经问过Atlassian关于震耳欲聋的安静的答案。

根据惠勒的回答,答案是:

{$issue.fields[0].value.html}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM