jenkins.model.Jenkins.getMarkupFormatter()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(180)

本文整理了Java中jenkins.model.Jenkins.getMarkupFormatter()方法的一些代码示例,展示了Jenkins.getMarkupFormatter()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Jenkins.getMarkupFormatter()方法的具体详情如下:
包路径:jenkins.model.Jenkins
类名称:Jenkins
方法名:getMarkupFormatter

Jenkins.getMarkupFormatter介绍

[英]Gets the markup formatter used in the system.
[中]获取系统中使用的标记格式化程序。

代码示例

代码示例来源:origin: jenkinsci/jenkins

public MarkupFormatter getMarkupFormatter() {
  return Jenkins.getInstance().getMarkupFormatter();
}

代码示例来源:origin: jenkinsci/jenkins

/**
 * return parameter description, applying the configured MarkupFormatter for jenkins instance.
 * @since 1.521
 */
public String getFormattedDescription() {
  try {
    return Jenkins.getInstance().getMarkupFormatter().translate(description);
  } catch (IOException e) {
    LOGGER.warning("failed to translate description using configured markup formatter");
    return "";
  }
}

代码示例来源:origin: jenkinsci/jenkins

@Restricted(DoNotUse.class) // for value.jelly
public String getFormattedDescription() {
  try {
    return Jenkins.getInstance().getMarkupFormatter().translate(description);
  } catch (IOException e) {
    LOGGER.warning("failed to translate description using configured markup formatter");
    return "";
  }
}

代码示例来源:origin: jenkinsci/jenkins

@Override
public String getShortDescription() {
  if(note != null) {
    try {
      return Messages.Cause_RemoteCause_ShortDescriptionWithNote(addr, Jenkins.getInstance().getMarkupFormatter().translate(note));
    } catch (IOException x) {
      // ignore
    }
  }
  return Messages.Cause_RemoteCause_ShortDescription(addr);
}

代码示例来源:origin: jenkinsci/gitlab-plugin

@Override
  String getShortDescription(CauseData data) {
    String forkNamespace = StringUtils.equals(data.getSourceNamespace(), data.getTargetBranch()) ? "" : data.getSourceNamespace() + "/";
    if (Jenkins.getActiveInstance().getMarkupFormatter() instanceof EscapedMarkupFormatter || data.getTargetProjectUrl() == null) {
      return Messages.GitLabWebHookCause_ShortDescription_MergeRequestHook_plain(String.valueOf(data.getMergeRequestIid()),
                                            forkNamespace + data.getSourceBranch(),
                                            data.getTargetBranch());
    } else {
      return Messages.GitLabWebHookCause_ShortDescription_MergeRequestHook_html(String.valueOf(data.getMergeRequestIid()),
                                           forkNamespace + data.getSourceBranch(),
                                           data.getTargetBranch(),
                                           data.getTargetProjectUrl());
    }
  }
}, NOTE {

代码示例来源:origin: jenkinsci/gitlab-plugin

@Override
  String getShortDescription(CauseData data) {
    String triggeredBy = data.getTriggeredByUser();
    String forkNamespace = StringUtils.equals(data.getSourceNamespace(), data.getTargetBranch()) ? "" : data.getSourceNamespace() + "/";
    if (Jenkins.getActiveInstance().getMarkupFormatter() instanceof EscapedMarkupFormatter || data.getTargetProjectUrl() == null) {
      return Messages.GitLabWebHookCause_ShortDescription_NoteHook_plain(triggeredBy,
        String.valueOf(data.getMergeRequestIid()),
        forkNamespace + data.getSourceBranch(),
        data.getTargetBranch());
    } else {
      return Messages.GitLabWebHookCause_ShortDescription_NoteHook_html(triggeredBy,
        String.valueOf(data.getMergeRequestIid()),
        forkNamespace + data.getSourceBranch(),
        data.getTargetBranch(),
        data.getTargetProjectUrl());
    }
  }
}, PIPELINE {

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

public MarkupFormatter getMarkupFormatter() {
  return Jenkins.getInstance().getMarkupFormatter();
}

代码示例来源:origin: org.jenkins-ci.plugins.workflow/workflow-cps-global-lib

/**
 * Loads help from user-defined file, if available.
 */
public @CheckForNull String getHelpHtml() throws IOException {
  if (!help.exists())     return null;
  return Jenkins.getActiveInstance().getMarkupFormatter().translate(
    FileUtils.readFileToString(help, Charsets.UTF_8).
    // Util.escape translates \n but not \r, and we do not know what platform the library will be checked out on:
    replace("\r\n", "\n"));
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

/**
 * return parameter description, applying the configured MarkupFormatter for jenkins instance.
 * @since 1.521
 */
public String getFormattedDescription() {
  try {
    return Jenkins.getInstance().getMarkupFormatter().translate(description);
  } catch (IOException e) {
    LOGGER.warning("failed to translate description using configured markup formatter");
    return "";
  }
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

@Restricted(DoNotUse.class) // for value.jelly
public String getFormattedDescription() {
  try {
    return Jenkins.getInstance().getMarkupFormatter().translate(description);
  } catch (IOException e) {
    LOGGER.warning("failed to translate description using configured markup formatter");
    return "";
  }
}

代码示例来源:origin: org.jenkins-ci.plugins/credentials

/**
 * Returns the {@link StandardCredentials#getDescription()} of the {@link #credentials}.
 *
 * @return the {@link StandardCredentials#getDescription()} of the {@link #credentials}.
 * @throws IOException if there was an issue with formatting this using the markup formatter.
 */
public String getDescription() throws IOException {
  return credentials instanceof StandardCredentials ? Jenkins.getActiveInstance().getMarkupFormatter()
      .translate(((StandardCredentials) credentials).getDescription()) : null;
}

代码示例来源:origin: jenkinsci/credentials-plugin

/**
 * Returns the {@link StandardCredentials#getDescription()} of the {@link #credentials}.
 *
 * @return the {@link StandardCredentials#getDescription()} of the {@link #credentials}.
 * @throws IOException if there was an issue with formatting this using the markup formatter.
 */
public String getDescription() throws IOException {
  return credentials instanceof StandardCredentials ? Jenkins.getActiveInstance().getMarkupFormatter()
      .translate(((StandardCredentials) credentials).getDescription()) : null;
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

@Override
public String getShortDescription() {
  if(note != null) {
    try {
      return Messages.Cause_RemoteCause_ShortDescriptionWithNote(addr, Jenkins.getInstance().getMarkupFormatter().translate(note));
    } catch (IOException x) {
      // ignore
    }
  }
  return Messages.Cause_RemoteCause_ShortDescription(addr);
}

代码示例来源:origin: jenkinsci/build-failure-analyzer-plugin

/**
 * @param stringBuilder the string builder to which to add the matrix run representation
 * @param matrixRun     the matrix run
 * @param indentLevel   the indent level
 */
private void addMatrixRunRepresentation(final StringBuilder stringBuilder, final MatrixRun matrixRun,
                    final int indentLevel) {
  final FailureCauseDisplayData data = FailureCauseMatrixBuildAction.getFailureCauseDisplayData(matrixRun);
  if (data.getFoundFailureCauses().isEmpty() && data.getDownstreamFailureCauses().isEmpty()) {
    return;
  }
  final int nextIndentLevel = indentLevel + LIST_INCREMENT;
  if (useHtmlFormat) {
    stringBuilder.append("<li>");
    try {
      stringBuilder.append(Jenkins.getInstance().getMarkupFormatter().translate(
          matrixRun.getFullDisplayName()));
    } catch (final IOException exception) {
      stringBuilder.append("matrix-full-display-name");
    }
    addFailureCauseDisplayDataRepresentation(stringBuilder, data, nextIndentLevel);
    stringBuilder.append("</li>");
  } else {
    stringBuilder.append(indentForDepth(indentLevel));
    stringBuilder.append(LIST_BULLET);
    stringBuilder.append(matrixRun.getFullDisplayName());
    stringBuilder.append("\n");
    addFailureCauseDisplayDataRepresentation(stringBuilder, data, nextIndentLevel);
  }
}

代码示例来源:origin: jenkinsci/build-failure-analyzer-plugin

stringBuilder.append("<li>");
try {
  stringBuilder.append(Jenkins.getInstance().getMarkupFormatter().translate(cause.getName()));
} catch (final IOException exception) {
  stringBuilder.append("cause-name");
  stringBuilder.append(Jenkins.getInstance().getMarkupFormatter().translate(cause.getDescription()));
} catch (final IOException exception) {
  stringBuilder.append("cause-description");

相关文章

Jenkins类方法