<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <link rel="STYLESHEET" href="lib.css" type='text/css' /> <link rel="SHORTCUT ICON" href="../icons/pyfav.gif" /> <link rel='start' href='../index.html' title='Python Documentation Index' /> <link rel="first" href="lib.html" title='Python Library Reference' /> <link rel='contents' href='contents.html' title="Contents" /> <link rel='index' href='genindex.html' title='Index' /> <link rel='last' href='about.html' title='About this document...' /> <link rel='help' href='about.html' title='About this document...' /> <LINK rel="next" href="module-email.html"> <LINK rel="prev" href="netdata.html"> <LINK rel="parent" href="netdata.html"> <LINK rel="next" href="formatter-interface.html"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta name='aesop' content='information' /> <META name="description" content="formatter -- Generic output formatting"> <META name="keywords" content="lib"> <META name="resource-type" content="document"> <META name="distribution" content="global"> <title>12.1 formatter -- Generic output formatting</title> </head> <body> <DIV CLASS="navigation"> <div id='top-navigation-panel'> <table align="center" width="100%" cellpadding="0" cellspacing="2"> <tr> <td class='online-navigation'><a rel="prev" title="12. Internet Data Handling" href="netdata.html"><img src='../icons/previous.png' border='0' height='32' alt='Previous Page' width='32' /></A></td> <td class='online-navigation'><a rel="parent" title="12. Internet Data Handling" href="netdata.html"><img src='../icons/up.png' border='0' height='32' alt='Up One Level' width='32' /></A></td> <td class='online-navigation'><a rel="next" title="12.1.1 The Formatter Interface" href="formatter-interface.html"><img src='../icons/next.png' border='0' height='32' alt='Next Page' width='32' /></A></td> <td align="center" width="100%">Python Library Reference</td> <td class='online-navigation'><a rel="contents" title="Table of Contents" href="contents.html"><img src='../icons/contents.png' border='0' height='32' alt='Contents' width='32' /></A></td> <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' border='0' height='32' alt='Module Index' width='32' /></a></td> <td class='online-navigation'><a rel="index" title="Index" href="genindex.html"><img src='../icons/index.png' border='0' height='32' alt='Index' width='32' /></A></td> </tr></table> <div class='online-navigation'> <b class="navlabel">Previous:</b> <a class="sectref" rel="prev" href="netdata.html">12. Internet Data Handling</A> <b class="navlabel">Up:</b> <a class="sectref" rel="parent" href="netdata.html">12. Internet Data Handling</A> <b class="navlabel">Next:</b> <a class="sectref" rel="next" href="formatter-interface.html">12.1.1 The Formatter Interface</A> </div> <hr /></div> </DIV> <!--End of Navigation Panel--> <H1><A NAME="SECTION0014100000000000000000"> 12.1 <tt class="module">formatter</tt> -- Generic output formatting</A> </H1> <P> <A NAME="module-formatter"><!--z--></A> <P> This module supports two interface definitions, each with multiple implementations. The <i>formatter</i> interface is used by the <tt class="class">HTMLParser</tt> class of the <tt class="module"><a href="module-htmllib.html">htmllib</a></tt> module, and the <i>writer</i> interface is required by the formatter interface. <a id='l2h-3501'><!--x--></a> <P> Formatter objects transform an abstract flow of formatting events into specific output events on writer objects. Formatters manage several stack structures to allow various properties of a writer object to be changed and restored; writers need not be able to handle relative changes nor any sort of ``change back'' operation. Specific writer properties which may be controlled via formatter objects are horizontal alignment, font, and left margin indentations. A mechanism is provided which supports providing arbitrary, non-exclusive style settings to a writer as well. Additional interfaces facilitate formatting events which are not reversible, such as paragraph separation. <P> Writer objects encapsulate device interfaces. Abstract devices, such as file formats, are supported as well as physical devices. The provided implementations all work with abstract devices. The interface makes available mechanisms for setting the properties which formatter objects manage and inserting data into the output. <P> <p><br /></p><hr class='online-navigation' /> <div class='online-navigation'> <!--Table of Child-Links--> <A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></a> <UL CLASS="ChildLinks"> <LI><A href="formatter-interface.html">12.1.1 The Formatter Interface</a> <LI><A href="formatter-impls.html">12.1.2 Formatter Implementations</a> <LI><A href="writer-interface.html">12.1.3 The Writer Interface</a> <LI><A href="writer-impls.html">12.1.4 Writer Implementations</a> </ul> <!--End of Table of Child-Links--> </div> <DIV CLASS="navigation"> <div class='online-navigation'><hr /> <table align="center" width="100%" cellpadding="0" cellspacing="2"> <tr> <td class='online-navigation'><a rel="prev" title="12. Internet Data Handling" rel="prev" title="12. Internet Data Handling" href="netdata.html"><img src='../icons/previous.png' border='0' height='32' alt='Previous Page' width='32' /></A></td> <td class='online-navigation'><a rel="parent" title="12. Internet Data Handling" rel="parent" title="12. Internet Data Handling" href="netdata.html"><img src='../icons/up.png' border='0' height='32' alt='Up One Level' width='32' /></A></td> <td class='online-navigation'><a rel="next" title="12.1.1 The Formatter Interface" rel="next" title="12.1.1 The Formatter Interface" href="formatter-interface.html"><img src='../icons/next.png' border='0' height='32' alt='Next Page' width='32' /></A></td> <td align="center" width="100%">Python Library Reference</td> <td class='online-navigation'><a rel="contents" title="Table of Contents" rel="contents" title="Table of Contents" href="contents.html"><img src='../icons/contents.png' border='0' height='32' alt='Contents' width='32' /></A></td> <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' border='0' height='32' alt='Module Index' width='32' /></a></td> <td class='online-navigation'><a rel="index" title="Index" rel="index" title="Index" href="genindex.html"><img src='../icons/index.png' border='0' height='32' alt='Index' width='32' /></A></td> </tr></table> <div class='online-navigation'> <b class="navlabel">Previous:</b> <a class="sectref" rel="prev" href="netdata.html">12. Internet Data Handling</A> <b class="navlabel">Up:</b> <a class="sectref" rel="parent" href="netdata.html">12. Internet Data Handling</A> <b class="navlabel">Next:</b> <a class="sectref" rel="next" href="formatter-interface.html">12.1.1 The Formatter Interface</A> </div> </div> <hr /> <span class="release-info">Release 2.3.4, documentation updated on May 20, 2004.</span> </DIV> <!--End of Navigation Panel--> <ADDRESS> See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. </ADDRESS> </BODY> </HTML>