public class FilterVisitor
extends org.htmlparser.visitors.NodeVisitor
Modifier and Type | Field and Description |
---|---|
protected java.util.List<org.htmlparser.Node> |
afters
The list of non-paragraph tags following a chunk of text.
|
protected java.util.List<org.htmlparser.Node> |
befors
The list of non-paragraph tags before a chunk of text.
|
protected HTMLFilter2 |
filter |
protected boolean |
preformatting
Did the PRE block start (it means we mustn't compress the spaces).
|
protected boolean |
recurse
Should the parser call us for this tag's ending tag and its inner tags.
|
protected java.util.List<java.lang.String> |
sShortcuts
The list of all the tag shortcuts
|
protected java.util.List<java.lang.Integer> |
sTagNumbers
The tag numbers of shorcutized tags
|
protected java.util.List<org.htmlparser.Tag> |
sTags
The tags behind the shortcuts
|
protected boolean |
text
Do we collect the translatable text now.
|
protected java.util.List<org.htmlparser.Node> |
translatable
The list of nodes forming a chunk of text.
|
Constructor and Description |
---|
FilterVisitor(HTMLFilter2 htmlfilter,
java.io.BufferedWriter bufwriter,
HTMLOptions opts) |
Modifier and Type | Method and Description |
---|---|
void |
beginParsing()
This method is called before the parsing.
|
protected void |
endup()
Ends the segment collection and sends the translatable text out to OmegaT
core, and some extra tags to writer.
|
void |
finishedParsing()
Called upon parsing completion.
|
protected void |
maybeTranslateAttribute(org.htmlparser.Tag tag,
java.lang.String key)
If the attribute of the tag is not empty, it translates it as a separate
segment.
|
protected void |
queuePrefix(org.htmlparser.Tag tag)
Queues up something, possibly before a text.
|
boolean |
shouldRecurseChildren()
Depth traversal predicate.
|
boolean |
shouldRecurseSelf()
Self traversal predicate.
|
void |
visitEndTag(org.htmlparser.Tag tag)
Called for each end
Tag visited. |
void |
visitRemarkNode(org.htmlparser.Remark remark)
Called for each comment (
RemarkNode ) visited. |
void |
visitStringNode(org.htmlparser.Text string)
Called for each chunk of text (
StringNode ) visited. |
void |
visitTag(org.htmlparser.Tag tag)
Called for each
Tag visited. |
protected HTMLFilter2 filter
protected boolean recurse
protected boolean text
protected boolean preformatting
protected java.util.List<org.htmlparser.Node> befors
protected java.util.List<org.htmlparser.Node> translatable
protected java.util.List<org.htmlparser.Node> afters
protected java.util.List<org.htmlparser.Tag> sTags
protected java.util.List<java.lang.Integer> sTagNumbers
protected java.util.List<java.lang.String> sShortcuts
public FilterVisitor(HTMLFilter2 htmlfilter, java.io.BufferedWriter bufwriter, HTMLOptions opts)
public boolean shouldRecurseSelf()
shouldRecurseSelf
in class org.htmlparser.visitors.NodeVisitor
true
if a node itself is to be visited.public boolean shouldRecurseChildren()
shouldRecurseChildren
in class org.htmlparser.visitors.NodeVisitor
true
if children are to be visited.public void visitTag(org.htmlparser.Tag tag)
Tag
visited.visitTag
in class org.htmlparser.visitors.NodeVisitor
tag
- The tag being visited.protected void maybeTranslateAttribute(org.htmlparser.Tag tag, java.lang.String key)
tag
- the tag objectkey
- the name of the attributepublic void visitStringNode(org.htmlparser.Text string)
StringNode
) visited.visitStringNode
in class org.htmlparser.visitors.NodeVisitor
string
- The string node being visited.public void visitRemarkNode(org.htmlparser.Remark remark)
RemarkNode
) visited.visitRemarkNode
in class org.htmlparser.visitors.NodeVisitor
remark
- The remark node being visited.public void visitEndTag(org.htmlparser.Tag tag)
Tag
visited.visitEndTag
in class org.htmlparser.visitors.NodeVisitor
tag
- The end tag being visited.public void beginParsing()
beginParsing
in class org.htmlparser.visitors.NodeVisitor
public void finishedParsing()
finishedParsing
in class org.htmlparser.visitors.NodeVisitor
protected void endup()
protected void queuePrefix(org.htmlparser.Tag tag)
queueTranslatable(Tag)
, otherwise it's collected to a special
list that is inspected when the translatable text is sent to OmegaT core.