wx.html.HtmlTagHandler¶See also
Todo
describe me
Class Hierarchy¶
Inheritance diagram for class HtmlTagHandler:
Known Subclasses¶
Methods Summary¶Constructor. |
|
Returns the parser associated with this tag handler. |
|
Returns list of supported tags. |
|
This is the core method of each handler. |
|
This method calls parser’s |
|
Parses given source as if it was tag’s inner code (see HtmlParser.GetInnerSource). |
|
Assigns |
Properties Summary¶See |
Class API¶wx.html.HtmlTagHandler(Object)¶Possible constructors:
HtmlTagHandler() -> None
__init__(self)¶Constructor.
None
GetParser(self)¶Returns the parser associated with this tag handler.
New in version 2.9.5.
GetSupportedTags(self)¶Returns list of supported tags.
The list is in uppercase and tags are delimited by ‘,’. Example: "I,B,FONT,P"
str
HandleTag(self, tag : HtmlTag)¶This is the core method of each handler.
It is called each time one of supported tags is detected. tag contains all necessary info (see wx.html.HtmlTag for details).
Example:
def HandleTag(self, tag):
# change state of parser (e.g. set bold face)
self.ParseInner(tag)
# ...
# restore original state of parser
You shouldn’t call ParseInner if the tag is not paired with an ending one.
tag (wx.html.HtmlTag) –
bool
True if ParseInner was called, False otherwise.
ParseInner(self, tag : HtmlTag)¶This method calls parser’s wx.html.HtmlParser.DoParsing method for the string between this tag and the paired ending tag:
<A HREF="x.htm">Hello, world!</A>
In this example, a call to ParseInner (with tag pointing to A tag) will parse ‘Hello, world!’.
tag (wx.html.HtmlTag) –
None
ParseInnerSource(self, source : str)¶Parses given source as if it was tag’s inner code (see HtmlParser.GetInnerSource).
Unlike ParseInner , this method lets you specify the source code to parse. This is useful when you need to modify the inner text before parsing.
source (string) –
None
SetParser(self, parser : HtmlParser)¶Assigns parser to this handler.
Each instance of handler is guaranteed to be called only from the one parser.
parser (wx.html.HtmlParser) –
None
SupportedTags¶See GetSupportedTags