[Zope-Checkins] SVN: Zope/trunk/lib/python/reStructuredText/ added more tests to document the behavior before the
Log message for revision 65937: added more tests to document the behavior before the next docutils upgrade Changed: U Zope/trunk/lib/python/reStructuredText/__init__.py U Zope/trunk/lib/python/reStructuredText/tests/testReST.py -=- Modified: Zope/trunk/lib/python/reStructuredText/__init__.py === --- Zope/trunk/lib/python/reStructuredText/__init__.py 2006-03-12 23:29:08 UTC (rev 65936) +++ Zope/trunk/lib/python/reStructuredText/__init__.py 2006-03-13 12:16:56 UTC (rev 65937) @@ -152,6 +152,9 @@ warnings = ''.join(warning_stream.messages) -return output.encode(output_encoding) +if output_encoding != 'unicode': +return output.encode(output_encoding) +else: +return output __all__ = (HTML, 'render') Modified: Zope/trunk/lib/python/reStructuredText/tests/testReST.py === --- Zope/trunk/lib/python/reStructuredText/tests/testReST.py2006-03-12 23:29:08 UTC (rev 65936) +++ Zope/trunk/lib/python/reStructuredText/tests/testReST.py2006-03-13 12:16:56 UTC (rev 65937) @@ -1,14 +1,70 @@ +# -*- coding: iso-8859-15 -*- import unittest +from reStructuredText import HTML + +txt = Hello World + + +text text + +Von Vögeln und Öfen +=== + +- some +- more +- text + + + + class TestReST(unittest.TestCase): def testRoman(self): # Make sure we can import the rst parser from docutils.parsers import rst +def testEncodings(self): +def _test(txt, in_enc, out_enc): +return HTML(txt, +input_encoding=in_enc, +output_encoding=out_enc) + +encoding = 'iso-8859-15' +html = _test(txt, encoding, encoding) +self.assertEqual('Vögel' in html, True) +self.assertEqual('Öfen' in html, True) + +html = _test(txt, encoding, 'unicode') +self.assertEqual(unicode('Vögel', encoding) in html, True) +self.assertEqual(unicode('Öfen', encoding) in html, True) + +html = _test(unicode(txt, encoding), 'unicode', encoding) +self.assertEqual('Vögel' in html, True) +self.assertEqual('Öfen' in html, True) + +html = _test(unicode(txt, encoding), 'unicode', 'unicode') +self.assertEqual(unicode('Vögel', encoding) in html, True) +self.assertEqual(unicode('Öfen', encoding) in html, True) + +def testHeaderLevel(self): + +encoding = 'iso-8859-15' +for level in range(0, 5): +html = HTML(txt, input_encoding=encoding, + output_encoding=encoding, + initial_header_level=level) +self.assertEqual('h%da name=hello-worldHello World/a/h%d'\ + % (level+1, level+1) in html, + True) +self.assertEqual('h%da name=von-v-geln-und-fenVon Vögeln und Öfen/a/h%d'\ + % (level+1, level+1) in html, + True) + + def test_suite(): from unittest import TestSuite, makeSuite return TestSuite((makeSuite(TestReST),)) ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/trunk/lib/python/Products/ZReST/tests/test_ZReST.py some more tests to document the conversion behavior before
Log message for revision 65938: some more tests to document the conversion behavior before the next docutils migration Changed: U Zope/trunk/lib/python/Products/ZReST/tests/test_ZReST.py -=- Modified: Zope/trunk/lib/python/Products/ZReST/tests/test_ZReST.py === --- Zope/trunk/lib/python/Products/ZReST/tests/test_ZReST.py2006-03-13 12:16:56 UTC (rev 65937) +++ Zope/trunk/lib/python/Products/ZReST/tests/test_ZReST.py2006-03-13 12:52:13 UTC (rev 65938) @@ -1,3 +1,5 @@ +# -*- coding: iso-8859-15 -*- + Unit tests for ZReST objects $Id$ @@ -4,6 +6,20 @@ import unittest +txt = Hello World + + +text text + +Von Vögeln und Öfen +=== + +- some +- more +- text + + + class TestZReST(unittest.TestCase): def _getTargetClass(self): @@ -29,6 +45,25 @@ self.failIf('IGNORE ME' in resty.index_html()) +def testConversion(self): +resty = self._makeOne() +resty.source = txt +resty.input_encoding = 'iso-8859-15' +resty.output_encoding = 'iso-8859-15' +resty.render() +html = resty.index_html() + +s = 'h1a name=hello-worldHello World/a/h1' +self.assertEqual(s in html, True) + +s = 'h1a name=von-v-geln-und-fenVon Vögeln und Öfen/a/h1' +self.assertEqual(s in html, True) + +# ZReST should render a complete HTML document +self.assertEqual('html' in html, True) +self.assertEqual('body' in html, True) + + def test_suite(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(TestZReST)) ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/trunk/lib/python/Products/ZReST/ZReST.py fixed the name of the permission (there is no roundup product involved here)
Log message for revision 65939: fixed the name of the permission (there is no roundup product involved here) Changed: U Zope/trunk/lib/python/Products/ZReST/ZReST.py -=- Modified: Zope/trunk/lib/python/Products/ZReST/ZReST.py === --- Zope/trunk/lib/python/Products/ZReST/ZReST.py 2006-03-13 12:52:13 UTC (rev 65938) +++ Zope/trunk/lib/python/Products/ZReST/ZReST.py 2006-03-13 13:03:15 UTC (rev 65939) @@ -26,7 +26,7 @@ 'manage_addZReSTForm') manage_addZReSTForm = DTMLFile('dtml/manage_addZReSTForm', globals()) -modulesecurity.declareProtected('Add Z Roundups', 'manage_addZReST') +modulesecurity.declareProtected('Add RestructuredText Document', 'manage_addZReST') def manage_addZReST(self, id, file='', REQUEST=None): Add a ZReST product # validate the instance_home ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/trunk/lib/python/Products/ZReST/ZReST.py 'stylesheet' is now by default empty...docutils 0.4
Log message for revision 65941: 'stylesheet' is now by default empty...docutils 0.4 will raise an exception for the current 'default.css' which is not available by default Changed: U Zope/trunk/lib/python/Products/ZReST/ZReST.py -=- Modified: Zope/trunk/lib/python/Products/ZReST/ZReST.py === --- Zope/trunk/lib/python/Products/ZReST/ZReST.py 2006-03-13 13:26:00 UTC (rev 65940) +++ Zope/trunk/lib/python/Products/ZReST/ZReST.py 2006-03-13 13:42:57 UTC (rev 65941) @@ -56,7 +56,7 @@ input_encoding=None): self.id = id self.title = id -self.stylesheet = 'default.css' +self.stylesheet = '' self.report_level = '2' self.source = '' @@ -201,6 +201,7 @@ 'output_encoding': self.output_encoding, 'initial_header_level' : 1, 'stylesheet' : self.stylesheet, +'stylesheet_path' : None, 'pub.settings.warning_stream' : Warnings(), 'file_insertion_enabled' : 0, } ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/trunk/lib/python/reStructuredText/__init__.py changed default value for 'stylesheet' from 'default.css' to None
Log message for revision 65942: changed default value for 'stylesheet' from 'default.css' to None to avoid trouble with docutils 0.4.0 (trying to read the file from the filesystem) Changed: U Zope/trunk/lib/python/reStructuredText/__init__.py -=- Modified: Zope/trunk/lib/python/reStructuredText/__init__.py === --- Zope/trunk/lib/python/reStructuredText/__init__.py 2006-03-13 13:42:57 UTC (rev 65941) +++ Zope/trunk/lib/python/reStructuredText/__init__.py 2006-03-13 13:50:41 UTC (rev 65942) @@ -58,7 +58,7 @@ def render(src, writer='html4css1', report_level=1, - stylesheet='default.css', + stylesheet=None, input_encoding=default_input_encoding, output_encoding=default_output_encoding, language_code=default_language_code, @@ -71,6 +71,7 @@ settings['input_encoding'] = input_encoding settings['output_encoding'] = output_encoding settings['stylesheet'] = stylesheet +settings['stylesheet_path'] = None settings['file_insertion_enabled'] = 0 if language_code: settings['language_code'] = language_code @@ -93,7 +94,7 @@ def HTML(src, writer='html4css1', report_level=1, - stylesheet='default.css', + stylesheet=None, input_encoding=default_input_encoding, output_encoding=default_output_encoding, language_code=default_language_code, ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/trunk/doc/CHANGES.txt Docutils 0.4.0
Log message for revision 65952: Docutils 0.4.0 Changed: U Zope/trunk/doc/CHANGES.txt -=- Modified: Zope/trunk/doc/CHANGES.txt === --- Zope/trunk/doc/CHANGES.txt 2006-03-13 14:35:23 UTC (rev 65951) +++ Zope/trunk/doc/CHANGES.txt 2006-03-13 14:41:29 UTC (rev 65952) @@ -52,6 +52,17 @@ Features added + - Updated to Docutils 0.4.0 + + - reStructuredText: The default value for the 'stylesheet' +property has been changed from 'default.css' to None because +there is no 'default.css' file by default. + + - ZReST: rewritten render() method to integrate it smoothly +with Docutils 0.4.0. The default value for the 'stylesheet' +property has been changed from 'default.css' to None because +there is no 'default.css' file by default. + - Added a clock server servertype which allows users to configure methods that should be called periodically as if they were being called by a remote user agent on one of Zope's ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/trunk/lib/python/Products/ZReST/ZReST.py the default value of the 'stylesheet' property is now ''
Log message for revision 65955: the default value of the 'stylesheet' property is now '' to avoid trouble with Docutils 0.4.0 trying load this non-existing file Changed: U Zope/trunk/lib/python/Products/ZReST/ZReST.py -=- Modified: Zope/trunk/lib/python/Products/ZReST/ZReST.py === --- Zope/trunk/lib/python/Products/ZReST/ZReST.py 2006-03-13 15:04:23 UTC (rev 65954) +++ Zope/trunk/lib/python/Products/ZReST/ZReST.py 2006-03-13 17:40:51 UTC (rev 65955) @@ -70,7 +70,7 @@ # define the properties that define this object _properties = ( {'id':'stylesheet', 'type': 'string', 'mode': 'w', -'default': 'default.css'}, +'default': ''}, {'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'}, ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins