Package hudson

Class MarkupText.SubText

    • Constructor Detail

      • SubText

        public SubText​(Matcher m,
                       int textOffset)
      • SubText

        public SubText​(int start,
                       int end)
    • Method Detail

      • addMarkup

        public void addMarkup​(int startPos,
                              int endPos,
                              String startTag,
                              String endTag)
        Description copied from class: AbstractMarkupText
        Adds a start tag and end tag at the specified position.

        For example, if the text was "abc", then addMarkup(1,2,"<b>","</b>") would generate "a<b>b</b>c"

        Specified by:
        addMarkup in class AbstractMarkupText
      • surroundWith

        public void surroundWith​(String startTag,
                                 String endTag)
        Surrounds this subtext with the specified start tag and the end tag.

        Start/end tag text can contain special tokens "$0", "$1", ... and they will be replaced by their group match. "\$" can be used to escape characters.

      • href

        public void href​(String url)
        Surrounds this subtext with <a>…</a>.
      • start

        public int start​(int groupIndex)
        Gets the start index of the captured group within MarkupText.getText().
        groupIndex - 0 means the start of the whole subtext. 1, 2, ... are groups captured by '(...)' in the regexp.
      • end

        public int end​(int groupIndex)
        Gets the end index of the captured group within MarkupText.getText().
      • group

        public String group​(int groupIndex)
        Gets the text that represents the captured group.
      • groupCount

        public int groupCount()
        How many captured groups are in this subtext.
      • replace

        public String replace​(String s)
        Replaces the group tokens like "$0", "$1", and etc with their actual matches.