mirror of
https://github.com/python/cpython.git
synced 2025-11-03 03:22:27 +00:00
(libhtmllib.tex, libsgmllib.tex, libformatter.tex):
Improve indexing somewhat. Add small intros to the "implementations" sections of the formatter module doc.
This commit is contained in:
parent
7edd8d3c58
commit
8f925959c6
6 changed files with 58 additions and 12 deletions
|
|
@ -46,11 +46,15 @@ be called without having to track whether the property was changed.
|
||||||
|
|
||||||
The following attributes are defined for formatter instance objects:
|
The following attributes are defined for formatter instance objects:
|
||||||
|
|
||||||
|
\renewcommand{\indexsubitem}{(formatter object data)}
|
||||||
|
|
||||||
\begin{datadesc}{writer}
|
\begin{datadesc}{writer}
|
||||||
The writer instance with which the formatter interacts.
|
The writer instance with which the formatter interacts.
|
||||||
\end{datadesc}
|
\end{datadesc}
|
||||||
|
|
||||||
|
|
||||||
|
\renewcommand{\indexsubitem}{(formatter object method)}
|
||||||
|
|
||||||
\begin{funcdesc}{end_paragraph}{blanklines}
|
\begin{funcdesc}{end_paragraph}{blanklines}
|
||||||
Close any open paragraphs and insert at least \code{blanklines}
|
Close any open paragraphs and insert at least \code{blanklines}
|
||||||
before the next paragraph.
|
before the next paragraph.
|
||||||
|
|
@ -178,16 +182,25 @@ output.
|
||||||
|
|
||||||
\subsection{Formatter Implementations}
|
\subsection{Formatter Implementations}
|
||||||
|
|
||||||
|
Two implementations of formatter objects are provided by this module.
|
||||||
|
Most applications may use one of these classes without modification or
|
||||||
|
subclassing.
|
||||||
|
|
||||||
|
\renewcommand{\indexsubitem}{(in module formatter)}
|
||||||
|
|
||||||
\begin{funcdesc}{NullFormatter}{\optional{writer\code{ = None}}}
|
\begin{funcdesc}{NullFormatter}{\optional{writer\code{ = None}}}
|
||||||
A formatter which does nothing. If \code{writer} is omitted, a
|
A formatter which does nothing. If \code{writer} is omitted, a
|
||||||
\code{NullWriter} instance is created. No methods of the writer are
|
\code{NullWriter} instance is created. No methods of the writer are
|
||||||
called by \code{NullWriter} instances.
|
called by \code{NullWriter} instances. Implementations should inherit
|
||||||
|
from this class if implementing a writer interface but don't need to
|
||||||
|
inherit any implementation.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{AbstractFormatter}{writer}
|
\begin{funcdesc}{AbstractFormatter}{writer}
|
||||||
The standard formatter. This implementation has demonstrated wide
|
The standard formatter. This implementation has demonstrated wide
|
||||||
applicability to many writers, and may be used directly in most
|
applicability to many writers, and may be used directly in most
|
||||||
circumstances.
|
circumstances. It has been used to implement a full-featured
|
||||||
|
world-wide web browser.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -201,6 +214,8 @@ Note that while most applications can use the \code{AbstractFormatter}
|
||||||
class as a formatter, the writer must typically be provided by the
|
class as a formatter, the writer must typically be provided by the
|
||||||
application.
|
application.
|
||||||
|
|
||||||
|
\renewcommand{\indexsubitem}{(writer object method)}
|
||||||
|
|
||||||
\begin{funcdesc}{new_alignment}{align}
|
\begin{funcdesc}{new_alignment}{align}
|
||||||
Set the alignment style. The \code{align} value can be any object,
|
Set the alignment style. The \code{align} value can be any object,
|
||||||
but by convention is a string or \code{None}, where \code{None}
|
but by convention is a string or \code{None}, where \code{None}
|
||||||
|
|
@ -283,6 +298,12 @@ will only be called at the beginning of a line.
|
||||||
|
|
||||||
\subsection{Writer Implementations}
|
\subsection{Writer Implementations}
|
||||||
|
|
||||||
|
Three implementations of the writer object interface are provided as
|
||||||
|
examples by this module. Most applications will need to derive new
|
||||||
|
writer classes from the \code{NullWriter} class.
|
||||||
|
|
||||||
|
\renewcommand{\indexsubitem}{(in module formatter)}
|
||||||
|
|
||||||
\begin{funcdesc}{NullWriter}{}
|
\begin{funcdesc}{NullWriter}{}
|
||||||
A writer which only provides the interface definition; no actions are
|
A writer which only provides the interface definition; no actions are
|
||||||
taken on any methods. This should be the base class for all writers
|
taken on any methods. This should be the base class for all writers
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,8 @@ handlers for all HTML 2.0 and many HTML 3.0 and 3.2 elements.
|
||||||
In addition to tag methods, the \code{HTMLParser} class provides some
|
In addition to tag methods, the \code{HTMLParser} class provides some
|
||||||
additional methods and instance variables for use within tag methods.
|
additional methods and instance variables for use within tag methods.
|
||||||
|
|
||||||
|
\renewcommand{\indexsubitem}{({\tt HTMLParser} method)}
|
||||||
|
|
||||||
\begin{datadesc}{formatter}
|
\begin{datadesc}{formatter}
|
||||||
This is the formatter instance associated with the parser.
|
This is the formatter instance associated with the parser.
|
||||||
\end{datadesc}
|
\end{datadesc}
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,11 @@
|
||||||
\stmodindex{sgmllib}
|
\stmodindex{sgmllib}
|
||||||
\index{SGML}
|
\index{SGML}
|
||||||
|
|
||||||
\renewcommand{\indexsubitem}{(in module sgmllib)}
|
|
||||||
|
|
||||||
This module defines a class \code{SGMLParser} which serves as the
|
This module defines a class \code{SGMLParser} which serves as the
|
||||||
basis for parsing text files formatted in SGML (Standard Generalized
|
basis for parsing text files formatted in SGML (Standard Generalized
|
||||||
Mark-up Language). In fact, it does not provide a full SGML parser
|
Mark-up Language). In fact, it does not provide a full SGML parser
|
||||||
--- it only parses SGML insofar as it is used by HTML, and the module only
|
--- it only parses SGML insofar as it is used by HTML, and the module
|
||||||
exists as a basis for the \code{htmllib} module.
|
only exists as a base for the \code{htmllib} module.
|
||||||
\stmodindex{htmllib}
|
\stmodindex{htmllib}
|
||||||
|
|
||||||
In particular, the parser is hardcoded to recognize the following
|
In particular, the parser is hardcoded to recognize the following
|
||||||
|
|
@ -37,6 +35,8 @@ spaces, tabs, and newlines are allowed between the trailing
|
||||||
The \code{SGMLParser} class must be instantiated without arguments.
|
The \code{SGMLParser} class must be instantiated without arguments.
|
||||||
It has the following interface methods:
|
It has the following interface methods:
|
||||||
|
|
||||||
|
\renewcommand{\indexsubitem}{({\tt SGMLParser} method)}
|
||||||
|
|
||||||
\begin{funcdesc}{reset}{}
|
\begin{funcdesc}{reset}{}
|
||||||
Reset the instance. Loses all unprocessed data. This is called
|
Reset the instance. Loses all unprocessed data. This is called
|
||||||
implicitly at instantiation time.
|
implicitly at instantiation time.
|
||||||
|
|
|
||||||
|
|
@ -46,11 +46,15 @@ be called without having to track whether the property was changed.
|
||||||
|
|
||||||
The following attributes are defined for formatter instance objects:
|
The following attributes are defined for formatter instance objects:
|
||||||
|
|
||||||
|
\renewcommand{\indexsubitem}{(formatter object data)}
|
||||||
|
|
||||||
\begin{datadesc}{writer}
|
\begin{datadesc}{writer}
|
||||||
The writer instance with which the formatter interacts.
|
The writer instance with which the formatter interacts.
|
||||||
\end{datadesc}
|
\end{datadesc}
|
||||||
|
|
||||||
|
|
||||||
|
\renewcommand{\indexsubitem}{(formatter object method)}
|
||||||
|
|
||||||
\begin{funcdesc}{end_paragraph}{blanklines}
|
\begin{funcdesc}{end_paragraph}{blanklines}
|
||||||
Close any open paragraphs and insert at least \code{blanklines}
|
Close any open paragraphs and insert at least \code{blanklines}
|
||||||
before the next paragraph.
|
before the next paragraph.
|
||||||
|
|
@ -178,16 +182,25 @@ output.
|
||||||
|
|
||||||
\subsection{Formatter Implementations}
|
\subsection{Formatter Implementations}
|
||||||
|
|
||||||
|
Two implementations of formatter objects are provided by this module.
|
||||||
|
Most applications may use one of these classes without modification or
|
||||||
|
subclassing.
|
||||||
|
|
||||||
|
\renewcommand{\indexsubitem}{(in module formatter)}
|
||||||
|
|
||||||
\begin{funcdesc}{NullFormatter}{\optional{writer\code{ = None}}}
|
\begin{funcdesc}{NullFormatter}{\optional{writer\code{ = None}}}
|
||||||
A formatter which does nothing. If \code{writer} is omitted, a
|
A formatter which does nothing. If \code{writer} is omitted, a
|
||||||
\code{NullWriter} instance is created. No methods of the writer are
|
\code{NullWriter} instance is created. No methods of the writer are
|
||||||
called by \code{NullWriter} instances.
|
called by \code{NullWriter} instances. Implementations should inherit
|
||||||
|
from this class if implementing a writer interface but don't need to
|
||||||
|
inherit any implementation.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{AbstractFormatter}{writer}
|
\begin{funcdesc}{AbstractFormatter}{writer}
|
||||||
The standard formatter. This implementation has demonstrated wide
|
The standard formatter. This implementation has demonstrated wide
|
||||||
applicability to many writers, and may be used directly in most
|
applicability to many writers, and may be used directly in most
|
||||||
circumstances.
|
circumstances. It has been used to implement a full-featured
|
||||||
|
world-wide web browser.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -201,6 +214,8 @@ Note that while most applications can use the \code{AbstractFormatter}
|
||||||
class as a formatter, the writer must typically be provided by the
|
class as a formatter, the writer must typically be provided by the
|
||||||
application.
|
application.
|
||||||
|
|
||||||
|
\renewcommand{\indexsubitem}{(writer object method)}
|
||||||
|
|
||||||
\begin{funcdesc}{new_alignment}{align}
|
\begin{funcdesc}{new_alignment}{align}
|
||||||
Set the alignment style. The \code{align} value can be any object,
|
Set the alignment style. The \code{align} value can be any object,
|
||||||
but by convention is a string or \code{None}, where \code{None}
|
but by convention is a string or \code{None}, where \code{None}
|
||||||
|
|
@ -283,6 +298,12 @@ will only be called at the beginning of a line.
|
||||||
|
|
||||||
\subsection{Writer Implementations}
|
\subsection{Writer Implementations}
|
||||||
|
|
||||||
|
Three implementations of the writer object interface are provided as
|
||||||
|
examples by this module. Most applications will need to derive new
|
||||||
|
writer classes from the \code{NullWriter} class.
|
||||||
|
|
||||||
|
\renewcommand{\indexsubitem}{(in module formatter)}
|
||||||
|
|
||||||
\begin{funcdesc}{NullWriter}{}
|
\begin{funcdesc}{NullWriter}{}
|
||||||
A writer which only provides the interface definition; no actions are
|
A writer which only provides the interface definition; no actions are
|
||||||
taken on any methods. This should be the base class for all writers
|
taken on any methods. This should be the base class for all writers
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,8 @@ handlers for all HTML 2.0 and many HTML 3.0 and 3.2 elements.
|
||||||
In addition to tag methods, the \code{HTMLParser} class provides some
|
In addition to tag methods, the \code{HTMLParser} class provides some
|
||||||
additional methods and instance variables for use within tag methods.
|
additional methods and instance variables for use within tag methods.
|
||||||
|
|
||||||
|
\renewcommand{\indexsubitem}{({\tt HTMLParser} method)}
|
||||||
|
|
||||||
\begin{datadesc}{formatter}
|
\begin{datadesc}{formatter}
|
||||||
This is the formatter instance associated with the parser.
|
This is the formatter instance associated with the parser.
|
||||||
\end{datadesc}
|
\end{datadesc}
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,11 @@
|
||||||
\stmodindex{sgmllib}
|
\stmodindex{sgmllib}
|
||||||
\index{SGML}
|
\index{SGML}
|
||||||
|
|
||||||
\renewcommand{\indexsubitem}{(in module sgmllib)}
|
|
||||||
|
|
||||||
This module defines a class \code{SGMLParser} which serves as the
|
This module defines a class \code{SGMLParser} which serves as the
|
||||||
basis for parsing text files formatted in SGML (Standard Generalized
|
basis for parsing text files formatted in SGML (Standard Generalized
|
||||||
Mark-up Language). In fact, it does not provide a full SGML parser
|
Mark-up Language). In fact, it does not provide a full SGML parser
|
||||||
--- it only parses SGML insofar as it is used by HTML, and the module only
|
--- it only parses SGML insofar as it is used by HTML, and the module
|
||||||
exists as a basis for the \code{htmllib} module.
|
only exists as a base for the \code{htmllib} module.
|
||||||
\stmodindex{htmllib}
|
\stmodindex{htmllib}
|
||||||
|
|
||||||
In particular, the parser is hardcoded to recognize the following
|
In particular, the parser is hardcoded to recognize the following
|
||||||
|
|
@ -37,6 +35,8 @@ spaces, tabs, and newlines are allowed between the trailing
|
||||||
The \code{SGMLParser} class must be instantiated without arguments.
|
The \code{SGMLParser} class must be instantiated without arguments.
|
||||||
It has the following interface methods:
|
It has the following interface methods:
|
||||||
|
|
||||||
|
\renewcommand{\indexsubitem}{({\tt SGMLParser} method)}
|
||||||
|
|
||||||
\begin{funcdesc}{reset}{}
|
\begin{funcdesc}{reset}{}
|
||||||
Reset the instance. Loses all unprocessed data. This is called
|
Reset the instance. Loses all unprocessed data. This is called
|
||||||
implicitly at instantiation time.
|
implicitly at instantiation time.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue