Package org.omegat.util
Class TagUtil
java.lang.Object
org.omegat.util.TagUtil
A collection of tag-related static utilities.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classstatic classA tuple containing A tag's name The tag'sTagUtil.TagTypetypestatic enumIndicates the type of a tag, e.g.: <foo> = START </foo> = END <bar/> = SINGLE -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddExtraTags(List<TagUtil.Tag> resultList, List<TagUtil.Tag> srcTags, String str) static List<ProtectedPart>applyCustomProtectedParts(String source, Pattern protectedPartsPatterns, @Nullable List<ProtectedPart> protectedParts) Find some protected parts according to the given regular expression.static List<TagUtil.Tag>buildTagList(String str, ProtectedPart[] protectedParts) Builds a list of format tags within the supplied string.static StringBuilds a list of format tags within the supplied string.static booleancontainsTag(List<TagUtil.Tag> tags, String tag) Check whether a tag belongs to a list of tagsstatic List<TagUtil.Tag>static List<TagUtil.Tag>static @Nullable StringgetFirstTag(String str) Find the first tag in a segmentstatic StringstripXmlTags(String xml) Strips all XML tags (converts to plain text).
-
Field Details
-
TAG_SEPARATOR_SENTINEL
- See Also:
-
TEXT_REPLACEMENT
public static final char TEXT_REPLACEMENT- See Also:
-
-
Method Details
-
getAllTagsInSource
-
getAllTagsMissingFromTarget
-
getGroupedMissingTagsFromTarget
-
buildTagList
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
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
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
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
Strips all XML tags (converts to plain text). Tags detected only by pattern. Protected parts are not used.
-