[Python-checkins] python/nondist/peps/docutils core.py,1.1,1.2 frontend.py,1.1,1.2 io.py,1.1,1.2 utils.py,1.1,1.2 .cvsignore,1.1,NONE
goodger@users.sourceforge.net
goodger@users.sourceforge.net
Tue, 31 Dec 2002 18:36:30 -0800
- Previous message: [Python-checkins] python/nondist/peps/docutils/writers docutils_xml.py,1.1,1.2 html4css1.py,1.2,1.3 .cvsignore,1.1,NONE
- Next message: [Python-checkins] python/nondist/peps/docutils/parsers/rst __init__.py,1.1,1.2 states.py,1.2,1.3 .cvsignore,1.1,NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/python/python/nondist/peps/docutils
In directory sc8-pr-cvs1:/tmp/cvs-serv30174
Modified Files:
core.py frontend.py io.py utils.py
Removed Files:
.cvsignore
Log Message:
update from latest Docutils code
Index: core.py
===================================================================
RCS file: /cvsroot/python/python/nondist/peps/docutils/core.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** core.py 8 Nov 2002 23:47:51 -0000 1.1
--- core.py 1 Jan 2003 02:35:57 -0000 1.2
***************
*** 138,143 ****
else:
self.settings._source = source_path
! self.source = self.source_class(self.settings, source=source,
! source_path=source_path)
def set_destination(self, destination=None, destination_path=None):
--- 138,144 ----
else:
self.settings._source = source_path
! self.source = self.source_class(
! source=source, source_path=source_path,
! encoding=self.settings.input_encoding)
def set_destination(self, destination=None, destination_path=None):
***************
*** 147,152 ****
self.settings._destination = destination_path
self.destination = self.destination_class(
! self.settings, destination=destination,
! destination_path=destination_path)
def apply_transforms(self, document):
--- 148,153 ----
self.settings._destination = destination_path
self.destination = self.destination_class(
! destination=destination, destination_path=destination_path,
! encoding=self.settings.output_encoding)
def apply_transforms(self, document):
Index: frontend.py
===================================================================
RCS file: /cvsroot/python/python/nondist/peps/docutils/frontend.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** frontend.py 8 Nov 2002 23:47:51 -0000 1.1
--- frontend.py 1 Jan 2003 02:35:57 -0000 1.2
***************
*** 304,335 ****
The section DEFAULT is special.
"""
! try:
! sectdict = self._ConfigParser__sections[section].copy()
! except KeyError:
! sectdict = {}
! d = self._ConfigParser__defaults.copy()
! d.update(sectdict)
! # Update with the entry specific variables
! if vars:
! d.update(vars)
! if raw:
! return sectdict
! # do the string interpolation
! for option in sectdict.keys():
! rawval = sectdict[option]
! value = rawval # Make it a pretty variable name
! depth = 0
! while depth < 10: # Loop through this until it's done
! depth += 1
! if value.find("%(") >= 0:
! try:
! value = value % d
! except KeyError, key:
! raise CP.InterpolationError(key, option, section,
! rawval)
! else:
! break
! if value.find("%(") >= 0:
! raise CP.InterpolationDepthError(option, section, rawval)
! sectdict[option] = value
! return sectdict
--- 304,310 ----
The section DEFAULT is special.
"""
! section_dict = {}
! if self.has_section(section):
! for option in self.options(section):
! section_dict[option] = self.get(section, option, raw, vars)
! return section_dict
Index: io.py
===================================================================
RCS file: /cvsroot/python/python/nondist/peps/docutils/io.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** io.py 8 Nov 2002 23:47:51 -0000 1.1
--- io.py 1 Jan 2003 02:35:57 -0000 1.2
***************
*** 27,34 ****
default_source_path = None
! def __init__(self, settings, source=None, source_path=None):
! self.settings = settings
! """A settings object with "input_encoding" and "output_encoding"
! attributes (typically a `docutils.optik.Values` object)."""
self.source = source
--- 27,44 ----
default_source_path = None
! def __init__(self, settings=None, source=None, source_path=None,
! encoding=None):
! self.encoding = encoding
! """The character encoding for the input source."""
!
! if settings:
! if not encoding:
! self.encoding = settings.input_encoding
! import warnings, traceback
! warnings.warn(
! 'Setting input encoding via a "settings" struct is '
! 'deprecated; send encoding directly instead.\n%s'
! % ''.join(traceback.format_list(traceback.extract_stack()
! [-3:-1])))
self.source = source
***************
*** 45,49 ****
self.source_path)
! def read(self, reader):
raise NotImplementedError
--- 55,59 ----
self.source_path)
! def read(self):
raise NotImplementedError
***************
*** 58,65 ****
locale.setlocale(locale.LC_ALL, '')
"""
! if self.settings.input_encoding \
! and self.settings.input_encoding.lower() == 'unicode':
return unicode(data)
! encodings = [self.settings.input_encoding, 'utf-8']
try:
encodings.append(locale.nl_langinfo(locale.CODESET))
--- 68,74 ----
locale.setlocale(locale.LC_ALL, '')
"""
! if self.encoding and self.encoding.lower() == 'unicode':
return unicode(data)
! encodings = [self.encoding, 'utf-8']
try:
encodings.append(locale.nl_langinfo(locale.CODESET))
***************
*** 98,105 ****
default_destination_path = None
! def __init__(self, settings, destination=None, destination_path=None):
! self.settings = settings
! """A settings object with "input_encoding" and "output_encoding"
! attributes (typically a `docutils.optik.Values` object)."""
self.destination = destination
--- 107,124 ----
default_destination_path = None
! def __init__(self, settings=None, destination=None, destination_path=None,
! encoding=None):
! self.encoding = encoding
! """The character encoding for the output destination."""
!
! if settings:
! if not encoding:
! self.encoding = settings.output_encoding
! import warnings, traceback
! warnings.warn(
! 'Setting output encoding via a "settings" struct is '
! 'deprecated; send encoding directly instead.\n%s'
! % ''.join(traceback.format_list(traceback.extract_stack()
! [-3:-1])))
self.destination = destination
***************
*** 120,128 ****
def encode(self, data):
! if self.settings.output_encoding \
! and self.settings.output_encoding.lower() == 'unicode':
return data
else:
! return data.encode(self.settings.output_encoding or '')
--- 139,146 ----
def encode(self, data):
! if self.encoding and self.encoding.lower() == 'unicode':
return data
else:
! return data.encode(self.encoding or '')
***************
*** 133,137 ****
"""
! def __init__(self, settings, source=None, source_path=None, autoclose=1):
"""
:Parameters:
--- 151,156 ----
"""
! def __init__(self, settings=None, source=None, source_path=None,
! encoding=None, autoclose=1):
"""
:Parameters:
***************
*** 142,146 ****
false if `sys.stdin` is the source.
"""
! Input.__init__(self, settings, source, source_path)
self.autoclose = autoclose
if source is None:
--- 161,165 ----
false if `sys.stdin` is the source.
"""
! Input.__init__(self, settings, source, source_path, encoding)
self.autoclose = autoclose
if source is None:
***************
*** 156,160 ****
pass
! def read(self, reader):
"""Read and decode a single file and return the data."""
data = self.source.read()
--- 175,179 ----
pass
! def read(self):
"""Read and decode a single file and return the data."""
data = self.source.read()
***************
*** 173,178 ****
"""
! def __init__(self, settings, destination=None, destination_path=None,
! autoclose=1):
"""
:Parameters:
--- 192,197 ----
"""
! def __init__(self, settings=None, destination=None, destination_path=None,
! encoding=None, autoclose=1):
"""
:Parameters:
***************
*** 185,189 ****
false if `sys.stdout` is the destination.
"""
! Output.__init__(self, settings, destination, destination_path)
self.opened = 1
self.autoclose = autoclose
--- 204,209 ----
false if `sys.stdout` is the destination.
"""
! Output.__init__(self, settings, destination, destination_path,
! encoding)
self.opened = 1
self.autoclose = autoclose
***************
*** 227,231 ****
default_source_path = '<string>'
! def read(self, reader):
"""Decode and return the source string."""
return self.decode(self.source)
--- 247,251 ----
default_source_path = '<string>'
! def read(self):
"""Decode and return the source string."""
return self.decode(self.source)
***************
*** 254,258 ****
default_source_path = 'null input'
! def read(self, reader):
"""Return a null string."""
return u''
--- 274,278 ----
default_source_path = 'null input'
! def read(self):
"""Return a null string."""
return u''
Index: utils.py
===================================================================
RCS file: /cvsroot/python/python/nondist/peps/docutils/utils.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** utils.py 8 Nov 2002 23:47:51 -0000 1.1
--- utils.py 1 Jan 2003 02:35:57 -0000 1.2
***************
*** 374,377 ****
--- 374,386 ----
def new_document(source, settings=None):
+ """
+ Return a new empty document object.
+
+ :Parameters:
+ `source` : string
+ The path to or description of the source text of the document.
+ `settings` : optparse.Values object
+ Runtime settings. If none provided, a default set will be used.
+ """
if settings is None:
settings = frontend.OptionParser().get_default_values()
--- .cvsignore DELETED ---
- Previous message: [Python-checkins] python/nondist/peps/docutils/writers docutils_xml.py,1.1,1.2 html4css1.py,1.2,1.3 .cvsignore,1.1,NONE
- Next message: [Python-checkins] python/nondist/peps/docutils/parsers/rst __init__.py,1.1,1.2 states.py,1.2,1.3 .cvsignore,1.1,NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]