Class TagUtil

java.lang.Object
org.omegat.util.TagUtil

public final class TagUtil extends Object
A collection of tag-related static utilities.
  • Field Details

  • Method Details

    • getAllTagsInSource

      public static List<TagUtil.Tag> getAllTagsInSource()
    • getAllTagsMissingFromTarget

      public static List<TagUtil.Tag> getAllTagsMissingFromTarget()
    • getGroupedMissingTagsFromTarget

      public static List<String> getGroupedMissingTagsFromTarget()
    • buildTagList

      public static List<TagUtil.Tag> buildTagList(String str, ProtectedPart[] protectedParts)
      Builds a list of format tags within the supplied string. Format tags are 'protected parts' and OmegaT style tags: <xx02> or </yy01>.
    • addExtraTags

      public static void addExtraTags(List<TagUtil.Tag> resultList, List<TagUtil.Tag> srcTags, String str)
    • containsTag

      public static boolean containsTag(List<TagUtil.Tag> tags, String tag)
      Check whether a tag belongs to a list of tags
      Parameters:
      tags - a list of tags to check.
      tag - to look for.
      Returns:
      true when tag is found, false otherwise.
    • buildTagListForRemove

      public static String buildTagListForRemove(String str)
      Builds a list of format tags within the supplied string. Format tags are OmegaT style tags: <xx02> or </yy01>.
      Returns:
      a string containing the tags
    • getFirstTag

      public static @Nullable String getFirstTag(String str)
      Find the first tag in a segment
      Parameters:
      str - A segment
      Returns:
      the first tag in the segment, or null if there are no tags
    • applyCustomProtectedParts

      public static List<ProtectedPart> applyCustomProtectedParts(String source, Pattern protectedPartsPatterns, @Nullable List<ProtectedPart> protectedParts)
      Find some protected parts according to the given regular expression. E.g. printf variables, java MessageFormat patterns, user defined custom tags. These protected parts shouldn't affect statistic but just be displayed in gray in editor and take part in tag validation.
    • stripXmlTags

      public static String stripXmlTags(String xml)
      Strips all XML tags (converts to plain text). Tags detected only by pattern. Protected parts are not used.