Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[FIXED JENKINS-18427] use MarkupFormater
  • Loading branch information
ndeloof committed Jun 21, 2013
1 parent 9108ab7 commit 0449e79
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
4 changes: 4 additions & 0 deletions changelog.html
Expand Up @@ -201,6 +201,10 @@ <h3><a name=v1.517>What's new in 1.517</a> (2013/06/02)</h3>
<li class=bug>
Using proper directory separator character for permalinks on Windows.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-17681">issue 17681</a>)
<li class="bug">
Use markup formater to display parameter description.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-18427">issue 18427</a>)
</li>
</ul>
<h3><a name=v1.516>What's new in 1.516</a> (2013/05/27)</h3>
<ul class=image>
Expand Down
8 changes: 8 additions & 0 deletions core/src/main/java/hudson/model/ParameterDefinition.java
Expand Up @@ -137,6 +137,14 @@ public String getDescription() {
return description;
}

public String getSafeDescription() {

This comment has been minimized.

Copy link
@kutzi

kutzi Jun 21, 2013

Member

@SInCE missing. Also Javadoc would be nice - especially to describe in which way this description is 'safe'

try {
return Jenkins.getInstance().getMarkupFormatter().translate(description);
} catch (IOException e) {
return "failed to translate description using configured markup formatter";

This comment has been minimized.

Copy link
@kutzi

kutzi Jun 21, 2013

Member

exception details should not be swallowed IMO. Log them to the log file

}
}

/**
* {@inheritDoc}
*/
Expand Down
Expand Up @@ -26,8 +26,8 @@ THE SOFTWARE.
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define"
xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form"
xmlns:i="jelly:fmt" xmlns:p="/lib/hudson/project">
<f:entry title="${it.name}" description="${it.description}">
<div name="parameter" description="${it.description}">
<f:entry title="${it.name}" description="${it.safeDescription}">
<div name="parameter">
<input type="hidden" name="name" value="${it.name}" />
<f:textbox name="value" value="${it.defaultValue}" />
</div>
Expand Down
2 changes: 1 addition & 1 deletion war/src/main/webapp/scripts/hudson-behavior.js
Expand Up @@ -1724,7 +1724,7 @@ function shortenName(name) {
// see http://wiki.jenkins-ci.org/display/JENKINS/Structured+Form+Submission
function buildFormTree(form) {
try {
// I initially tried to use an associative array with DOM elemnets as keys
// I initially tried to use an associative array with DOM elements as keys
// but that doesn't seem to work neither on IE nor Firefox.
// so I switch back to adding a dynamic property on DOM.
form.formDom = {}; // root object
Expand Down

1 comment on commit 0449e79

@jglick
Copy link
Member

@jglick jglick commented on 0449e79 Aug 1, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normally this is done directly in Jelly with no helper method, by replacing ${text} with ${app.markupFormatter.translate(text)}. That is simpler and avoids the need for discussing whether this should be documented with @since, use @Restricted(NoExternalUse.class), etc.

Please sign in to comment.