[Python-checkins] CVS: python/dist/src/Doc/lib xmlsaxutils.tex,1.1,1.2

Fred L. Drake fdrake@users.sourceforge.net
Thu, 19 Jul 2001 09:10:17 -0700


Update of /cvsroot/python/python/dist/src/Doc/lib
In directory usw-pr-cvs1:/tmp/cvs-serv3604/Doc/lib

Modified Files:
	xmlsaxutils.tex 
Log Message:

Added function xml.sax.saxutils.quoteattr().

This closes SF bug #440351.  It should not be moved to Python 2.1.1.


Index: xmlsaxutils.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/xmlsaxutils.tex,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** xmlsaxutils.tex	2000/10/12 20:05:09	1.1
--- xmlsaxutils.tex	2001/07/19 16:10:14	1.2
***************
*** 15,23 ****
  
  \begin{funcdesc}{escape}{data\optional{, entities}}
!   Escape \&, <, and > in a string of data.
  
    You can escape other strings of data by passing a dictionary as the
!   optional entities parameter.  The keys and values must all be
    strings; each key will be replaced with its corresponding value.
  \end{funcdesc}
  
--- 15,43 ----
  
  \begin{funcdesc}{escape}{data\optional{, entities}}
!   Escape \character{\&}, \character{<}, and \character{>} in a string
!   of data.
  
    You can escape other strings of data by passing a dictionary as the
!   optional \var{entities} parameter.  The keys and values must all be
    strings; each key will be replaced with its corresponding value.
+ \end{funcdesc}
+ 
+ \begin{funcdesc}{quoteattr}{data\optional{, entities}}
+   Similar to \function{escape()}, but also prepares \var{data} to be
+   used as an attribute value.  The return value is a quoted version of
+   \var{data} with any additional required replacements.
+   \function{quoteattr()} will select a quote character based on the
+   content of \var{data}, attempting to avoid encoding any quote
+   characters in the string.  If both single- and double-quote
+   characters are already in \var{data}, the double-quote characters
+   will be encoded and \var{data} will be wrapped in doule-quotes.  The
+   resulting string can be used directly as an attribute value:
+ 
+ \begin{verbatim}
+ >>> print "<element attr=%s>" % quoteattr("ab ' cd \" ef")
+ <element attr="ab ' cd &quot; ef">
+ \end{verbatim}
+ 
+   \versionadded{2.2}
  \end{funcdesc}