Class TagUtil


  • public final class TagUtil
    extends java.lang.Object
    A collection of tag-related static utilities.
    • Method Detail

      • getAllTagsInSource

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

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

        public static java.util.List<java.lang.String> getGroupedMissingTagsFromTarget()
      • buildTagList

        public static java.util.List<TagUtil.Tag> buildTagList​(java.lang.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​(java.util.List<TagUtil.Tag> resultList,
                                        java.util.List<TagUtil.Tag> srcTags,
                                        java.lang.String str)
      • containsTag

        public static boolean containsTag​(java.util.List<TagUtil.Tag> tags,
                                          java.lang.String tag)
        Check whether a tag belongs to a list of tags
        Parameters:
        tags -
        tag -
        Returns:
        true or false
      • buildTagListForRemove

        public static java.lang.String buildTagListForRemove​(java.lang.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 java.lang.String getFirstTag​(java.lang.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 java.util.List<ProtectedPart> applyCustomProtectedParts​(java.lang.String source,
                                                                              java.util.regex.Pattern protectedPartsPatterns,
                                                                              java.util.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 java.lang.String stripXmlTags​(java.lang.String xml)
        Strips all XML tags (converts to plain text). Tags detected only by pattern. Protected parts are not used.