docstring-checkins Mailing List for Docstring Processing System (Page 12)
Status: Pre-Alpha
Brought to you by:
goodger
You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(53) |
Sep
(54) |
Oct
(26) |
Nov
(27) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(60) |
Feb
(85) |
Mar
(94) |
Apr
(40) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: David G. <go...@us...> - 2002-01-16 02:41:15
|
Update of /cvsroot/docstring/dps/test/test_transforms In directory usw-pr-cvs1:/tmp/cvs-serv26954/dps/test/test_transforms Added Files: test_doctitle.py Log Message: added to project --- NEW FILE: test_doctitle.py --- #! /usr/bin/env python """ :Author: David Goodger :Contact: go...@us... :Revision: $Revision: 1.1 $ :Date: $Date: 2002/01/16 02:41:12 $ :Copyright: This module has been placed in the public domain. Tests for dps.transforms.frontmatter.DocTitle. """ import DPSTestSupport from dps.transforms.frontmatter import DocTitle import UnitTestFolder try: from restructuredtext import Parser except ImportError: from dps.parsers.restructuredtext import Parser def suite(): parser = Parser(warninglevel=4, errorlevel=4, languagecode='en', debug=UnitTestFolder.debug) s = DPSTestSupport.TransformTestSuite(parser) s.generateTests(totest) return s totest = {} totest['section_headers'] = ((DocTitle,), [ ["""\ .. test title promotion Title ===== Paragraph. """, """\ <document name="title"> <title> Title <comment> test title promotion <paragraph> Paragraph. """], ["""\ Title ===== Paragraph (no blank line). """, """\ <document name="title"> <title> Title <paragraph> Paragraph (no blank line). """], ["""\ Paragraph. Title ===== Paragraph. """, """\ <document> <paragraph> Paragraph. <section name="title"> <title> Title <paragraph> Paragraph. """], ["""\ Test unexpected section title. Title ===== Paragraph. """, """\ <document> <paragraph> Test unexpected section title. <block_quote> <system_warning level="3"> <paragraph> Unexpected section title at line 4. <paragraph> Paragraph. """], ["""\ Title ==== Test short underline. """, """\ <document name="title"> <title> Title <system_warning level="0"> <paragraph> Title underline too short at line 2. <paragraph> Test short underline. """], ["""\ ===== Title ===== Test overline title. """, """\ <document name="title"> <title> Title <paragraph> Test overline title. """], ["""\ ======= Title ======= Test overline title with inset. """, """\ <document name="title"> <title> Title <paragraph> Test overline title with inset. """], ["""\ ======================== Test Missing Underline Paragraph. """, """\ <document> <system_warning level="3"> <paragraph> Missing underline for overline at line 1. <paragraph> Paragraph. """], ["""\ ======= Title Test missing underline, with paragraph. """, """\ <document> <system_warning level="3"> <paragraph> Missing underline for overline at line 1. <paragraph> Test missing underline, with paragraph. """], ["""\ ======= Long Title ======= Test long title and space normalization. """, """\ <document name="long title"> <title> Long Title <system_warning level="0"> <paragraph> Title overline too short at line 1. <paragraph> Test long title and space normalization. """], ["""\ ======= Title ------- Paragraph. """, """\ <document> <system_warning level="3"> <paragraph> Title overline & underline mismatch at line 1. <paragraph> Paragraph. """], ["""\ .. Test return to existing, highest-level section (Title 3). Title 1 ======= Paragraph 1. Title 2 ------- Paragraph 2. Title 3 ======= Paragraph 3. Title 4 ------- Paragraph 4. """, """\ <document> <comment> Test return to existing, highest-level section (Title 3). <section name="title 1"> <title> Title 1 <paragraph> Paragraph 1. <section name="title 2"> <title> Title 2 <paragraph> Paragraph 2. <section name="title 3"> <title> Title 3 <paragraph> Paragraph 3. <section name="title 4"> <title> Title 4 <paragraph> Paragraph 4. """], ["""\ Test return to existing, highest-level section (Title 3, with overlines). ======= Title 1 ======= Paragraph 1. ------- Title 2 ------- Paragraph 2. ======= Title 3 ======= Paragraph 3. ------- Title 4 ------- Paragraph 4. """, """\ <document> <paragraph> Test return to existing, highest-level section (Title 3, with overlines). <section name="title 1"> <title> Title 1 <paragraph> Paragraph 1. <section name="title 2"> <title> Title 2 <paragraph> Paragraph 2. <section name="title 3"> <title> Title 3 <paragraph> Paragraph 3. <section name="title 4"> <title> Title 4 <paragraph> Paragraph 4. """], ["""\ Test return to existing, higher-level section (Title 4). Title 1 ======= Paragraph 1. Title 2 ------- Paragraph 2. Title 3 ``````` Paragraph 3. Title 4 ------- Paragraph 4. """, """\ <document> <paragraph> Test return to existing, higher-level section (Title 4). <section name="title 1"> <title> Title 1 <paragraph> Paragraph 1. <section name="title 2"> <title> Title 2 <paragraph> Paragraph 2. <section name="title 3"> <title> Title 3 <paragraph> Paragraph 3. <section name="title 4"> <title> Title 4 <paragraph> Paragraph 4. """], ["""\ Test bad subsection order (Title 4). Title 1 ======= Paragraph 1. Title 2 ------- Paragraph 2. Title 3 ======= Paragraph 3. Title 4 ``````` Paragraph 4. """, """\ <document> <paragraph> Test bad subsection order (Title 4). <section name="title 1"> <title> Title 1 <paragraph> Paragraph 1. <section name="title 2"> <title> Title 2 <paragraph> Paragraph 2. <section name="title 3"> <title> Title 3 <paragraph> Paragraph 3. <system_warning level="3"> <paragraph> Title level inconsistent at line 15: <literal_block> Title 4 ``````` <paragraph> Paragraph 4. """], ["""\ Test bad subsection order (Title 4, with overlines). ======= Title 1 ======= Paragraph 1. ------- Title 2 ------- Paragraph 2. ======= Title 3 ======= Paragraph 3. ``````` Title 4 ``````` Paragraph 4. """, """\ <document> <paragraph> Test bad subsection order (Title 4, with overlines). <section name="title 1"> <title> Title 1 <paragraph> Paragraph 1. <section name="title 2"> <title> Title 2 <paragraph> Paragraph 2. <section name="title 3"> <title> Title 3 <paragraph> Paragraph 3. <system_warning level="3"> <paragraph> Title level inconsistent at line 19: <literal_block> ``````` Title 4 ``````` <paragraph> Paragraph 4. """], ]) if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') |
From: David G. <go...@us...> - 2002-01-16 02:41:08
|
Update of /cvsroot/docstring/dps/test/test_transforms In directory usw-pr-cvs1:/tmp/cvs-serv26925/dps/test/test_transforms Added Files: test_docinfo.py Log Message: added to project --- NEW FILE: test_docinfo.py --- #! /usr/bin/env python """ :Author: David Goodger :Contact: go...@us... :Revision: $Revision: 1.1 $ :Date: $Date: 2002/01/16 02:41:06 $ :Copyright: This module has been placed in the public domain. Tests for dps.transforms.frontmatter.DocInfo. """ import DPSTestSupport from dps.transforms.frontmatter import DocInfo import UnitTestFolder try: from restructuredtext import Parser except ImportError: from dps.parsers.restructuredtext import Parser def suite(): parser = Parser(warninglevel=4, errorlevel=4, languagecode='en', debug=UnitTestFolder.debug) s = DPSTestSupport.TransformTestSuite(parser) s.generateTests(totest) return s totest = {} totest['bibliographic_field_lists'] = ((DocInfo,), [ ["""\ .. Bibliographic element extraction. :Abstract: There can only be one abstract. It is automatically moved to the end of the other bibliographic elements. :Author: Me :Version: 1 :Date: 2001-08-11 :Parameter i: integer """, """\ <document> <docinfo> <author> Me <version> 1 <date> 2001-08-11 <abstract> <paragraph> There can only be one abstract. <paragraph> It is automatically moved to the end of the other bibliographic elements. <comment> Bibliographic element extraction. <field_list> <field> <field_name> Parameter <field_argument> i <field_body> <paragraph> integer """], ["""\ .. Bibliographic element extraction. :Abstract: Abstract 1. :Author: Me :Contact: me...@my... :Version: 1 :Abstract: Abstract 2 (should generate a warning). :Date: 2001-08-11 :Parameter i: integer """, """\ <document> <docinfo> <author> Me <contact> <reference refuri="mailto:me...@my..."> me...@my... <version> 1 <date> 2001-08-11 <abstract> <paragraph> Abstract 1. <comment> Bibliographic element extraction. <field_list> <field> <field_name> Abstract <field_body> <paragraph> Abstract 2 (should generate a warning). <system_warning level="2"> <paragraph> There can only be one abstract. <field> <field_name> Parameter <field_argument> i <field_body> <paragraph> integer """], ["""\ :Author: - must be a paragraph :Status: a *simple* paragraph :Date: But only one paragraph. :Version: .. and not empty either """, """\ <document> <docinfo> <status> a <emphasis> simple paragraph <field_list> <field> <field_name> Author <field_body> <bullet_list bullet="-"> <list_item> <paragraph> must be a paragraph <system_warning level="2"> <paragraph> Cannot extract bibliographic field "Author" containing anything other than a single paragraph. <field> <field_name> Date <field_body> <paragraph> But only one <paragraph> paragraph. <system_warning level="2"> <paragraph> Cannot extract compound bibliographic field "Date". <field> <field_name> Version <field_body> <system_warning level="2"> <paragraph> Cannot extract empty bibliographic field "Version". <comment> and not empty either """], ["""\ :Authors: Me, Myself, **I** :Authors: PacMan; Ms. PacMan; PacMan, Jr. :Authors: Here There *Everywhere* :Authors: - First - Second - Third """, """\ <document> <docinfo> <authors> <author> Me <author> Myself <author> I <authors> <author> PacMan <author> Ms. PacMan <author> PacMan, Jr. <authors> <author> Here <author> There <author> <emphasis> Everywhere <authors> <author> First <author> Second <author> Third """], ["""\ :Authors: :Authors: 1. One 2. Two :Authors: - - :Authors: - One Two :Authors: - One Two """, """\ <document> <field_list> <field> <field_name> Authors <field_body> <system_warning level="2"> <paragraph> Cannot extract empty bibliographic field "Authors". <field> <field_name> Authors <field_body> <enumerated_list enumtype="arabic" prefix="" start="1" suffix="."> <list_item> <paragraph> One <list_item> <paragraph> Two <system_warning level="2"> <paragraph> Bibliographic field "Authors" incompatible with extraction: it must contain either a single paragraph (with authors separated by one of ";,"), multiple paragraphs (one per author), or a bullet list with one paragraph (one author) per item. <field> <field_name> Authors <field_body> <bullet_list bullet="-"> <list_item> <list_item> <system_warning level="2"> <paragraph> Bibliographic field "Authors" incompatible with extraction: it must contain either a single paragraph (with authors separated by one of ";,"), multiple paragraphs (one per author), or a bullet list with one paragraph (one author) per item. <field> <field_name> Authors <field_body> <bullet_list bullet="-"> <list_item> <paragraph> One <paragraph> Two <system_warning level="2"> <paragraph> Bibliographic field "Authors" incompatible with extraction: it must contain either a single paragraph (with authors separated by one of ";,"), multiple paragraphs (one per author), or a bullet list with one paragraph (one author) per item. <field> <field_name> Authors <field_body> <bullet_list bullet="-"> <list_item> <paragraph> One <paragraph> Two <system_warning level="2"> <paragraph> Bibliographic field "Authors" incompatible with extraction: it must contain either a single paragraph (with authors separated by one of ";,"), multiple paragraphs (one per author), or a bullet list with one paragraph (one author) per item. """], ["""\ .. RCS keyword extraction. :Status: $RCSfile: test_docinfo.py,v $ :Date: $Date: 2002/01/16 02:41:06 $ RCS keyword 'RCSfile' doesn't change unless the file name changes, so it's safe. The 'Date' keyword changes every time the file is checked in to CVS, so the test's expected output text has to be derived (hacked) in parallel in order to stay in sync. """, """\ <document> <docinfo> <status> test_field_lists.py <date> %s <comment> RCS keyword extraction. <paragraph> RCS keyword 'RCSfile' doesn't change unless the file name changes, so it's safe. The 'Date' keyword changes every time the file is checked in to CVS, so the test's expected output text has to be derived (hacked) in parallel in order to stay in sync. """ % ('$Date: 2002/01/16 02:41:06 $'[7:17].replace('/', '-'),)], ]) if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') |
From: David G. <go...@us...> - 2002-01-16 02:40:32
|
Update of /cvsroot/docstring/dps/test In directory usw-pr-cvs1:/tmp/cvs-serv26802/dps/test Modified Files: UnitTestFolder.py Log Message: more selective catching exceptions Index: UnitTestFolder.py =================================================================== RCS file: /cvsroot/docstring/dps/test/UnitTestFolder.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** UnitTestFolder.py 2001/09/20 02:57:46 1.2 --- UnitTestFolder.py 2002/01/16 02:40:29 1.3 *************** *** 97,107 **** try: suite = getattr(module, 'suite') - if type(suite) == types.FunctionType: - testSuite.addTest(suite()) - elif type(suite) == types.InstanceType \ - and isinstance(suite, unittest.TestSuite): - testSuite.addTest(suite) - else: - raise AssertionError, "don't understand suite" except AttributeError: # Look for individual tests --- 97,100 ---- *************** *** 111,114 **** --- 104,115 ---- # to cheat: testSuite.addTest(moduleTests) + continue + if type(suite) == types.FunctionType: + testSuite.addTest(suite()) + elif type(suite) == types.InstanceType \ + and isinstance(suite, unittest.TestSuite): + testSuite.addTest(suite) + else: + raise AssertionError, "don't understand suite (%s)" % modpath return testSuite |
From: David G. <go...@us...> - 2002-01-16 02:37:57
|
Update of /cvsroot/docstring/dps/test/test_transforms In directory usw-pr-cvs1:/tmp/cvs-serv26197/test_transforms Log Message: Directory /cvsroot/docstring/dps/test/test_transforms added to the repository |
From: David G. <go...@us...> - 2001-11-23 03:19:45
|
Update of /cvsroot/docstring/dps/test In directory usw-pr-cvs1:/tmp/cvs-serv1915/dps/test Modified Files: test_statemachine.py Log Message: updated Index: test_statemachine.py =================================================================== RCS file: /cvsroot/docstring/dps/test/test_statemachine.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_statemachine.py 2001/09/17 04:06:05 1.1 --- test_statemachine.py 2001/11/23 03:19:43 1.2 *************** *** 39,51 **** expected = ('StateMachine1 text1 blank1 bullet1 knownindent1 ' 'StateMachine2 text2 text2 blank2 text2 blank2 indent2 ' ! 'StateMachine3 text3 finished3 finished2 ' 'bullet1 knownindent1 ' 'StateMachine2 text2 blank2 literalblock2(4) finished2 ' 'text1 finished1').split() para1 = testtext[:2] ! item1 = [line[2:] for line in testtext[2:8]] ! item2 = [line[2:] for line in testtext[9:-2]] lbindent = 6 ! literalblock = [line[lbindent:] for line in testtext[11:-2]] para2 = testtext[-1] --- 39,51 ---- expected = ('StateMachine1 text1 blank1 bullet1 knownindent1 ' 'StateMachine2 text2 text2 blank2 text2 blank2 indent2 ' ! 'StateMachine3 text3 blank3 finished3 finished2 ' 'bullet1 knownindent1 ' 'StateMachine2 text2 blank2 literalblock2(4) finished2 ' 'text1 finished1').split() para1 = testtext[:2] ! item1 = [line[2:] for line in testtext[2:9]] ! item2 = [line[2:] for line in testtext[9:-1]] lbindent = 6 ! literalblock = [line[lbindent:] for line in testtext[11:-1]] para2 = testtext[-1] *************** *** 170,174 **** indented, offset, good = self.sm.getknownindented(2) self.assertEquals(indented, item2) ! self.assertEquals(offset, len(para1) + len(item1) + 1) self.failUnless(good) self.sm.previousline(3) --- 170,174 ---- indented, offset, good = self.sm.getknownindented(2) self.assertEquals(indented, item2) ! self.assertEquals(offset, len(para1) + len(item1)) self.failUnless(good) self.sm.previousline(3) *************** *** 180,184 **** self.assertEquals(indent, lbindent) self.assertEquals(indented, literalblock) ! self.assertEquals(offset, (len(para1) + len(item1) + len(item2) + 1 - len(literalblock))) self.failUnless(good) --- 180,184 ---- self.assertEquals(indent, lbindent) self.assertEquals(indented, literalblock) ! self.assertEquals(offset, (len(para1) + len(item1) + len(item2) - len(literalblock))) self.failUnless(good) |
From: David G. <go...@us...> - 2001-11-22 04:18:25
|
Update of /cvsroot/docstring/dps In directory usw-pr-cvs1:/tmp/cvs-serv9620/dps Modified Files: HISTORY.txt Log Message: updated Index: HISTORY.txt =================================================================== RCS file: /cvsroot/docstring/dps/HISTORY.txt,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** HISTORY.txt 2001/11/19 04:07:29 1.30 --- HISTORY.txt 2001/11/22 04:18:23 1.31 *************** *** 80,84 **** - Fixed bugs in StateMachineWS.getknownindented(). - Added trimming of blank first lines to ! StateMachineWS.getfirstknownindented(). - Cleaned up & updated. - Fixed bug in StateMachine.getunindented(). --- 80,85 ---- - Fixed bugs in StateMachineWS.getknownindented(). - Added trimming of blank first lines to ! StateMachineWS.getindented(), .getknownindented(), and ! .getfirstknownindented(). - Cleaned up & updated. - Fixed bug in StateMachine.getunindented(). *************** *** 88,92 **** - Added 'uptoblank' and 'stripindent' optional arguments to 'getindented', 'getknownindented', and 'getfirstknownindented' ! methods of StateWS, and to 'extractindented' function. * dps/urischemes.py: Known URI schemes; added to project. --- 89,94 ---- - Added 'uptoblank' and 'stripindent' optional arguments to 'getindented', 'getknownindented', and 'getfirstknownindented' ! methods of StateMachineWS, and to 'extractindented' function. ! - Added 'atbof' and 'ateof' methods to StateMachine. * dps/urischemes.py: Known URI schemes; added to project. *************** *** 98,101 **** --- 100,104 ---- Reporter. - Removed Reporter.strong_system_warning (not needed). + - Improved error stream handling. - Added some docstrings. - Added 'parseattributes()', associated functions and exceptions. |
From: David G. <go...@us...> - 2001-11-22 04:17:52
|
Update of /cvsroot/docstring/dps/dps In directory usw-pr-cvs1:/tmp/cvs-serv9514/dps/dps Modified Files: statemachine.py Log Message: - Removed trimming of blank last lines from StateMachineWS.getindented(), .getknownindented(), and .getfirstknownindented(). - Added 'atbof' and 'ateof' methods to StateMachine. Index: statemachine.py =================================================================== RCS file: /cvsroot/docstring/dps/dps/statemachine.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** statemachine.py 2001/11/13 03:07:09 1.11 --- statemachine.py 2001/11/22 04:17:50 1.12 *************** *** 262,265 **** --- 262,273 ---- return 1 + def ateof(self): + """Return 1 if the input is at or past end-of-file.""" + return self.lineoffset >= len(self.inputlines) - 1 + + def atbof(self): + """Return 1 if the input is at or before beginning-of-file.""" + return self.lineoffset <= 0 + def previousline(self, n=1): """Load `self.line` with the `n`'th previous line and return it.""" *************** *** 743,748 **** if indented: self.nextline(len(indented) - 1) # advance to last indented line - while indented and not indented[-1].strip(): - indented.pop() while indented and not indented[0].strip(): indented.pop(0) --- 751,754 ---- *************** *** 787,792 **** if indented: self.nextline(len(indented) - 1) # advance to last indented line - while indented and not indented[-1].strip(): - indented.pop() while indented and not indented[0].strip(): indented.pop(0) --- 793,796 ---- *************** *** 818,823 **** self.inputlines[self.lineoffset + 1:], uptoblank, stripindent) self.nextline(len(indented) - 1) # advance to last indented line - while indented and not indented[-1].strip(): - indented.pop() while indented and not indented[0].strip(): indented.pop(0) --- 822,825 ---- |
From: David G. <go...@us...> - 2001-11-22 04:11:47
|
Update of /cvsroot/docstring/dps/dps In directory usw-pr-cvs1:/tmp/cvs-serv8713/dps/dps Modified Files: nodes.py Log Message: - Removed a debug print. Index: nodes.py =================================================================== RCS file: /cvsroot/docstring/dps/dps/nodes.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** nodes.py 2001/11/19 04:06:00 1.19 --- nodes.py 2001/11/22 04:11:44 1.20 *************** *** 420,424 **** self.externaltargets, self.implicittargets) elif self.implicittargets.has_key(name): - print >>sys.stderr, "already has explicit target" sw = self.errorhandler.information( 'Duplicate implicit target name: "%s"' % name) --- 420,423 ---- |
From: David G. <go...@us...> - 2001-11-22 04:10:53
|
Update of /cvsroot/docstring/dps/dps In directory usw-pr-cvs1:/tmp/cvs-serv8488/dps/dps Modified Files: utils.py Log Message: - Improved error stream handling. Index: utils.py =================================================================== RCS file: /cvsroot/docstring/dps/dps/utils.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** utils.py 2001/11/15 02:57:22 1.8 --- utils.py 2001/11/22 04:10:50 1.9 *************** *** 22,26 **** class Reporter: ! def __init__(self, warninglevel, errorlevel, warningstream=sys.stderr): self.warninglevel = warninglevel """The level at or above which warning output will be sent to --- 22,26 ---- class Reporter: ! def __init__(self, warninglevel, errorlevel, warningstream=None): self.warninglevel = warninglevel """The level at or above which warning output will be sent to *************** *** 30,33 **** --- 30,36 ---- """The level at or above which `SystemWarning` exceptions will be raised.""" + + if warningstream is None: + warningstream = sys.stderr self.stream = warningstream |
From: David G. <go...@us...> - 2001-11-19 04:07:32
|
Update of /cvsroot/docstring/dps In directory usw-pr-cvs1:/tmp/cvs-serv4888/dps Modified Files: HISTORY.txt Log Message: updated Index: HISTORY.txt =================================================================== RCS file: /cvsroot/docstring/dps/HISTORY.txt,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** HISTORY.txt 2001/11/15 02:59:13 1.29 --- HISTORY.txt 2001/11/19 04:07:29 1.30 *************** *** 71,75 **** - Added "hint", "substitution", "substitution_reference" classes. - Added element hierarchy base classes. ! - Changed 'directive' to a TextElement. * dps/roman.py: Added to project. Written by and courtesy of Mark --- 71,75 ---- - Added "hint", "substitution", "substitution_reference" classes. - Added element hierarchy base classes. ! - Removed generic 'directive'. * dps/roman.py: Added to project. Written by and courtesy of Mark *************** *** 170,177 **** - Expanded 'authors' content. - Clarified 'figure' content. ! - Added 'substitution' and 'substitution_reference'. ! - Changed content model 'directive' to PCDATA. - Changed content models of most inline elements to %text.model, allowing nested inline elements. * spec/pdpi.dtd: --- 170,177 ---- - Expanded 'authors' content. - Clarified 'figure' content. ! - Added 'substitution_definition' and 'substitution_reference'. - Changed content models of most inline elements to %text.model, allowing nested inline elements. + - Removed generic 'directive'. * spec/pdpi.dtd: |
From: David G. <go...@us...> - 2001-11-19 04:06:02
|
Update of /cvsroot/docstring/dps/dps In directory usw-pr-cvs1:/tmp/cvs-serv3647/dps/dps Modified Files: nodes.py Log Message: - Removed generic 'directive'. - Changed 'substitution' to 'substitution_defnition'. Index: nodes.py =================================================================== RCS file: /cvsroot/docstring/dps/dps/nodes.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** nodes.py 2001/11/09 23:13:22 1.18 --- nodes.py 2001/11/19 04:06:00 1.19 *************** *** 347,351 **** self.externaltargets = {} self.indirecttargets = {} ! self.substitutions = {} self.refnames = {} self.substitutionrefs = {} --- 347,351 ---- self.externaltargets = {} self.indirecttargets = {} ! self.substitutiondefs = {} self.refnames = {} self.substitutionrefs = {} *************** *** 450,460 **** self.autofootnoterefs.append((refname, refnode)) ! def addsubstitution(self, name, substitutionnode, innode): ! if self.substitutions.has_key(name): sw = self.errorhandler.error( ! 'Duplicate substitution name: "%s"' % name) innode += sw ! self.substitutions[name] = substitutionnode ! substitutionnode['name'] = name def addsubstitutionref(self, refname, subrefnode): --- 450,462 ---- self.autofootnoterefs.append((refname, refnode)) ! def addsubstitutiondef(self, name, substitutiondefnode, innode): ! if self.substitutiondefs.has_key(name): sw = self.errorhandler.error( ! 'Duplicate substitution definition name: "%s"' % name) innode += sw ! oldnode = self.substitutiondefs[name] ! oldnode['dupname'] = oldnode['name'] ! del oldnode['name'] ! self.substitutiondefs[name] = substitutiondefnode def addsubstitutionref(self, refname, subrefnode): *************** *** 555,560 **** class warning(Admonition, Element): pass class comment(Special, TextElement): pass ! class directive(Special, TextElement): pass ! class substitution(Special, TextElement): pass class target(Special, Inline, TextElement): pass class footnote(General, Element): pass --- 557,561 ---- class warning(Admonition, Element): pass class comment(Special, TextElement): pass ! class substitution_definition(Special, TextElement): pass class target(Special, Inline, TextElement): pass class footnote(General, Element): pass |
From: David G. <go...@us...> - 2001-11-19 04:04:48
|
Update of /cvsroot/docstring/dps/spec In directory usw-pr-cvs1:/tmp/cvs-serv3051/dps/spec Modified Files: gpdi.dtd Log Message: - Changed 'substitution' to 'substitution_definition'. Index: gpdi.dtd =================================================================== RCS file: /cvsroot/docstring/dps/spec/gpdi.dtd,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** gpdi.dtd 2001/11/19 04:02:02 1.26 --- gpdi.dtd 2001/11/19 04:04:46 1.27 *************** *** 369,374 **** %anonymous.att;> ! <!ELEMENT substitution (%text.model;)> ! <!ATTLIST substitution %basic.atts;> <!ELEMENT comment (#PCDATA)> --- 369,374 ---- %anonymous.att;> ! <!ELEMENT substitution_definition (%text.model;)> ! <!ATTLIST substitution_definition %basic.atts;> <!ELEMENT comment (#PCDATA)> |
From: David G. <go...@us...> - 2001-11-19 04:02:05
|
Update of /cvsroot/docstring/dps/spec In directory usw-pr-cvs1:/tmp/cvs-serv2456/dps/spec Modified Files: gpdi.dtd Log Message: - Removed generic 'directive'. Index: gpdi.dtd =================================================================== RCS file: /cvsroot/docstring/dps/spec/gpdi.dtd,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** gpdi.dtd 2001/11/15 02:54:04 1.25 --- gpdi.dtd 2001/11/19 04:02:02 1.26 *************** *** 110,114 **** | note | tip | hint | warning | error | caution | danger | important ! | target | substitution | directive | comment | system_warning %additional.body.elements; "> --- 110,114 ---- | note | tip | hint | warning | error | caution | danger | important ! | target | substitution_definition | comment | system_warning %additional.body.elements; "> *************** *** 371,381 **** <!ELEMENT substitution (%text.model;)> <!ATTLIST substitution %basic.atts;> - - <!ELEMENT directive (#PCDATA)> - <!ATTLIST directive - %basic.atts; - %fixedspace.att; - type CDATA #IMPLIED - data CDATA #IMPLIED> <!ELEMENT comment (#PCDATA)> --- 371,374 ---- |
From: David G. <go...@us...> - 2001-11-19 04:01:42
|
Update of /cvsroot/docstring/dps/spec In directory usw-pr-cvs1:/tmp/cvs-serv2365/dps/spec Modified Files: doctree.txt Log Message: - Removed generic 'directive'. Index: doctree.txt =================================================================== RCS file: /cvsroot/docstring/dps/spec/doctree.txt,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** doctree.txt 2001/11/06 01:07:59 1.5 --- doctree.txt 2001/11/19 04:01:39 1.6 *************** *** 29,33 **** | | - literal | - lists | | - hyperlink +------------+ | | blocks | - tables | | targets | ! | para- | - doctest | - block | foot- | - directives | | graphs | blocks | quotes | notes | - comments | +---------+-----------+----------+-------+--------------+ --- 29,33 ---- | | - literal | - lists | | - hyperlink +------------+ | | blocks | - tables | | targets | ! | para- | - doctest | - block | foot- | - sub. defs | | graphs | blocks | quotes | notes | - comments | +---------+-----------+----------+-------+--------------+ *************** *** 71,75 **** important_ ! - _`Special body elements`: target_, directive_, substitution_ comment_, system_warning_ --- 71,75 ---- important_ ! - _`Special body elements`: target_, substitution_definition_, comment_, system_warning_ |
From: David G. <go...@us...> - 2001-11-15 02:59:17
|
Update of /cvsroot/docstring/dps In directory usw-pr-cvs1:/tmp/cvs-serv18700/dps Modified Files: HISTORY.txt Log Message: updated Index: HISTORY.txt =================================================================== RCS file: /cvsroot/docstring/dps/HISTORY.txt,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** HISTORY.txt 2001/11/13 03:07:53 1.28 --- HISTORY.txt 2001/11/15 02:59:13 1.29 *************** *** 99,102 **** --- 99,103 ---- - Removed Reporter.strong_system_warning (not needed). - Added some docstrings. + - Added 'parseattributes()', associated functions and exceptions. * dps/test_*.py: Moved to new test/ directory. *************** *** 166,169 **** --- 167,171 ---- specifically images and substitution references. - Added 'image' as body element; 'target' as inline element. + - Added 'alt' attribute to 'image'. - Expanded 'authors' content. - Clarified 'figure' content. |
From: David G. <go...@us...> - 2001-11-15 02:58:46
|
Update of /cvsroot/docstring/dps/test In directory usw-pr-cvs1:/tmp/cvs-serv18613/dps/test Modified Files: test_utils.py Log Message: Added 'AttributeParserTests'. Index: test_utils.py =================================================================== RCS file: /cvsroot/docstring/dps/test/test_utils.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_utils.py 2001/09/17 04:11:02 1.1 --- test_utils.py 2001/11/15 02:58:43 1.2 *************** *** 110,113 **** --- 110,162 ---- + class AttributeParserTests(unittest.TestCase): + + def test_extractattributes(self): + self.assertRaises(utils.BadAttributeLineError, + utils.extractattributes, ['hello']) + self.assertRaises(utils.BadAttributeDataError, + utils.extractattributes, ['[hello]']) + self.assertRaises(utils.BadAttributeDataError, + utils.extractattributes, ['[=hello]']) + self.assertRaises(utils.BadAttributeDataError, + utils.extractattributes, ['[hello=]']) + self.assertRaises(utils.BadAttributeDataError, + utils.extractattributes, ['[hello="]']) + self.assertRaises(utils.BadAttributeDataError, + utils.extractattributes, ['[hello="something]']) + self.assertRaises(utils.BadAttributeDataError, + utils.extractattributes, + ['[hello="something"else]']) + output = utils.extractattributes("""\ + [att1=val1 att2=val2 att3="value number '3'"] + [att4=val4]""".splitlines()) + self.assertEquals(output, [('att1', 'val1'), ('att2', 'val2'), + ('att3', "value number '3'"), + ('att4', 'val4')]) + + attributespec = {'a': int, 'bbb': float, 'cdef': lambda x: x} + + def test_assembleattributes(self): + input = utils.extractattributes(['[a=1 bbb=2.0 cdef=hol%s]' + % chr(224)]) + self.assertEquals( + utils.assembleattributes(input, self.attributespec), + {'a': 1, 'bbb': 2.0, 'cdef': ('hol%s' % chr(224))}) + input = utils.extractattributes(['[a=1 b=2.0 c=hol%s]' + % chr(224)]) + self.assertRaises(KeyError, utils.assembleattributes, + input, self.attributespec) + input = utils.extractattributes(['[a=1 bbb=two cdef=hol%s]' + % chr(224)]) + self.assertRaises(ValueError, utils.assembleattributes, + input, self.attributespec) + + def test_parseattributes(self): + input = ['[a=1 bbb=2.0 cdef=hol%s]' % chr(224)] + self.assertEquals( + utils.parseattributes(input, self.attributespec), + {'a': 1, 'bbb': 2.0, 'cdef': ('hol%s' % chr(224))}) + + if __name__ == '__main__': unittest.main() |
From: David G. <go...@us...> - 2001-11-15 02:57:25
|
Update of /cvsroot/docstring/dps/dps In directory usw-pr-cvs1:/tmp/cvs-serv18456/dps/dps Modified Files: utils.py Log Message: - Added 'parseattributes()', associated functions and exceptions. Index: utils.py =================================================================== RCS file: /cvsroot/docstring/dps/dps/utils.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** utils.py 2001/09/18 04:32:12 1.7 --- utils.py 2001/11/15 02:57:22 1.8 *************** *** 58,59 **** --- 58,171 ---- def severe(self, comment=None, children=[]): return self.system_warning(3, comment, children) + + + class AttributeParsingError(Exception): pass + class BadAttributeLineError(AttributeParsingError): pass + class BadAttributeDataError(AttributeParsingError): pass + class DuplicateAttributeError(AttributeParsingError): pass + + + def parseattributes(lines, attributespec): + """ + Return a dictionary mapping attribute names to converted values. + + :Parameters: + - `lines`: List of one-line strings of the form:: + + ['[name1=value1 name2=value2]', '[name3="value 3"]'] + + - `attributespec`: Dictionary mapping known attribute names to a + conversion function such as `int` or `float`. + + :Raises: + - `KeyError` for unknown attribute names. + - `ValueError` for invalid attribute values (raised by conversion + function). + - `DuplicateAttributeError` for duplicate attributes. + - `BadAttributeLineError` for input lines not enclosed in brackets. + - `BadAttributeDataError` for invalid attribute data (missing name, + missing data, bad quotes, etc.). + """ + attlist = extractattributes(lines) + attdict = assembleattributes(attlist, attributespec) + return attdict + + def extractattributes(lines): + """ + Return a list of attribute (name, value) pairs. + + :Parameter: + `lines`: List of one-line strings of the form:: + + ['[name1=value1 name2=value2]', '[name3="value 3"]'] + + :Raises: + - `BadAttributeLineError` for input lines not enclosed in brackets. + - `BadAttributeDataError` for invalid attribute data (missing name, + missing data, bad quotes, etc.). + """ + attlist = [] + for line in lines: + line = line.strip() + if line[:1] != '[' or line[-1:] != ']': + raise BadAttributeLineError( + 'input line not enclosed in "[" and "]"') + line = line[1:-1].strip() + while line: + equals = line.find('=') + if equals == -1: + raise BadAttributeDataError('missing "="') + elif equals == 0: + raise BadAttributeDataError( + 'missing attribute name before "="') + attname = line[:equals] + line = line[equals+1:] + if not line: + raise BadAttributeDataError( + 'missing value after "%s="' % attname) + if line[0] in '\'"': + endquote = line.find(line[0], 1) + if endquote == -1: + raise BadAttributeDataError( + 'attribute "%s" missing end quote (%s)' + % (attname, line[0])) + if len(line) > endquote + 1 and line[endquote + 1].strip(): + raise BadAttributeDataError( + 'attribute "%s" end quote (%s) not followed by ' + 'whitespace' % (attname, line[0])) + data = line[1:endquote] + line = line[endquote+1:].lstrip() + else: + space = line.find(' ') + if space == -1: + data = line + line = '' + else: + data = line[:space] + line = line[space+1:].lstrip() + attlist.append((attname.lower(), data)) + return attlist + + def assembleattributes(attlist, attributespec): + """ + Return a mapping of attribute names to values. + + :Parameters: + - `attlist`: A list of (name, value) pairs (the output of + `extractattributes()`). + - `attributespec`: Dictionary mapping known attribute names to a + conversion function such as `int` or `float`. + + :Raises: + - `KeyError` for unknown attribute names. + - `DuplicateAttributeError` for duplicate attributes. + - `ValueError` for invalid attribute values (raised by conversion + function). + """ + attributes = {} + for name, value in attlist: + convertor = attributespec[name] # raises KeyError if unknown + if attributes.has_key(name): + raise DuplicateAttributeError('duplicate attribute "%s"' % name) + attributes[name] = convertor(value) # raises ValueError if invalud + return attributes |
From: David G. <go...@us...> - 2001-11-15 02:54:07
|
Update of /cvsroot/docstring/dps/spec In directory usw-pr-cvs1:/tmp/cvs-serv17845/dps/spec Modified Files: gpdi.dtd Log Message: - Added 'alt' attribute to 'image'. Index: gpdi.dtd =================================================================== RCS file: /cvsroot/docstring/dps/spec/gpdi.dtd,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** gpdi.dtd 2001/11/13 03:08:01 1.24 --- gpdi.dtd 2001/11/15 02:54:04 1.25 *************** *** 392,395 **** --- 392,396 ---- %basic.atts; uri CDATA #REQUIRED + alt CDATA #IMPLIED height NMTOKEN #IMPLIED width NMTOKEN #IMPLIED |
From: David G. <go...@us...> - 2001-11-13 03:08:10
|
Update of /cvsroot/docstring/dps/test In directory usw-pr-cvs1:/tmp/cvs-serv13186/dps/test Modified Files: test_nodes.py Log Message: updated Index: test_nodes.py =================================================================== RCS file: /cvsroot/docstring/dps/test/test_nodes.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_nodes.py 2001/09/17 04:04:59 1.1 --- test_nodes.py 2001/11/13 03:08:07 1.2 *************** *** 43,78 **** def test_empty(self): ! element = nodes._Element() ! self.assertEquals(repr(element), '<_Element: >') ! self.assertEquals(str(element), '<_Element/>') dom = element.asdom() ! self.assertEquals(dom.toxml(), '<_Element/>') dom.unlink() element['attr'] = '1' ! self.assertEquals(repr(element), '<_Element: >') ! self.assertEquals(str(element), '<_Element attr="1"/>') dom = element.asdom() ! self.assertEquals(dom.toxml(), '<_Element attr="1"/>') dom.unlink() ! self.assertEquals(element.pformat(), '<_Element attr="1">\n') def test_withtext(self): ! element = nodes._Element('text\nmore', nodes.Text('text\nmore')) ! self.assertEquals(repr(element), r"<_Element: <#text...>>") ! self.assertEquals(str(element), '<_Element>text\nmore</_Element>') dom = element.asdom() ! self.assertEquals(dom.toxml(), '<_Element>text\nmore</_Element>') dom.unlink() element['attr'] = '1' ! self.assertEquals(repr(element), r"<_Element: <#text...>>") self.assertEquals(str(element), ! '<_Element attr="1">text\nmore</_Element>') dom = element.asdom() self.assertEquals(dom.toxml(), ! '<_Element attr="1">text\nmore</_Element>') dom.unlink() self.assertEquals(element.pformat(), """\ ! <_Element attr="1"> text more --- 43,78 ---- def test_empty(self): ! element = nodes.Element() ! self.assertEquals(repr(element), '<Element: >') ! self.assertEquals(str(element), '<Element/>') dom = element.asdom() ! self.assertEquals(dom.toxml(), '<Element/>') dom.unlink() element['attr'] = '1' ! self.assertEquals(repr(element), '<Element: >') ! self.assertEquals(str(element), '<Element attr="1"/>') dom = element.asdom() ! self.assertEquals(dom.toxml(), '<Element attr="1"/>') dom.unlink() ! self.assertEquals(element.pformat(), '<Element attr="1">\n') def test_withtext(self): ! element = nodes.Element('text\nmore', nodes.Text('text\nmore')) ! self.assertEquals(repr(element), r"<Element: <#text...>>") ! self.assertEquals(str(element), '<Element>text\nmore</Element>') dom = element.asdom() ! self.assertEquals(dom.toxml(), '<Element>text\nmore</Element>') dom.unlink() element['attr'] = '1' ! self.assertEquals(repr(element), r"<Element: <#text...>>") self.assertEquals(str(element), ! '<Element attr="1">text\nmore</Element>') dom = element.asdom() self.assertEquals(dom.toxml(), ! '<Element attr="1">text\nmore</Element>') dom.unlink() self.assertEquals(element.pformat(), """\ ! <Element attr="1"> text more |
From: David G. <go...@us...> - 2001-11-13 03:08:03
|
Update of /cvsroot/docstring/dps/spec In directory usw-pr-cvs1:/tmp/cvs-serv13125/dps/spec Modified Files: gpdi.dtd Log Message: updated Index: gpdi.dtd =================================================================== RCS file: /cvsroot/docstring/dps/spec/gpdi.dtd,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** gpdi.dtd 2001/11/09 23:10:37 1.23 --- gpdi.dtd 2001/11/13 03:08:01 1.24 *************** *** 372,376 **** <!ATTLIST substitution %basic.atts;> ! <!ELEMENT directive (#PCDATA)*> <!ATTLIST directive %basic.atts; --- 372,376 ---- <!ATTLIST substitution %basic.atts;> ! <!ELEMENT directive (#PCDATA)> <!ATTLIST directive %basic.atts; |
From: David G. <go...@us...> - 2001-11-13 03:07:55
|
Update of /cvsroot/docstring/dps In directory usw-pr-cvs1:/tmp/cvs-serv13081/dps Modified Files: HISTORY.txt Log Message: updated Index: HISTORY.txt =================================================================== RCS file: /cvsroot/docstring/dps/HISTORY.txt,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** HISTORY.txt 2001/11/09 23:13:48 1.27 --- HISTORY.txt 2001/11/13 03:07:53 1.28 *************** *** 86,92 **** - Added StateMachine.nextlineblank(). - Added 'nestedSM' and 'nestedSMkwargs' to State. ! - Added 'uptoblank' optional argument to 'getindented', ! 'getknownindented', and 'getfirstknownindented' methods of ! StateWS, and to 'extractindented' function. * dps/urischemes.py: Known URI schemes; added to project. --- 86,92 ---- - Added StateMachine.nextlineblank(). - Added 'nestedSM' and 'nestedSMkwargs' to State. ! - Added 'uptoblank' and 'stripindent' optional arguments to ! 'getindented', 'getknownindented', and 'getfirstknownindented' ! methods of StateWS, and to 'extractindented' function. * dps/urischemes.py: Known URI schemes; added to project. |
From: David G. <go...@us...> - 2001-11-13 03:07:11
|
Update of /cvsroot/docstring/dps/dps In directory usw-pr-cvs1:/tmp/cvs-serv12903/dps/dps Modified Files: statemachine.py Log Message: - Added 'stripindent' optional argument to 'getindented', 'getknownindented', and 'getfirstknownindented' methods of StateWS, and to 'extractindented' function. Index: statemachine.py =================================================================== RCS file: /cvsroot/docstring/dps/dps/statemachine.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** statemachine.py 2001/09/17 03:56:25 1.10 --- statemachine.py 2001/11/13 03:07:09 1.11 *************** *** 722,741 **** return context, '', [] # neither blank line nor indented ! def getindented(self, uptoblank=0): """ Return a indented lines of text and info. Extract an indented block where the indent is unknown for all lines. - Stop extracting at the first blank line If `uptoblank` is set to - true (1). Return: ! - the indented block (a list of lines of text), ! - its indent, ! - its first line offset from BOF, and ! - whether or not it finished with a blank line. """ offset = self.abslineoffset() indented, indent, blankfinish = extractindented( ! self.inputlines[self.lineoffset:], uptoblank) if indented: self.nextline(len(indented) - 1) # advance to last indented line --- 722,744 ---- return context, '', [] # neither blank line nor indented ! def getindented(self, uptoblank=0, stripindent=1): """ Return a indented lines of text and info. Extract an indented block where the indent is unknown for all lines. ! :Parameters: ! - `uptoblank`: Stop collecting at the first blank line if true (1). ! - `stripindent`: Strip common leading indent if true (1, default). ! ! :Return: ! - the indented block (a list of lines of text), ! - its indent, ! - its first line offset from BOF, and ! - whether or not it finished with a blank line. """ offset = self.abslineoffset() indented, indent, blankfinish = extractindented( ! self.inputlines[self.lineoffset:], uptoblank, stripindent) if indented: self.nextline(len(indented) - 1) # advance to last indented line *************** *** 747,767 **** return indented, indent, offset, blankfinish ! def getknownindented(self, indent, uptoblank=0): """ Return an indented block and info. Extract an indented block where the indent is known for all lines. - Stop extracting at the first blank line If `uptoblank` is set to - true (1). Return: - - - the indented block, - - its first line offset from BOF, and - - whether or not it finished with a blank line. - Starting with the current line, extract the entire text block with at ! least `indent` indentation. Strip off `indent` indentation (which must ! be whitespace, except for the first line) from each line. ! Parameter `indent`: the number of indent columns/characters. """ offset = self.abslineoffset() --- 750,772 ---- return indented, indent, offset, blankfinish ! def getknownindented(self, indent, uptoblank=0, stripindent=1): """ Return an indented block and info. Extract an indented block where the indent is known for all lines. Starting with the current line, extract the entire text block with at ! least `indent` indentation (which must be whitespace, except for the ! first line). ! :Parameters: ! - `indent`: The number of indent columns/characters. ! - `uptoblank`: Stop collecting at the first blank line if true (1). ! - `stripindent`: Strip `indent` characters of indentation if true ! (1, default). ! ! :Return: ! - the indented block, ! - its first line offset from BOF, and ! - whether or not it finished with a blank line. """ offset = self.abslineoffset() *************** *** 774,778 **** blankfinish = 1 break ! indented.append(line[indent:]) else: blankfinish = 1 --- 779,786 ---- blankfinish = 1 break ! if stripindent: ! indented.append(line[indent:]) ! else: ! indented.append(line) else: blankfinish = 1 *************** *** 786,808 **** return indented, offset, blankfinish ! def getfirstknownindented(self, indent, uptoblank=0): """ Return an indented block and info. Extract an indented block where the indent is known for the first line ! and unknown for all other lines. Stop extracting at the first blank ! line If `uptoblank` is set to true (1). Return: ! - the indented block, ! - its indent, ! - its first line offset from BOF, and ! - whether or not it finished with a blank line. ! Parameter `indent`: the first line's indent (# of columns/characters). """ offset = self.abslineoffset() indented = [self.line[indent:]] indented[1:], indent, blankfinish = extractindented( ! self.inputlines[self.lineoffset + 1:], uptoblank) self.nextline(len(indented) - 1) # advance to last indented line while indented and not indented[-1].strip(): --- 794,820 ---- return indented, offset, blankfinish ! def getfirstknownindented(self, indent, uptoblank=0, stripindent=1): """ Return an indented block and info. Extract an indented block where the indent is known for the first line ! and unknown for all other lines. ! :Parameters: ! - `indent`: The first line's indent (# of columns/characters). ! - `uptoblank`: Stop collecting at the first blank line if true (1). ! - `stripindent`: Strip `indent` characters of indentation if true ! (1, default). ! :Return: ! - the indented block, ! - its indent, ! - its first line offset from BOF, and ! - whether or not it finished with a blank line. """ offset = self.abslineoffset() indented = [self.line[indent:]] indented[1:], indent, blankfinish = extractindented( ! self.inputlines[self.lineoffset + 1:], uptoblank, stripindent) self.nextline(len(indented) - 1) # advance to last indented line while indented and not indented[-1].strip(): *************** *** 990,1013 **** return [s.expandtabs(tabwidth) for s in astring.splitlines()] ! def extractindented(lines, uptoblank=0): """ Extract and return a list of indented lines of text. ! Given a list of one-line strings without newlines (`lines`), collect all ! lines with indentation, determine the minimum indentation, remove the ! minimum indentation from all indented lines, and return them. All lines up ! to but not including the first unindented line will be returned. Stop ! collecting at the first blank line If `uptoblank` is set to true (1) :Parameters: ! ! - `lines`: . :Return: ! ! - a list of indented lines with mininum indent removed; ! - the amount of the indent; ! - whether or not the block finished with a blank line or at the end of ! `lines`. """ source = [] --- 1002,1024 ---- return [s.expandtabs(tabwidth) for s in astring.splitlines()] ! def extractindented(lines, uptoblank=0, stripindent=1): """ Extract and return a list of indented lines of text. ! Collect all lines with indentation, determine the minimum indentation, ! remove the minimum indentation from all indented lines (unless ! `stripindent` is false), and return them. All lines up to but not ! including the first unindented line will be returned. :Parameters: ! - `lines`: a list of one-line strings without newlines. ! - `uptoblank`: Stop collecting at the first blank line if true (1). ! - `stripindent`: Strip common leading indent if true (1, default). :Return: ! - a list of indented lines with mininum indent removed; ! - the amount of the indent; ! - whether or not the block finished with a blank line or at the end of ! `lines`. """ source = [] *************** *** 1033,1037 **** blankfinish = 1 # block ends at end of lines if indent: ! return [s[indent:] for s in source], indent, blankfinish else: return [], 0, blankfinish --- 1044,1050 ---- blankfinish = 1 # block ends at end of lines if indent: ! if stripindent: ! source = [s[indent:] for s in source] ! return source, indent, blankfinish else: return [], 0, blankfinish |
From: David G. <go...@us...> - 2001-11-09 23:13:51
|
Update of /cvsroot/docstring/dps In directory usw-pr-cvs1:/tmp/cvs-serv4426/dps Modified Files: HISTORY.txt Log Message: updated Index: HISTORY.txt =================================================================== RCS file: /cvsroot/docstring/dps/HISTORY.txt,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** HISTORY.txt 2001/11/06 02:10:08 1.26 --- HISTORY.txt 2001/11/09 23:13:48 1.27 *************** *** 71,74 **** --- 71,75 ---- - Added "hint", "substitution", "substitution_reference" classes. - Added element hierarchy base classes. + - Changed 'directive' to a TextElement. * dps/roman.py: Added to project. Written by and courtesy of Mark *************** *** 168,171 **** --- 169,175 ---- - Clarified 'figure' content. - Added 'substitution' and 'substitution_reference'. + - Changed content model 'directive' to PCDATA. + - Changed content models of most inline elements to %text.model, + allowing nested inline elements. * spec/pdpi.dtd: |
From: David G. <go...@us...> - 2001-11-09 23:13:25
|
Update of /cvsroot/docstring/dps/dps In directory usw-pr-cvs1:/tmp/cvs-serv4242/dps/dps Modified Files: nodes.py Log Message: - Changed 'directive' to a TextElement. Index: nodes.py =================================================================== RCS file: /cvsroot/docstring/dps/dps/nodes.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** nodes.py 2001/11/06 02:09:44 1.17 --- nodes.py 2001/11/09 23:13:22 1.18 *************** *** 555,559 **** class warning(Admonition, Element): pass class comment(Special, TextElement): pass ! class directive(Special, Element): pass class substitution(Special, TextElement): pass class target(Special, Inline, TextElement): pass --- 555,559 ---- class warning(Admonition, Element): pass class comment(Special, TextElement): pass ! class directive(Special, TextElement): pass class substitution(Special, TextElement): pass class target(Special, Inline, TextElement): pass |
From: David G. <go...@us...> - 2001-11-09 23:10:39
|
Update of /cvsroot/docstring/dps/spec In directory usw-pr-cvs1:/tmp/cvs-serv3303/dps/spec Modified Files: gpdi.dtd Log Message: - Changed content model 'directive' to PCDATA. - Changed content models of most inline elements to %text.model, allowing nested inline elements. Index: gpdi.dtd =================================================================== RCS file: /cvsroot/docstring/dps/spec/gpdi.dtd,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** gpdi.dtd 2001/11/06 01:05:33 1.22 --- gpdi.dtd 2001/11/09 23:10:37 1.23 *************** *** 362,367 **** <!ATTLIST label %basic.atts;> ! <!-- Also an inline element; empty otherwise. --> ! <!ELEMENT target (#PCDATA)> <!ATTLIST target %basic.atts; --- 362,367 ---- <!ATTLIST label %basic.atts;> ! <!-- Empty except when used as an inline element. --> ! <!ELEMENT target (%text.model;)> <!ATTLIST target %basic.atts; *************** *** 372,378 **** <!ATTLIST substitution %basic.atts;> ! <!ELEMENT directive (%body.elements;)*> <!ATTLIST directive %basic.atts; type CDATA #IMPLIED data CDATA #IMPLIED> --- 372,379 ---- <!ATTLIST substitution %basic.atts;> ! <!ELEMENT directive (#PCDATA)*> <!ATTLIST directive %basic.atts; + %fixedspace.att; type CDATA #IMPLIED data CDATA #IMPLIED> *************** *** 419,432 **** ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ! Inline elements occur within the PCDATA of body elements. --> ! <!ELEMENT emphasis (#PCDATA)> <!ATTLIST emphasis %basic.atts;> ! <!ELEMENT strong (#PCDATA)> <!ATTLIST strong %basic.atts;> ! <!ELEMENT interpreted (#PCDATA)> <!ATTLIST interpreted %basic.atts; --- 420,442 ---- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ! Inline elements occur within the text contents of body elements. Some ! nesting of inline elements is allowed by these definitions, with the ! following caveats: ! ! - An inline element may not contain a nested element of the same type ! (e.g. <strong> may not contain another <strong>). ! - Nested inline elements may or may not be supported by individual ! applications using this DTD. ! - The inline elements <footnote_reference>, <literal>, and <image> do ! not support nesting. --> ! <!ELEMENT emphasis (%text.model;)> <!ATTLIST emphasis %basic.atts;> ! <!ELEMENT strong (%text.model;)> <!ATTLIST strong %basic.atts;> ! <!ELEMENT interpreted (%text.model;)> <!ATTLIST interpreted %basic.atts; *************** *** 448,452 **** %auto.att;> ! <!ELEMENT substitution_reference (#PCDATA)> <!ATTLIST substitution_reference %basic.atts; --- 458,462 ---- %auto.att;> ! <!ELEMENT substitution_reference (%text.model;)> <!ATTLIST substitution_reference %basic.atts; |