Commit 7be77f8c authored by Andreas Jung's avatar Andreas Jung

input/output_encoding are now properties making ZReST more configurable

parent 25b2a88d
# #
# $Id: ZReST.py,v 1.2 2003/02/01 09:28:30 andreasjung Exp $ # $Id: ZReST.py,v 1.3 2003/02/01 10:23:10 andreasjung Exp $
# #
''' ReStructuredText Product for Zope ''' ReStructuredText Product for Zope
...@@ -53,12 +53,16 @@ class ZReST(Item, PropertyManager, Historical, Implicit, Persistent): ...@@ -53,12 +53,16 @@ class ZReST(Item, PropertyManager, Historical, Implicit, Persistent):
self.stylesheet = 'default.css' self.stylesheet = 'default.css'
self.report_level = '2' self.report_level = '2'
self.source = self.formatted = '' self.source = self.formatted = ''
self.input_encoding = 'iso-8859-15'
self.output_encoding = 'iso-8859-15'
# define the properties that define this object # define the properties that define this object
_properties = ( _properties = (
{'id':'stylesheet', 'type': 'string', 'mode': 'w', {'id':'stylesheet', 'type': 'string', 'mode': 'w',
'default': 'default.css'}, 'default': 'default.css'},
{'id':'report_level', 'type': 'string', 'mode': 'w', 'default': '2'}, {'id':'report_level', 'type': 'string', 'mode': 'w', 'default': '2'},
{'id':'input_encoding', 'type': 'string', 'mode': 'w', 'default': 'iso-8859-15'},
{'id':'output_encoding', 'type': 'string', 'mode': 'w', 'default': 'iso-8859-15'},
) )
property_extensible_schema__ = 0 property_extensible_schema__ = 0
...@@ -182,11 +186,11 @@ class ZReST(Item, PropertyManager, Historical, Implicit, Persistent): ...@@ -182,11 +186,11 @@ class ZReST(Item, PropertyManager, Historical, Implicit, Persistent):
# input # input
pub.source = docutils.io.StringInput( pub.source = docutils.io.StringInput(
source=self.source, encoding=sys.getdefaultencoding()) source=self.source, encoding=self.input_encoding)
# output - not that it's needed # output - not that it's needed
pub.destination = docutils.io.StringOutput( pub.destination = docutils.io.StringOutput(
encoding=sys.getdefaultencoding()) encoding=self.output_encoding)
# parse! # parse!
document = pub.reader.read(pub.source, pub.parser, pub.settings) document = pub.reader.read(pub.source, pub.parser, pub.settings)
...@@ -266,6 +270,9 @@ modulesecurity.apply(globals()) ...@@ -266,6 +270,9 @@ modulesecurity.apply(globals())
# #
# $Log: ZReST.py,v $ # $Log: ZReST.py,v $
# Revision 1.3 2003/02/01 10:23:10 andreasjung
# input/output_encoding are now properties making ZReST more configurable
#
# Revision 1.2 2003/02/01 09:28:30 andreasjung # Revision 1.2 2003/02/01 09:28:30 andreasjung
# merge from ajung-restructuredtext-integration-branch # merge from ajung-restructuredtext-integration-branch
# #
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment