How to add parentheses into Jelly lable title/value?

14 views
Skip to first unread message

Boyka Zhu

unread,
Jul 28, 2019, 9:17:30 PM7/28/19
to Jenkins Developers
Hi,

I have one request that is need to add parentheses into the Jelly label like:
<f:section title="${%TestPlugin(branch-A)}">
 </f:section>

But this looks no works when display"(branch-A)", can someone helps? Appreciate it.

Thanks
Boyka

Boyka Zhu

unread,
Jul 28, 2019, 11:42:39 PM7/28/19
to Jenkins Developers
I tried to add get function in the plugin Class file. 

public String getPluginName() {
return "TestPlugin(branch-A)";
}

but in global.jelly it does not works with below.
<f:section title="${instance.pluginName}">
 </f:section>

This the get function works in config.jelly.


在 2019年7月29日星期一 UTC+8上午9:17:30,Boyka Zhu写道:

Boyka Zhu

unread,
Jul 29, 2019, 12:56:35 AM7/29/19
to Jenkins Developers
Got resolved.

Just put the get functions into DescriptorImpl.
Then from jelly use install.yourgetfuction() or descriptor.getyourfuction() will be OK.
public String getTestPlugin()() {
return "TestPlugin(branch-A)";
}

<f:section title="${instance.getTestPlugin()}">
 </f:section>


在 2019年7月29日星期一 UTC+8上午9:17:30,Boyka Zhu写道:
Hi,

Jesse Glick

unread,
Jul 29, 2019, 11:17:40 AM7/29/19
to Jenkins Dev
On Sun, Jul 28, 2019 at 9:17 PM Boyka Zhu <boyk...@gmail.com> wrote:
> I have one request that is need to add parentheses into the Jelly label like:
> <f:section title="${%TestPlugin(branch-A)}">
> </f:section>

Parentheses are interpreted as format parameters. To fix this, simply
put in `basename.jelly`:

<f:section title="${%your-key}">

and create `basename.properties`:

your-key=TestPlugin(branch-A)
Reply all
Reply to author
Forward
0 new messages