Movatterモバイル変換


[0]ホーム

URL:


Previous PageUp One LevelNext PagePython Library ReferenceContentsModule IndexIndex
Previous:13.3 htmllibUp:13.3 htmllibNext:13.4 htmlentitydefs

 
13.3.1 HTMLParser Objects

In addition to tag methods, theHTMLParser class provides someadditional methods and instance variables for use within tag methods.

formatter
This is the formatter instance associated with the parser.

nofill
Boolean flag which should be true when whitespace should not becollapsed, or false when it should be. In general, this should onlybe true when character data is to be treated as ``preformatted'' text,as within a<PRE> element. The default value is false. Thisaffects the operation ofhandle_data() andsave_end().

anchor_bgn(href, name, type)
This method is called at the start of an anchor region. The argumentscorrespond to the attributes of the<A> tag with the samenames. The default implementation maintains a list of hyperlinks(defined by theHREF attribute for<A> tags) within thedocument. The list of hyperlinks is available as the data attributeanchorlist.

anchor_end()
This method is called at the end of an anchor region. The defaultimplementation adds a textual footnote marker using an index into thelist of hyperlinks created byanchor_bgn().

handle_image(source, alt[, ismap[, align[, width[, height]]]])
This method is called to handle images. The default implementationsimply passes thealt value to thehandle_data()method.

save_bgn()
Begins saving character data in a buffer instead of sending it to theformatter object. Retrieve the stored data viasave_end().Use of thesave_bgn() /save_end() pair may not benested.

save_end()
Ends buffering character data and returns all data saved since thepreceding call tosave_bgn(). If thenofill flag isfalse, whitespace is collapsed to single spaces. A call to thismethod without a preceding call tosave_bgn() will raise aTypeError exception.


Previous PageUp One LevelNext PagePython Library ReferenceContentsModule IndexIndex
Previous:13.3 htmllibUp:13.3 htmllibNext:13.4 htmlentitydefs
Release 2.2.3, documentation updated on 30 May 2003.
SeeAbout this document... for information on suggesting changes.
[8]ページ先頭

©2009-2026 Movatter.jp