docstring-checkins Mailing List for Docstring Processing System (Page 8)
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-02-12 02:19:32
|
Update of /cvsroot/docstring/dps/dps/readers In directory usw-pr-cvs1:/tmp/cvs-serv31475/dps/dps/readers Modified Files: __init__.py Log Message: rearranged logic Index: __init__.py =================================================================== RCS file: /cvsroot/docstring/dps/dps/readers/__init__.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** __init__.py 7 Feb 2002 01:59:51 -0000 1.2 --- __init__.py 12 Feb 2002 02:19:27 -0000 1.3 *************** *** 60,76 **** self.source = source self.parser = parser ! self.scan(self.source) # may modify self.parser, ! # depending on input ! self.parse(self.parser) self.transform() return self.document ! def scan(self, source): ! """Override to read `self.input` from `source`.""" raise NotImplementedError('subclass must override this method') def scanfile(self, source): """ ! Scan a single file, store data in `self.input`. Parameter `source` may be: --- 60,75 ---- self.source = source self.parser = parser ! self.scan() # may modify self.parser, depending on input ! self.parse() self.transform() return self.document ! def scan(self): ! """Override to read `self.input` from `self.source`.""" raise NotImplementedError('subclass must override this method') def scanfile(self, source): """ ! Scan a single file and return the raw data. Parameter `source` may be: *************** *** 81,94 **** """ if hasattr(source, 'read'): ! self.input = source.read() ! elif self.source: ! self.input = open(source).read() ! else: ! self.input = sys.stdin.read() ! def parse(self, parser): """Parse `self.input` into a document tree.""" self.document = self.newdocument() ! parser.parse(self.input, self.document) def transform(self): --- 80,92 ---- """ if hasattr(source, 'read'): ! return source.read() ! if self.source: ! return open(source).read() ! return sys.stdin.read() ! def parse(self): """Parse `self.input` into a document tree.""" self.document = self.newdocument() ! self.parser.parse(self.input, self.document) def transform(self): |
From: David G. <go...@us...> - 2002-02-12 02:18:01
|
Update of /cvsroot/docstring/dps/dps/transforms In directory usw-pr-cvs1:/tmp/cvs-serv31109/dps/dps/transforms Modified Files: frontmatter.py Log Message: refactored a bit Index: frontmatter.py =================================================================== RCS file: /cvsroot/docstring/dps/dps/transforms/frontmatter.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** frontmatter.py 6 Feb 2002 02:51:57 -0000 1.3 --- frontmatter.py 12 Feb 2002 02:17:56 -0000 1.4 *************** *** 110,148 **** def promote_document_title(self): ! doctree = self.doctree ! index = doctree.findnonclass((nodes.comment, nodes.system_warning)) ! if self.check_promotion_candidate(index): ! candidate = doctree[index] ! else: return None ! doctree.attributes.update(candidate.attributes) ! doctree[:] = candidate[:1] + doctree[:index] + candidate[1:] return 1 def promote_document_subtitle(self): ! doctree = self.doctree ! # Check for a lone second-level section. ! index = doctree.findnonclass((nodes.comment, nodes.system_warning, ! nodes.title)) # skip the new title ! if self.check_promotion_candidate(index): ! candidate = doctree[index] ! else: return None - # Create a subtitle element based on the title element: subtitle = nodes.subtitle() ! subtitle.attributes.update(candidate[0].attributes) ! subtitle[:] = candidate[0][:] ! # Put the subtitle element into the doctree ! doctree[:] = doctree[:1] + [subtitle] + doctree[1:index] + candidate[1:] return 1 ! def check_promotion_candidate(self, index): """ ! Return 1 iff the index'th child of node should be promoted. """ ! if index is None or len(self.doctree) > (index + 1) or \ ! not isinstance(self.doctree[index], nodes.section): ! return None ! return 1 --- 110,155 ---- def promote_document_title(self): ! section, index = self.candidate_index() ! if index is None: return None ! doctree = self.doctree ! # Transfer the section's attributes to the document element (at root): ! doctree.attributes.update(section.attributes) ! doctree[:] = (section[:1] # section title ! + doctree[:index] # everything that was in the document ! # before the section ! + section[1:]) # everything that was in the section return 1 def promote_document_subtitle(self): ! subsection, index = self.candidate_index() ! if index is None: return None subtitle = nodes.subtitle() ! # Transfer the subsection's attributes to the new subtitle: ! subtitle.attributes.update(subsection.attributes) ! # Transfer the contents of the subsection's title to the subtitle: ! subtitle[:] = subsection[0][:] ! doctree = self.doctree ! doctree[:] = (doctree[:1] # document title ! + [subtitle] ! + doctree[1:index] # everything that was in the document ! # before the section ! + subsection[1:]) # everything that was in the subsection return 1 ! def candidate_index(self): """ ! Find and return the promotion candidate and its index. ! ! Return (None, None) if no valid candidate was found. """ ! doctree = self.doctree ! index = doctree.findnonclass(nodes.PreBibliographic) ! if index is None or len(doctree) > (index + 1) or \ ! not isinstance(doctree[index], nodes.section): ! return None, None ! else: ! return doctree[index], index *************** *** 223,233 **** def process_docinfo(self): doctree = self.doctree ! index = doctree.findnonclass((nodes.title, nodes.subtitle, ! nodes.comment, nodes.system_warning)) if index is None: return candidate = doctree[index] if isinstance(candidate, nodes.field_list): ! biblioindex = doctree.findnonclass((nodes.title, nodes.subtitle)) nodelist, remainder = self.extract_bibliographic(candidate) if remainder: --- 230,239 ---- def process_docinfo(self): doctree = self.doctree ! index = doctree.findnonclass(nodes.PreBibliographic) if index is None: return candidate = doctree[index] if isinstance(candidate, nodes.field_list): ! biblioindex = doctree.findnonclass(nodes.Titular) nodelist, remainder = self.extract_bibliographic(candidate) if remainder: |
From: David G. <go...@us...> - 2002-02-12 02:16:30
|
Update of /cvsroot/docstring/dps/dps In directory usw-pr-cvs1:/tmp/cvs-serv30612/dps/dps Modified Files: utils.py Log Message: Factored ``extract_name_value`` out of ``extractattributes()``. Index: utils.py =================================================================== RCS file: /cvsroot/docstring/dps/dps/utils.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** utils.py 7 Feb 2002 02:00:45 -0000 1.13 --- utils.py 12 Feb 2002 02:16:27 -0000 1.14 *************** *** 199,235 **** '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 --- 199,246 ---- 'input line not enclosed in "[" and "]"') line = line[1:-1].strip() ! attlist += extract_name_value(line) ! return attlist ! ! def extract_name_value(line): ! """ ! Return a list of (name, value) from a line of the form "name=value ...". ! ! :Raises: `BadAttributeDataError` for invalid attribute data (missing name, ! missing data, bad quotes, etc.). ! """ ! attlist = [] ! while line: ! equals = line.find('=') ! if equals == -1: ! raise BadAttributeDataError('missing "="') ! attname = line[:equals].strip() ! if equals == 0 or not attname: ! raise BadAttributeDataError( ! 'missing attribute name before "="') ! line = line[equals+1:].lstrip() ! 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 |
From: David G. <go...@us...> - 2002-02-12 02:13:54
|
Update of /cvsroot/docstring/dps/dps/writers In directory usw-pr-cvs1:/tmp/cvs-serv30040/dps/dps/writers Modified Files: pprint.py Log Message: rearranged & improved Index: pprint.py =================================================================== RCS file: /cvsroot/docstring/dps/dps/writers/pprint.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pprint.py 7 Feb 2002 01:58:44 -0000 1.2 --- pprint.py 12 Feb 2002 02:13:51 -0000 1.3 *************** *** 21,28 **** class Writer(writers.Writer): ! def transform(self): ! pass ! def record(self, document, destination): ! output = document.pformat() ! self.recordfile(output, destination) --- 21,30 ---- class Writer(writers.Writer): ! output = None ! """Final translated form of `document`.""" ! def translate(self): ! self.output = self.document.pformat() ! ! def record(self): ! self.recordfile(self.output, self.destination) |
From: David G. <go...@us...> - 2002-02-12 02:13:41
|
Update of /cvsroot/docstring/dps/dps/writers In directory usw-pr-cvs1:/tmp/cvs-serv29995/dps/dps/writers Modified Files: __init__.py Log Message: rearranged & improved Index: __init__.py =================================================================== RCS file: /cvsroot/docstring/dps/dps/writers/__init__.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** __init__.py 7 Feb 2002 01:58:29 -0000 1.2 --- __init__.py 12 Feb 2002 02:13:38 -0000 1.3 *************** *** 27,41 **** """ def write(self, document, destination): self.document = document self.destination = destination self.transform() ! self.record(self.document, self.destination) def transform(self): ! """Override to run document tree transforms.""" raise NotImplementedError('subclass must override this method') ! def record(self, document, destination): """Override to record `document` to `destination`.""" raise NotImplementedError('subclass must override this method') --- 27,63 ---- """ + document = None + """The document to write.""" + + destination = None + """Where to write the document.""" + + transforms = () + """Ordered list of transform classes (each with a ``transform()`` method). + Populated by subclasses. `Writer.transform()` instantiates & runs them.""" + + def __init__(self): + """Initialize the Writer instance.""" + + self.transforms = list(self.transforms) + """Instance copy of `Writer.transforms`; may be modified by client.""" + def write(self, document, destination): self.document = document self.destination = destination self.transform() ! self.translate() ! self.record() def transform(self): ! """Run all of the transforms defined for this Writer.""" ! for xclass in self.transforms: ! xclass().transform(self.document) ! ! def translate(self): ! """Override to do final document tree translation.""" raise NotImplementedError('subclass must override this method') ! def record(self): """Override to record `document` to `destination`.""" raise NotImplementedError('subclass must override this method') *************** *** 59,63 **** else: sys.stdout.write(output) - pass --- 81,84 ---- |
From: David G. <go...@us...> - 2002-02-12 02:11:03
|
Update of /cvsroot/docstring/dps/test/test_transforms In directory usw-pr-cvs1:/tmp/cvs-serv29231/dps/test/test_transforms Modified Files: test_doctitle.py Log Message: updated; removed a lot of useless tests Index: test_doctitle.py =================================================================== RCS file: /cvsroot/docstring/dps/test/test_transforms/test_doctitle.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_doctitle.py 6 Feb 2002 03:10:48 -0000 1.3 --- test_doctitle.py 12 Feb 2002 02:11:00 -0000 1.4 *************** *** 77,96 **** """], ["""\ ! Test unexpected section title. ! Title ! ===== ! Paragraph. """, """\ ! <document> <paragraph> ! Test unexpected section title. ! <block_quote> ! <system_warning level="4" type="SEVERE"> ! <paragraph> ! Unexpected section title at line 4. ! <paragraph> ! Paragraph. """], ["""\ --- 77,96 ---- """], ["""\ ! Title ! ===== ! Subtitle ! -------- ! ! Test title & subtitle. """, """\ ! <document name="title"> ! <title> ! Title ! <subtitle name="subtitle"> ! Subtitle <paragraph> ! Test title & subtitle. """], ["""\ *************** *** 111,170 **** """], ["""\ - ===== - 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="4" type="SEVERE"> - <paragraph> - Missing underline for overline at line 1. - <paragraph> - Paragraph. - """], - ["""\ - ======= - Title - - Test missing underline, with paragraph. - """, - """\ - <document> - <system_warning level="4" type="SEVERE"> - <paragraph> - Missing underline for overline at line 1. - <paragraph> - Test missing underline, with paragraph. - """], - ["""\ ======= Long Title --- 111,114 ---- *************** *** 172,175 **** --- 116,121 ---- Test long title and space normalization. + The system_warning should move after the document title + (it was before the beginning of the section). """, """\ *************** *** 182,339 **** <paragraph> Test long title and space normalization. """], ["""\ ! ======= ! Title ! ------- ! ! Paragraph. ! """, ! """\ ! <document> ! <system_warning level="4" type="SEVERE"> ! <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 --- 128,136 ---- <paragraph> Test long title and space normalization. + The system_warning should move after the document title + (it was before the beginning of the section). """], ["""\ ! .. Test multiple second-level titles. Title 1 *************** *** 346,421 **** 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="4" type="SEVERE"> - <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> --- 143,162 ---- Title 3 ------- Paragraph 3. """, """\ ! <document name="title 1"> ! <title> ! Title 1 ! <comment> ! Test multiple second-level titles. <paragraph> ! Paragraph 1. ! <section name="title 2"> <title> ! Title 2 <paragraph> ! Paragraph 2. <section name="title 3"> <title> *************** *** 423,435 **** <paragraph> Paragraph 3. - <system_warning level="4" type="SEVERE"> - <paragraph> - Title level inconsistent at line 19: - <literal_block> - ``````` - Title 4 - ``````` - <paragraph> - Paragraph 4. """], ]) --- 164,167 ---- |
From: David G. <go...@us...> - 2002-02-07 02:03:33
|
Update of /cvsroot/docstring/dps/spec In directory usw-pr-cvs1:/tmp/cvs-serv9916/dps/spec Modified Files: dps-notes.txt Log Message: updated Index: dps-notes.txt =================================================================== RCS file: /cvsroot/docstring/dps/spec/dps-notes.txt,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** dps-notes.txt 2002/02/06 03:11:41 1.23 --- dps-notes.txt 2002/02/07 02:03:30 1.24 *************** *** 65,68 **** --- 65,78 ---- (SourceForge project registered & waiting.) + - Provide a mechanism to pass options to Readers, Writers, and Parsers + through dps.core.convert/Publisher? Or create custom + Reader/Writer/Parser objects first, and pass *them* to + convert/Publisher? + + - In reader.get_reader_class (& parser & writer too), should we be + importing 'standalone' or 'dps.readers.standalone'? (This would + avoid importing top-level modules if the module name is not in + dps/readers. Potential nastiness.) + Coding Conventions |
From: David G. <go...@us...> - 2002-02-07 02:03:06
|
Update of /cvsroot/docstring/dps/dps In directory usw-pr-cvs1:/tmp/cvs-serv9813/dps/dps Modified Files: __init__.py Log Message: updated Index: __init__.py =================================================================== RCS file: /cvsroot/docstring/dps/dps/__init__.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** __init__.py 2002/02/06 02:41:37 1.3 --- __init__.py 2002/02/07 02:03:01 1.4 *************** *** 17,21 **** - __init__.py: Contains the package docstring only (this text). ! - core.py: Contains the ``Publisher`` class and ``convert()`` function. - nodes.py: DPS document tree (doctree) node class library. --- 17,22 ---- - __init__.py: Contains the package docstring only (this text). ! - core.py: Contains the ``Publisher`` class and ``publish()`` convenience ! function. - nodes.py: DPS document tree (doctree) node class library. *************** *** 30,34 **** scheme names to descriptions. ! - utils.py: Miscellaneous utilities. Subpackages: --- 31,36 ---- scheme names to descriptions. ! - utils.py: Contains the ``Reporter`` system warning class and miscellaneous ! utilities. Subpackages: |
From: David G. <go...@us...> - 2002-02-07 02:02:27
|
Update of /cvsroot/docstring/dps/dps In directory usw-pr-cvs1:/tmp/cvs-serv9734/dps/dps Modified Files: core.py Log Message: Moved the ``Reporter`` instantiation even higher, up to the top of the chain. Index: core.py =================================================================== RCS file: /cvsroot/docstring/dps/dps/core.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** core.py 2002/02/06 03:02:51 1.1 --- core.py 2002/02/07 02:02:24 1.2 *************** *** 11,35 **** """ ! __docformat = 'reStructuredText' ! __all__ = ['Publisher', 'setup'] ! from dps import readers, parsers, writers class Publisher: ! def __init__(self, reader=None, parser=None, writer=None): self.reader = reader self.parser = parser self.writer = writer ! def setreader(self, readername, languagecode='en', warninglevel=2, ! errorlevel=4, warningstream=None, debug=0): """Set `self.reader` by name.""" readerclass = readers.get_reader_class(readername) ! self.reader = readerclass(languagecode, warninglevel, errorlevel, ! warningstream, debug) def setparser(self, parsername): --- 11,44 ---- """ ! __docformat__ = 'reStructuredText' ! __all__ = ['Publisher', 'publish'] ! import readers, parsers, writers, utils class Publisher: ! reporter = None ! """A `utils.Reporter` instance used for all document processing.""" ! ! def __init__(self, reader=None, parser=None, writer=None, reporter=None, ! languagecode='en', warninglevel=2, errorlevel=4, ! warningstream=None, debug=0): self.reader = reader self.parser = parser self.writer = writer + if not reporter: + reporter = utils.Reporter(warninglevel, errorlevel, warningstream, + debug) + self.reporter = reporter + self.languagecode = languagecode ! def setreader(self, readername, languagecode=None): """Set `self.reader` by name.""" readerclass = readers.get_reader_class(readername) ! self.reader = readerclass(self.reporter, ! languagecode or self.languagecode) def setparser(self, parsername): *************** *** 48,56 **** ! def convert(source=None, destination=None, reader=None, readername='standalone', parser=None, parsername='restructuredtext', ! writer=None, writername='pprint'): ! pub = Publisher(reader, parser, writer) if reader is None: pub.setreader(readername) --- 57,68 ---- ! def publish(source=None, destination=None, reader=None, readername='standalone', parser=None, parsername='restructuredtext', ! writer=None, writername='pprint', ! reporter=None, languagecode='en', ! warninglevel=2, errorlevel=4, warningstream=None, debug=0): ! pub = Publisher(reader, parser, writer, reporter, languagecode, ! warninglevel, errorlevel, warningstream, debug) if reader is None: pub.setreader(readername) |
From: David G. <go...@us...> - 2002-02-07 02:00:47
|
Update of /cvsroot/docstring/dps/dps In directory usw-pr-cvs1:/tmp/cvs-serv9321/dps/dps Modified Files: utils.py Log Message: docstrings Index: utils.py =================================================================== RCS file: /cvsroot/docstring/dps/dps/utils.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** utils.py 2002/02/06 02:53:53 1.12 --- utils.py 2002/02/07 02:00:45 1.13 *************** *** 24,30 **** """ ! The concept of "categories" was inspired by the log4j__ project. ! __ http://jakarta.apache.org/log4j/ """ --- 24,52 ---- """ ! Info/warning/error reporter and ``system_warning`` element generator. ! Five levels of system warnings are defined, along with corresponding ! methods: `debug()`, `info()`, `warning()`, `error()`, and `severe()`. ! ! There is typically one Reporter object per process. A Reporter object is ! instantiated with thresholds for generating warnings and errors (raising ! exceptions), a switch to turn debug output on or off, and a I/O stream for ! warnings. These are stored in the default reporting category, ''. ! ! Multiple reporting categories [#]_ may be set, each with its own warning ! and error thresholds, debugging switch, and warning stream. Categories are ! hierarchically-named strings that look like attribute references: 'spam', ! 'spam.eggs', 'neeeow.wum.ping'. The 'spam' category is the ancestor of ! 'spam.bacon.eggs'. Unset categories inherit stored values from their ! closest ancestor category that has been set. ! ! When a system warning is generated, the stored values from its category ! (or ancestor if unset) are retrieved. The system warning level is compared ! to the thresholds stored in the category, and a warning or error is ! generated as appropriate. Debug warnings are produced iff the stored debug ! switch is on. Warning output is sent to the stored warning stream. ! ! .. [#]_ The concept of "categories" was inspired by the log4j project: ! http://jakarta.apache.org/log4j/. """ *************** *** 35,41 **** """ Initialize the `Reporter`'s default logging category. ! Parameters: ! - `warninglevel`: The level at or above which warning output will be sent to `warningstream`. --- 57,63 ---- """ Initialize the `Reporter`'s default logging category. ! Parameters: ! - `warninglevel`: The level at or above which warning output will be sent to `warningstream`. *************** *** 49,55 **** if warningstream is None: warningstream = sys.stderr ! self.categories = {'': (debug, warninglevel, errorlevel, warningstream)} ! """Mapping of category names to levels. Default is ''.""" def setcategory(self, category, warninglevel, errorlevel, --- 71,77 ---- if warningstream is None: warningstream = sys.stderr ! self.categories = {'': (debug, warninglevel, errorlevel, warningstream)} ! """Mapping of category names to levels. Default category is ''.""" def setcategory(self, category, warninglevel, errorlevel, *************** *** 88,103 **** --- 110,147 ---- def debug(self, comment=None, children=[], category=''): + """ + Level-0, "DEBUG": an internal reporting issue. Typically, there is no + effect on the processing. Level-0 system warnings are handled + separately from the others. + """ return self.system_warning(0, comment, children, category) def info(self, comment=None, children=[], category=''): + """ + Level-1, "INFO": a minor issue that can be ignored. Typically there is + no effect on processing, and level-1 system warnings are not reported. + """ return self.system_warning(1, comment, children, category) def warning(self, comment=None, children=[], category=''): + """ + Level-2, "WARNING": an issue that should be addressed. If ignored, + there may be unpredictable problems with the output. + """ return self.system_warning(2, comment, children, category) def error(self, comment=None, children=[], category=''): + """ + Level-3, "ERROR": an error that should be addressed. If ignored, the + output will contain errors. + """ return self.system_warning(3, comment, children, category) def severe(self, comment=None, children=[], category=''): + """ + Level-4, "SEVERE": a severe error that must be addressed. If ignored, + the output will contain severe errors. Typically level-4 system + warnings are turned into exceptions which halt processing. + """ return self.system_warning(4, comment, children, category) *************** *** 115,119 **** :Parameters: - `lines`: List of one-line strings of the form:: ! ['[name1=value1 name2=value2]', '[name3="value 3"]'] --- 159,163 ---- :Parameters: - `lines`: List of one-line strings of the form:: ! ['[name1=value1 name2=value2]', '[name3="value 3"]'] |
From: David G. <go...@us...> - 2002-02-07 02:00:02
|
Update of /cvsroot/docstring/dps/dps/readers In directory usw-pr-cvs1:/tmp/cvs-serv9100/dps/dps/readers Modified Files: standalone.py Log Message: progress Index: standalone.py =================================================================== RCS file: /cvsroot/docstring/dps/dps/readers/standalone.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** standalone.py 2002/02/06 03:01:46 1.1 --- standalone.py 2002/02/07 01:59:59 1.2 *************** *** 30,50 **** """A single document tree.""" ! def scan(self): ! if self.source: ! self.input = open(self.source).read() ! else: ! self.input = sys.stdin.read() ! ! def parse(self, parser): ! self.document = self.newdocument() ! parser.parse(self.input, self.document) ! ! def transform(self): ! frontmatter.DocTitle().transform(self.document) ! frontmatter.DocInfo().transform(self.document) ! references.Hyperlinks().transform(self.document) ! references.Footnotes().transform(self.document) ! references.Substitutions().transform(self.document) ! def getdocument(self): ! return self.document --- 30,39 ---- """A single document tree.""" ! transforms = (frontmatter.DocTitle, ! frontmatter.DocInfo, ! references.Hyperlinks, ! references.Footnotes, ! references.Substitutions,) ! def scan(self, source): ! self.scanfile(source) |
From: David G. <go...@us...> - 2002-02-07 01:59:54
|
Update of /cvsroot/docstring/dps/dps/readers In directory usw-pr-cvs1:/tmp/cvs-serv9056/dps/dps/readers Modified Files: __init__.py Log Message: progress Index: __init__.py =================================================================== RCS file: /cvsroot/docstring/dps/dps/readers/__init__.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** __init__.py 2002/02/06 03:01:40 1.1 --- __init__.py 2002/02/07 01:59:51 1.2 *************** *** 16,19 **** --- 16,20 ---- + import sys from dps import nodes, utils *************** *** 28,33 **** """ ! def __init__(self, languagecode='en', warninglevel=2, errorlevel=4, ! warningstream=None, debug=0): """ Initialize the Reader instance. --- 29,37 ---- """ ! transforms = () ! """Ordered list of transform classes (each with a ``transform()`` method). ! Populated by subclasses. `Reader.transform()` instantiates & runs them.""" ! ! def __init__(self, reporter, languagecode): """ Initialize the Reader instance. *************** *** 40,45 **** """Default language for new documents.""" ! self.reporter = utils.Reporter(warninglevel, errorlevel, warningstream, ! debug) """A `utils.Reporter` instance shared by all doctrees.""" --- 44,48 ---- """Default language for new documents.""" ! self.reporter = reporter """A `utils.Reporter` instance shared by all doctrees.""" *************** *** 51,60 **** a collection of strings.""" def read(self, source, parser): self.source = source ! self.scan() ! self.parse(parser) # parser may vary depending on input self.transform() ! return self.getdocument() def scan(self, source): --- 54,68 ---- a collection of strings.""" + self.transforms = list(self.transforms) + """Instance copy of `Reader.transforms`; may be modified by client.""" + def read(self, source, parser): self.source = source ! self.parser = parser ! self.scan(self.source) # may modify self.parser, ! # depending on input ! self.parse(self.parser) self.transform() ! return self.document def scan(self, source): *************** *** 62,84 **** raise NotImplementedError('subclass must override this method') def parse(self, parser): ! """Override to parse `self.input` into one or more document trees.""" ! raise NotImplementedError('subclass must override this method') def transform(self): ! """Override to run document tree transforms.""" ! raise NotImplementedError('subclass must override this method') def newdocument(self, languagecode=None): """Create and return a new empty document tree (root node).""" ! if not languagecode: ! languagecode = self.languagecode ! document = nodes.document(languagecode=languagecode, ! reporter=self.reporter) return document _reader_aliases = {'rtxt': 'standalone', ! 'restructuredtext': 'standalone'} def get_reader_class(readername): --- 70,110 ---- raise NotImplementedError('subclass must override this method') + def scanfile(self, source): + """ + Scan a single file, store data in `self.input`. + + Parameter `source` may be: + + (a) a file-like object, which is read directly; + (b) a path to a file, which is opened and then read; or + (c) `None`, which implies `sys.stdin`. + """ + if hasattr(source, 'read'): + self.input = source.read() + elif self.source: + self.input = open(source).read() + else: + self.input = sys.stdin.read() + def parse(self, parser): ! """Parse `self.input` into a document tree.""" ! self.document = self.newdocument() ! parser.parse(self.input, self.document) def transform(self): ! """Run all of the transforms defined for this Reader.""" ! for xclass in self.transforms: ! xclass().transform(self.document) def newdocument(self, languagecode=None): """Create and return a new empty document tree (root node).""" ! document = nodes.document( ! languagecode=(languagecode or self.languagecode), ! reporter=self.reporter) return document _reader_aliases = {'rtxt': 'standalone', ! 'restructuredtext': 'standalone'} def get_reader_class(readername): |
From: David G. <go...@us...> - 2002-02-07 01:58:47
|
Update of /cvsroot/docstring/dps/dps/writers In directory usw-pr-cvs1:/tmp/cvs-serv8892/dps/dps/writers Modified Files: pprint.py Log Message: progress Index: pprint.py =================================================================== RCS file: /cvsroot/docstring/dps/dps/writers/pprint.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pprint.py 2002/02/06 02:56:47 1.1 --- pprint.py 2002/02/07 01:58:44 1.2 *************** *** 21,28 **** class Writer(writers.Writer): ! def write(self, document, destination): output = document.pformat() ! if destination: ! open(destination, 'w').write(output) ! else: ! print output --- 21,28 ---- class Writer(writers.Writer): ! def transform(self): ! pass ! ! def record(self, document, destination): output = document.pformat() ! self.recordfile(output, destination) |
From: David G. <go...@us...> - 2002-02-07 01:58:32
|
Update of /cvsroot/docstring/dps/dps/writers In directory usw-pr-cvs1:/tmp/cvs-serv8841/dps/dps/writers Modified Files: __init__.py Log Message: progress Index: __init__.py =================================================================== RCS file: /cvsroot/docstring/dps/dps/writers/__init__.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** __init__.py 2002/02/06 02:56:21 1.1 --- __init__.py 2002/02/07 01:58:29 1.2 *************** *** 16,19 **** --- 16,22 ---- + import sys + + class Writer: *************** *** 24,27 **** --- 27,62 ---- """ + def write(self, document, destination): + self.document = document + self.destination = destination + self.transform() + self.record(self.document, self.destination) + + def transform(self): + """Override to run document tree transforms.""" + raise NotImplementedError('subclass must override this method') + + def record(self, document, destination): + """Override to record `document` to `destination`.""" + raise NotImplementedError('subclass must override this method') + + def recordfile(self, output, destination): + """ + Write `output` to a single file. + + Parameters: + - `output`: Data to write. + - `destination`: one of: + + (a) a file-like object, which is written directly; + (b) a path to a file, which is opened and then written; or + (c) `None`, which implies `sys.stdout`. + """ + if hasattr(self.destination, 'write'): + destination.write(output) + elif self.destination: + open(self.destination, 'w').write(output) + else: + sys.stdout.write(output) pass |
From: David G. <go...@us...> - 2002-02-07 01:56:44
|
Update of /cvsroot/docstring/dps/spec In directory usw-pr-cvs1:/tmp/cvs-serv8484/dps/spec Modified Files: pep-0258.txt Log Message: minor Index: pep-0258.txt =================================================================== RCS file: /cvsroot/docstring/dps/spec/pep-0258.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** pep-0258.txt 2002/02/06 03:08:42 1.4 --- pep-0258.txt 2002/02/07 01:56:41 1.5 *************** *** 349,370 **** When the parser encounters an error in markup, it inserts a system ! warning (DTD element 'system_warning'). There are four levels of system warnings: ! - Level-0, "DEBUG": An internal reporting issue. There is no effect on the processing. Level-0 system warnings are handled separately from the others. ! - Level-1, "INFO": A minor issue that can be ignored. There is no effect on the processing. Typically level-1 system warnings are not reported. ! - Level-2, "WARNING": An issue that should be addressed. If ignored, there may be unpredictable problems with the output. ! - Level-3, "ERROR": An error that should be addressed. If ignored, the output will contain errors. ! - Level-4, "SEVERE": A severe error that must be addressed. Typically level-4 system warnings are turned into exceptions which halt processing. If ignored, the output will contain --- 349,370 ---- When the parser encounters an error in markup, it inserts a system ! warning (DTD element 'system_warning'). There are five levels of system warnings: ! - Level-0, "DEBUG": an internal reporting issue. There is no effect on the processing. Level-0 system warnings are handled separately from the others. ! - Level-1, "INFO": a minor issue that can be ignored. There is no effect on the processing. Typically level-1 system warnings are not reported. ! - Level-2, "WARNING": an issue that should be addressed. If ignored, there may be unpredictable problems with the output. ! - Level-3, "ERROR": an error that should be addressed. If ignored, the output will contain errors. ! - Level-4, "SEVERE": a severe error that must be addressed. Typically level-4 system warnings are turned into exceptions which halt processing. If ignored, the output will contain |
From: David G. <go...@us...> - 2002-02-06 03:11:44
|
Update of /cvsroot/docstring/dps/spec In directory usw-pr-cvs1:/tmp/cvs-serv12722/dps/spec Modified Files: dps-notes.txt Log Message: updated Index: dps-notes.txt =================================================================== RCS file: /cvsroot/docstring/dps/spec/dps-notes.txt,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** dps-notes.txt 2002/01/30 04:56:54 1.22 --- dps-notes.txt 2002/02/06 03:11:41 1.23 *************** *** 47,51 **** Doc-SIG post 'Suggestions for reST "modes"' as a base. ! - Write modules for common transforms. See Transforms_ below. - Ask Python-dev for opinions (GvR for a pronouncement) on special --- 47,52 ---- Doc-SIG post 'Suggestions for reST "modes"' as a base. ! - Write modules for common transforms. See `Unimplemented Transforms`_ ! below. - Ask Python-dev for opinions (GvR for a pronouncement) on special *************** *** 61,64 **** --- 62,68 ---- - Apply the `coding conventions`_ as given below. + - Merge reStructuredText into DPS and rename it to "docutils". + (SourceForge project registered & waiting.) + Coding Conventions *************** *** 86,91 **** ! Transforms ! ========== Footnote Gathering --- 90,95 ---- ! Unimplemented Transforms ! ======================== Footnote Gathering *************** *** 111,115 **** - duplicate reference and/or substitution names that need to be made ! unique; and - duplicate footnote numbers that need to be renumbered. --- 115,119 ---- - duplicate reference and/or substitution names that need to be made ! unique; and/or - duplicate footnote numbers that need to be renumbered. *************** *** 119,122 **** --- 123,143 ---- + Document Splitting + ------------------ + + If the processed document is written to multiple files (possibly in a + directory tree), it will need to be split up. References will have to + be adjusted. + + (HTML only? See Deployment_ below.) + + + Navigation + ---------- + + If a document is split up, each segment will need navigation links: + parent, children (small TOC), previous (preorder), next (preorder). + + Table of Contents ----------------- *************** *** 124,130 **** This runs over the entire tree, and locates <section> elements. It produces a <contents> subtree, which can be inserted at the ! appropriate place, with links to the <section>s. It needs to make sure ! that the links it uses are *real*, so ideally it will use the ! "implicit" link for a section when it exists, and it will have to invent one when the implicit link isn't there (presumably because the section is the twelfth "Introduction" in the document...). --- 145,151 ---- This runs over the entire tree, and locates <section> elements. It produces a <contents> subtree, which can be inserted at the ! appropriate place, with links to the <section> elements. It needs to ! make sure that the links it uses are *real*, so ideally it will use ! the "implicit" link for a section when it exists, and it will have to invent one when the implicit link isn't there (presumably because the section is the twelfth "Introduction" in the document...). *************** *** 171,205 **** ! Modes and Styles ! ================ ! The Python docstring mode model that's evolving in my mind goes ! something like this: ! 1. Extract the docstring/namespace tree from the module(s) and/or package(s). 2. Run the parser on each docstring in turn, producing a forest of trees (internal data structure as per nodes.py). ! 3. Run various transformations on the individual docstring trees. ! Examples: resolving cross-references; resolving hyperlinks; ! footnote auto-numbering; first field list -> bibliographic ! elements. ! 4. Join the docstring trees together into a single tree, running more ! transformations (such as creating various sections like "Module ! Attributes", "Functions", "Classes", "Class Attributes", etc.; see ! the DPS spec/ppdi.dtd). ! 5. Pass the resulting unified tree to the output formatter. I've had trouble reconciling the roles of input parser and output ! formatter with the idea of "modes". Does the mode govern the ! tranformation of the input, the output, or both? Perhaps the mode ! should be split into two. For example, say the source of our input is a Python module. Our ! "input mode" should be "Python Docstring Mode". It discovers (from ``__docformat__``) that the input parser is "reStructuredText". If we want HTML, we'll specify the "HTML" output formatter. But there's a --- 192,234 ---- ! Python Source Reader ! ==================== ! The Python Source Reader ("PySource") model that's evolving in my mind ! goes something like this: ! 1. Extract the docstring/namespace [#]_ tree from the module(s) and/or package(s). + .. [#] See `Docstring Extractor`_ above. + 2. Run the parser on each docstring in turn, producing a forest of trees (internal data structure as per nodes.py). ! 3. Join the docstring trees together into a single tree, running ! transforms: ! - merge hyperlinks ! - merge namespaces ! - create various sections like "Module Attributes", "Functions", ! "Classes", "Class Attributes", etc.; see the DPS spec/ppdi.dtd ! - convert the above special sections to ordinary DPS nodes ! 4. Run transforms on the combined doctree. Examples: resolving ! cross-references/hyperlinks (including interpreted text on Python ! identifiers); footnote auto-numbering; first field list -> ! bibliographic elements. + (Or should step 4's transforms come before step 3?) + + 5. Pass the resulting unified tree to the writer/builder. + I've had trouble reconciling the roles of input parser and output ! writer with the idea of modes ("readers" or "directors"). Does the ! mode govern the tranformation of the input, the output, or both? ! Perhaps the mode should be split into two. For example, say the source of our input is a Python module. Our ! "input mode" should be the "Python Source Reader". It discovers (from ``__docformat__``) that the input parser is "reStructuredText". If we want HTML, we'll specify the "HTML" output formatter. But there's a *************** *** 210,266 **** the input mode? Or can/should they be independent? ! I envision interaction between the input parser, an "input mode" ! (would control steps 1, 2, & 3), a "transformation style" (would ! control step 4), and the output formatter. The same intermediate data ! format would be used between each of these, gaining detail as it ! progresses. - This requires thought. ! Tony's contribution: ! OK - my model is not dissimilar, but goes like: ! ! 1. Parse the Python module(s) [remembering we may have a package] ! This locates the docstrings, amongst other things. ! ! 2. Trim the tree to lose stuff we didn't need (!). ! ! 3. Parse the docstrings (this might, instead, be done at the time ! that each docstring is "discovered"). ! ! 4. Integrate the docstring into the tree - this *may* be as simple ! as having "thing.docstring = <docstring instance>" ! ! 5. Perform internal resolutions on the docstring (footnotes, etc.) ! ! 6. Perform intra-module/package resolutions on the docstring ! (so this is when we work out that `Fred` in *this* docstring ! refers to class Fred over here in the datastructure). ! ! 7. Format. ! ... ! A mode needs to: ! ! 1. Provide plugins for parsing - this *may* go so far as to ! subsume the DPS functionality into a new program, as I'm doing ! for Python. In this case the "plugin" for parsing may be ! virtual - I just need to ferret around in the docstring looking ! for things that are already there, perhaps. ! ! 2. Provide plugins for formatting - again, these may subsume a ! DPS parser process. In the Python case, I clearly want to *use* ! the normal HTML parser for HTML output, but with extra support ! "around it" for the Python specific infrastructure. Visitors ======== ! To nodes.py, add ``Node.walkabout()``, ``Visitor.walkabout()``, ! ``Visitor.leave_*()``, and ``GenericVisitor.default_leave()`` methods ! to catch elements on the way out? Here's ``Node.walkabout()``:: def walkabout(self, visitor, ancestry=()): --- 239,439 ---- the input mode? Or can/should they be independent? ! I envision interaction between the input parser, an "input mode" , and ! the output formatter. The same intermediate data format would be used ! between each of these, being transformed as it progresses. ! Docutils Project Model ! ====================== ! Here's the latest project model:: ! 1,3,5 6,8 ! +--------+ +--------+ ! | READER | =======================> | WRITER | ! +--------+ (purely presentational) +--------+ ! // \ / \ ! // \ / \ ! 2 // 4 \ 7 / 9 \ ! +--------+ +------------+ +------------+ +--------------+ ! | PARSER |...| reader | | writer |...| deployment | ! +--------+ | transforms | | transforms | | | ! | | | | | - one file | ! | - docinfo | | - styling | | - many files | ! | - titles | | - writer- | | - objects in | ! | - linking | | specific | | memory | ! | - lookups | | - etc. | +--------------+ ! | - reader- | +------------+ ! | specific | ! | - parser- | ! | specific | ! | - layout | ! | - etc. | ! +------------+ ! The numbers indicate the path a document would take through the code. ! Double-width lines between reader & parser and between reader & ! writer, indicating that data sent along these paths should be standard ! (pure & unextended) DPS doc trees. Single-width lines signify that ! internal tree extensions are OK (but must be supported internally at ! both ends), and may in fact be totally unrelated to the DPS doc tree ! structure. I've added "reader-specific" and "layout" transforms to the ! list of transforms. BTW, these transforms are not necessarily all in ! one directory; it's a nebulous grouping (it's hard to draw ASCII ! clouds). ! ! ! Issues ! ------ ! ! - Naming. Use "director"/"builder" instead of "reader"/"writer"? Then ! "deployment" could be replaced by "writer". ! ! - Transforms. How to specify which transforms (and in what order) ! apply to each combination of reader, parser/syntax, writer, and ! deployment? Even if we restrict ourselves to one parser, there will ! eventually be a multitude of readers, writers, and deployment ! options. + Or are readers & writers independent? Then we have reader/parser and + writer/deployment combinations to consider. + + + Components + ---------- + + Parsers + ``````` + + Responsibilities: Given raw input text and an empty doctree, populate + the doctree by parsing the input text. + + + Readers + ``````` + + ("Readers" may be renamed to "Directors".) + + Most Readers will have to be told what parser to use. So far (see the + list of examples below), only the Python Source Reader (PySource) will + be able to determine the syntax on its own. + + Responsibilities: + + - Do raw input on the source. + - Pass the raw text to the parser, along with a fresh doctree. + - Combine and collate doctrees if necessary. + - Run transforms over the doctree(s). + + Examples: + + - Standalone/Raw/Plain: Just read a text file and process it. The + reader needs to be told which parser to use. Parser-specific + readers? + - Python Source: See `Python Source Reader`_ above. + - Email: RFC-822 headers, quoted excerpts, signatures, MIME parts. + - PEP: RFC-822 headers, "PEP xxxx" and "RFC xxxx" conversion to + URIs. Either interpret PEPs' indented sections or convert existing + PEPs to reStructuredText. + - Wiki: Global reference lookups of "wiki links" incorporated into + transforms. (CamelCase only or unrestricted?) Lazy indentation? + - Web Page: As standalone, but recognize meta fields as meta tags. + - FAQ: Structured "question & answer(s)" constructs. + - Compound document: Merge chapters into a book. Master TOC file? + + + Transforms + `````````` + + Responsibilities: + + - Modify a doctree in-place. + + Examples: + + - Already implemented: DocInfo, DocTitle (in frontmatter.py); + Hyperlinks, Footnotes, Substitutions (in references.py). + - Unimplemented: See `Unimplemented Transforms`_ above. + + + Writers + ``````` + + ("Writers" may be renamed to "Builders".) + + Responsibilities: + + - Transform doctree into specific output formats. + - Transform references into format-native forms. + + Examples: + + - XML: Various forms, such as DocBook. Also, raw doctree XML. + - HTML + - TeX + - Plain text + - reStructuredText? + + + Deployment + `````````` + + ("Deployment" may be renamed to "Writers" or "Publishers", and current + writer/deployment [renamed to builder/writer] components may change + places. After renaming, the model would look like this:: + + 1,3,5 6,8 + +--------+ +---------+ formerly + | READER | =======================> | BUILDER | writer + +--------+ (purely presentational) +---------+ + // \ / \ + // \ / \ + 2 // 4 \ 7 / 9 \ + +--------+ +------------+ +------------+ +--------+ + | PARSER |...| reader | | writer |...| WRITER | + +--------+ | transforms | | transforms | +--------+ + | ... | | ... | formerly + deployment + + After renaming *and* rearrangement, the model would look like this:: + + 1,3,5 6,8 + +--------+ +--------+ formerly + | READER | =======================> | WRITER | deployment + +--------+ (purely presentational) +--------+ + // \ / \ + // \ / \ + 2 // 4 \ 7 / 9 \ + +--------+ +------------+ +------------+ +---------+ + | PARSER |...| reader | | writer |...| BUILDER | + +--------+ | transforms | | transforms | +---------+ + | ... | | ... | formerly writer + + We'll wait and see which arrangement works out best. Is it better for + the writer/builder to control the deployment/writer, or vice versa? Or + should they be equals? + + Looking at the list of writers, it seems that only HTML would require + anything other than monolithic output. Perhaps merge the "deployment" + into the "writer"?) + + Responsibilities: + + - Do raw output to the destination. + - Transform references per incarnation. + + Examples: + - Single file + - Multiple files & directories + - Objects in memory + + Visitors ======== ! To nodes.py, add ``Node.walkabout()``, ``Visitor.leave_*()``, and ! ``GenericVisitor.default_leave()`` methods to catch elements on the ! way out? Here's ``Node.walkabout()``:: def walkabout(self, visitor, ancestry=()): *************** *** 286,294 **** method(self, ancestry) - Here's ``Visitor.walkabout()``:: - - def walkabout(self): - self.doctree.walkabout(self) - Mixing Automatic and Manual Footnote Numbering --- 459,462 ---- *************** *** 301,307 **** numbering; it would cause numbering and referencing conflicts. ! Would such mixing inevitably cause conflicts? We could probably work around ! potential conflicts with a decent algorithm. Should we? Requires thought. ! Opinions? [Tony] --- 469,475 ---- numbering; it would cause numbering and referencing conflicts. ! Would such mixing inevitably cause conflicts? We could probably work ! around potential conflicts with a decent algorithm. Should we? ! Requires thought. Opinions? [Tony] *************** *** 309,314 **** was in the category of "don't, in practice, care" so far as I was concerned. This is the same category I put the forbidding of nested ! inline markup - quite clearly one *can* do it, but equally clearly it's ! a pain to implement, and not a terribly great gain, all things considered. --- 477,482 ---- was in the category of "don't, in practice, care" so far as I was concerned. This is the same category I put the forbidding of nested ! inline markup - quite clearly one *can* do it, but equally clearly ! it's a pain to implement, and not a terribly great gain, all things considered. *************** *** 316,329 **** had some experience of people *using* reST in the wild". ! Thus, given there are lots of other things to do, I would tend to leave ! it as-is (especially if you are able to *warn* people about it if they ! do it by mistake). To my mind, being able to do ``[#thing]_`` probably give people enough ! precision over footnotes whils still allowing autonumbering - the *only* ! potential problem is when referring to a footnote in a different ! document (and that, again, is something I would leave fallow for the ! moment, although we know I tend to want to use roles as annotation for ! that sort of thing). --- 484,497 ---- had some experience of people *using* reST in the wild". ! Thus, given there are lots of other things to do, I would tend to ! leave it as-is (especially if you are able to *warn* people about it ! if they do it by mistake). To my mind, being able to do ``[#thing]_`` probably give people enough ! precision over footnotes whils still allowing autonumbering - the ! *only* potential problem is when referring to a footnote in a ! different document (and that, again, is something I would leave fallow ! for the moment, although we know I tend to want to use roles as ! annotation for that sort of thing). |
From: David G. <go...@us...> - 2002-02-06 03:11:37
|
Update of /cvsroot/docstring/dps/test In directory usw-pr-cvs1:/tmp/cvs-serv12603/dps/test Modified Files: test_utils.py Log Message: updated Index: test_utils.py =================================================================== RCS file: /cvsroot/docstring/dps/test/test_utils.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_utils.py 2001/11/15 02:58:43 1.2 --- test_utils.py 2002/02/06 03:11:35 1.3 *************** *** 11,15 **** """ ! import unittest, StringIO from DPSTestSupport import utils try: --- 11,15 ---- """ ! import unittest, StringIO, sys from DPSTestSupport import utils try: *************** *** 23,27 **** stream = StringIO.StringIO() ! reporter = utils.Reporter(1, 3, stream) def setUp(self): --- 23,27 ---- stream = StringIO.StringIO() ! reporter = utils.Reporter(2, 4, stream, 1) def setUp(self): *************** *** 30,36 **** def test_level0(self): ! sw = self.reporter.system_warning(0, 'a little reminder') self.assertEquals(sw.pformat(), """\ ! <system_warning level="0"> <paragraph> a little reminder --- 30,46 ---- def test_level0(self): ! sw = self.reporter.system_warning(0, 'debug output') self.assertEquals(sw.pformat(), """\ ! <system_warning level="0" type="DEBUG"> ! <paragraph> ! debug output ! """) ! self.assertEquals(self.stream.getvalue(), ! 'Reporter: DEBUG [level 0] debug output\n') ! ! def test_level1(self): ! sw = self.reporter.system_warning(1, 'a little reminder') ! self.assertEquals(sw.pformat(), """\ ! <system_warning level="1" type="INFO"> <paragraph> a little reminder *************** *** 38,65 **** self.assertEquals(self.stream.getvalue(), '') ! def test_level1(self): ! sw = self.reporter.system_warning(1, 'a warning') self.assertEquals(sw.pformat(), """\ ! <system_warning level="1"> <paragraph> a warning """) self.assertEquals(self.stream.getvalue(), ! 'Warning: [level 1] a warning\n') ! def test_level2(self): ! sw = self.reporter.system_warning(2, 'an error') self.assertEquals(sw.pformat(), """\ ! <system_warning level="2"> <paragraph> an error """) self.assertEquals(self.stream.getvalue(), ! 'Warning: [level 2] an error\n') ! def test_level3(self): ! self.assertRaises(utils.SystemWarning, self.reporter.system_warning, 3, 'a severe error, raises an exception') ! self.assertEquals(self.stream.getvalue(), '') --- 48,76 ---- self.assertEquals(self.stream.getvalue(), '') ! def test_level2(self): ! sw = self.reporter.system_warning(2, 'a warning') self.assertEquals(sw.pformat(), """\ ! <system_warning level="2" type="WARNING"> <paragraph> a warning """) self.assertEquals(self.stream.getvalue(), ! 'Reporter: WARNING [level 2] a warning\n') ! def test_level3(self): ! sw = self.reporter.system_warning(3, 'an error') self.assertEquals(sw.pformat(), """\ ! <system_warning level="3" type="ERROR"> <paragraph> an error """) self.assertEquals(self.stream.getvalue(), ! 'Reporter: ERROR [level 3] an error\n') ! def test_level4(self): ! self.assertRaises(utils.SystemWarning, self.reporter.system_warning, 4, 'a severe error, raises an exception') ! self.assertEquals(self.stream.getvalue(), 'Reporter: SEVERE [level 4] ' ! 'a severe error, raises an exception\n') *************** *** 67,71 **** stream = StringIO.StringIO() ! reporter = utils.Reporter(4, 4, stream) def setUp(self): --- 78,82 ---- stream = StringIO.StringIO() ! reporter = utils.Reporter(5, 5, stream, 0) def setUp(self): *************** *** 73,81 **** self.stream.truncate() ! def test_information(self): ! sw = self.reporter.information('an informational message') self.assertEquals(sw.pformat(), """\ ! <system_warning level="0"> <paragraph> an informational message """) --- 84,101 ---- self.stream.truncate() ! def test_debug(self): ! sw = self.reporter.debug('a debug message') self.assertEquals(sw.pformat(), """\ ! <system_warning level="0" type="DEBUG"> <paragraph> + a debug message + """) + self.assertEquals(self.stream.getvalue(), '') + + def test_info(self): + sw = self.reporter.info('an informational message') + self.assertEquals(sw.pformat(), """\ + <system_warning level="1" type="INFO"> + <paragraph> an informational message """) *************** *** 85,89 **** sw = self.reporter.warning('a warning') self.assertEquals(sw.pformat(), """\ ! <system_warning level="1"> <paragraph> a warning --- 105,109 ---- sw = self.reporter.warning('a warning') self.assertEquals(sw.pformat(), """\ ! <system_warning level="2" type="WARNING"> <paragraph> a warning *************** *** 94,98 **** sw = self.reporter.error('an error') self.assertEquals(sw.pformat(), """\ ! <system_warning level="2"> <paragraph> an error --- 114,118 ---- sw = self.reporter.error('an error') self.assertEquals(sw.pformat(), """\ ! <system_warning level="3" type="ERROR"> <paragraph> an error *************** *** 103,111 **** sw = self.reporter.severe('a severe error') self.assertEquals(sw.pformat(), """\ ! <system_warning level="3"> <paragraph> a severe error """) self.assertEquals(self.stream.getvalue(), '') --- 123,209 ---- sw = self.reporter.severe('a severe error') self.assertEquals(sw.pformat(), """\ ! <system_warning level="4" type="SEVERE"> <paragraph> a severe error """) self.assertEquals(self.stream.getvalue(), '') + + + class ReporterCategoryTests(unittest.TestCase): + + stream = StringIO.StringIO() + + def setUp(self): + self.stream.seek(0) + self.stream.truncate() + self.reporter = utils.Reporter(2, 4, self.stream, 1) + self.reporter.setcategory('lemon', 1, 3, self.stream, 0) + + def test_getset(self): + self.reporter.setcategory('test', 5, 5, None, 0) + self.assertEquals(self.reporter.getcategory('other'), + (1, 2, 4, self.stream)) + self.assertEquals(self.reporter.getcategory('test'), + (0, 5, 5, sys.stderr)) + self.assertEquals(self.reporter.getcategory('test.dummy'), + (0, 5, 5, sys.stderr)) + self.reporter.setcategory('test.dummy.spam', 1, 2, self.stream, 1) + self.assertEquals(self.reporter.getcategory('test.dummy.spam'), + (1, 1, 2, self.stream)) + self.assertEquals(self.reporter.getcategory('test.dummy'), + (0, 5, 5, sys.stderr)) + self.assertEquals(self.reporter.getcategory('test.dummy.spam.eggs'), + (1, 1, 2, self.stream)) + self.reporter.unsetcategory('test.dummy.spam') + self.assertEquals(self.reporter.getcategory('test.dummy.spam.eggs'), + (0, 5, 5, sys.stderr)) + + def test_debug(self): + sw = self.reporter.debug('debug output', category='lemon.curry') + self.assertEquals(self.stream.getvalue(), '') + sw = self.reporter.debug('debug output') + self.assertEquals(self.stream.getvalue(), + 'Reporter: DEBUG [level 0] debug output\n') + + def test_info(self): + sw = self.reporter.info('some info') + self.assertEquals(self.stream.getvalue(), '') + sw = self.reporter.info('some info', category='lemon.curry') + self.assertEquals( + self.stream.getvalue(), + 'Reporter "lemon.curry": INFO [level 1] some info\n') + + def test_warning(self): + sw = self.reporter.warning('a warning') + self.assertEquals(self.stream.getvalue(), + 'Reporter: WARNING [level 2] a warning\n') + sw = self.reporter.warning('a warning', category='lemon.curry') + self.assertEquals(self.stream.getvalue(), """\ + Reporter: WARNING [level 2] a warning + Reporter "lemon.curry": WARNING [level 2] a warning + """) + + def test_error(self): + sw = self.reporter.error('an error') + self.assertEquals(self.stream.getvalue(), + 'Reporter: ERROR [level 3] an error\n') + self.assertRaises(utils.SystemWarning, self.reporter.error, + 'an error', category='lemon.curry') + self.assertEquals(self.stream.getvalue(), """\ + Reporter: ERROR [level 3] an error + Reporter "lemon.curry": ERROR [level 3] an error + """) + + def test_severe(self): + self.assertRaises(utils.SystemWarning, self.reporter.severe, + 'a severe error') + self.assertEquals(self.stream.getvalue(), + 'Reporter: SEVERE [level 4] a severe error\n') + self.assertRaises(utils.SystemWarning, self.reporter.severe, + 'a severe error', category='lemon.curry') + self.assertEquals(self.stream.getvalue(), """\ + Reporter: SEVERE [level 4] a severe error + Reporter "lemon.curry": SEVERE [level 4] a severe error + """) |
From: David G. <go...@us...> - 2002-02-06 03:11:30
|
Update of /cvsroot/docstring/dps In directory usw-pr-cvs1:/tmp/cvs-serv12509/dps Modified Files: HISTORY.txt Log Message: updated Index: HISTORY.txt =================================================================== RCS file: /cvsroot/docstring/dps/HISTORY.txt,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** HISTORY.txt 2002/01/30 04:56:45 1.36 --- HISTORY.txt 2002/02/06 03:11:28 1.37 *************** *** 42,45 **** --- 42,47 ---- * dps/__init__.py: Added docstring. + * dps/core.py: Added to project. + * dps/nodes.py: *************** *** 74,78 **** - Added element hierarchy base classes. - Removed generic 'directive'. ! - 'errorhandler' -> 'reporter'. - Added document.languagecode. - Added Visitor classes & Node.walk(). --- 76,80 ---- - Added element hierarchy base classes. - Removed generic 'directive'. ! - 'errorhandler' -> 'reporter'. ``dps.utils.Reporter`` reform. - Added document.languagecode. - Added Visitor classes & Node.walk(). *************** *** 115,118 **** --- 117,121 ---- - Removed Reporter.strong_system_warning (not needed). - Improved error stream handling. + - Reworked ``Reporter`` based on "log4j". - Added some docstrings. - Added 'parseattributes()', associated functions and exceptions. *************** *** 122,125 **** --- 125,130 ---- * dps/test_*.py: Moved to new test/ directory. + * dps/readers: Subpackage added to project. + * dps/parsers/model.py: *************** *** 129,132 **** --- 134,139 ---- from project. + * dps/writers: Subpackage added to project. + * dps/languages/__init__.py: *************** *** 145,150 **** initial work. ! * dps/formatters: Removed subpackage from project. To be replaced by ! "writers" or "builders" subpackage. * test: Subdirectory added. The top-level consists of a modular test --- 152,157 ---- initial work. ! * dps/formatters: Removed subpackage from project. Replaced by ! "writers". * test: Subdirectory added. The top-level consists of a modular test *************** *** 168,172 **** - Clarifications due to Tony Ibbs. ! - Added names to system warnings. * spec/gdpi.dtd: --- 175,179 ---- - Clarifications due to Tony Ibbs. ! - Added names to system warnings, updated. * spec/gdpi.dtd: *************** *** 205,208 **** --- 212,216 ---- - Removed generic 'directive'. - Added 'problematic', inline relative of 'system_warning'. + - Added 'type' attribute to 'system_warning', removed 'warning'. * spec/pdpi.dtd: |
From: David G. <go...@us...> - 2002-02-06 03:11:28
|
Update of /cvsroot/docstring/dps/test/test_transforms In directory usw-pr-cvs1:/tmp/cvs-serv12466/dps/test/test_transforms Modified Files: test_substitutions.py Log Message: updated Index: test_substitutions.py =================================================================== RCS file: /cvsroot/docstring/dps/test/test_transforms/test_substitutions.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_substitutions.py 2002/01/30 04:43:23 1.2 --- test_substitutions.py 2002/02/06 03:11:25 1.3 *************** *** 21,25 **** def suite(): ! parser = Parser(debug=UnitTestFolder.debug) s = DPSTestSupport.TransformTestSuite(parser) s.generateTests(totest) --- 21,25 ---- def suite(): ! parser = Parser() s = DPSTestSupport.TransformTestSuite(parser) s.generateTests(totest) *************** *** 53,57 **** unknown substitution. ! <system_warning level="2"> <paragraph> Undefined substitution referenced: "unknown". --- 53,57 ---- unknown substitution. ! <system_warning level="3" type="ERROR"> <paragraph> Undefined substitution referenced: "unknown". |
From: David G. <go...@us...> - 2002-02-06 03:11:17
|
Update of /cvsroot/docstring/dps/test/test_transforms In directory usw-pr-cvs1:/tmp/cvs-serv11948/dps/test/test_transforms Modified Files: test_hyperlinks.py Log Message: updated Index: test_hyperlinks.py =================================================================== RCS file: /cvsroot/docstring/dps/test/test_transforms/test_hyperlinks.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_hyperlinks.py 2002/01/30 04:43:12 1.2 --- test_hyperlinks.py 2002/02/06 03:11:14 1.3 *************** *** 21,25 **** def suite(): ! parser = Parser(debug=UnitTestFolder.debug) s = DPSTestSupport.TransformTestSuite(parser) s.generateTests(totest) --- 21,25 ---- def suite(): ! parser = Parser() s = DPSTestSupport.TransformTestSuite(parser) s.generateTests(totest) *************** *** 214,218 **** <target name="external hyperlink" refuri="http://uri"> <target name="indirect target" refuri="http://uri"> ! <system_warning level="0"> <paragraph> External hyperlink target "indirect target" is not referenced. --- 214,218 ---- <target name="external hyperlink" refuri="http://uri"> <target name="indirect target" refuri="http://uri"> ! <system_warning level="1" type="INFO"> <paragraph> External hyperlink target "indirect target" is not referenced. *************** *** 327,331 **** 's (different URIs): <target dupname="target" refuri="first"> ! <system_warning level="1"> <paragraph> Duplicate explicit target name: "target" --- 327,331 ---- 's (different URIs): <target dupname="target" refuri="first"> ! <system_warning level="2" type="WARNING"> <paragraph> Duplicate explicit target name: "target" |
From: David G. <go...@us...> - 2002-02-06 03:11:04
|
Update of /cvsroot/docstring/dps/test/test_transforms In directory usw-pr-cvs1:/tmp/cvs-serv11716/dps/test/test_transforms Modified Files: test_footnotes.py Log Message: updated Index: test_footnotes.py =================================================================== RCS file: /cvsroot/docstring/dps/test/test_transforms/test_footnotes.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_footnotes.py 2002/01/30 04:43:05 1.3 --- test_footnotes.py 2002/02/06 03:11:01 1.4 *************** *** 21,25 **** def suite(): ! parser = Parser(debug=UnitTestFolder.debug) s = DPSTestSupport.TransformTestSuite(parser) s.generateTests(totest) --- 21,25 ---- def suite(): ! parser = Parser() s = DPSTestSupport.TransformTestSuite(parser) s.generateTests(totest) *************** *** 238,247 **** <label> 6 ! <system_warning level="1"> <paragraph> Duplicate explicit target name: "five" <paragraph> Auto-numbered footnote 5 again (duplicate). ! <system_warning level="2"> <paragraph> Too many autonumbered footnote references: only 2 corresponding footnotes available. --- 238,247 ---- <label> 6 ! <system_warning level="2" type="WARNING"> <paragraph> Duplicate explicit target name: "five" <paragraph> Auto-numbered footnote 5 again (duplicate). ! <system_warning level="3" type="ERROR"> <paragraph> Too many autonumbered footnote references: only 2 corresponding footnotes available. *************** *** 268,272 **** <paragraph> auto-numbered ! <system_warning level="1"> <paragraph> Duplicate explicit target name: "1" --- 268,272 ---- <paragraph> auto-numbered ! <system_warning level="2" type="WARNING"> <paragraph> Duplicate explicit target name: "1" |
From: David G. <go...@us...> - 2002-02-06 03:10:51
|
Update of /cvsroot/docstring/dps/test/test_transforms In directory usw-pr-cvs1:/tmp/cvs-serv11492/dps/test/test_transforms Modified Files: test_doctitle.py Log Message: updated Index: test_doctitle.py =================================================================== RCS file: /cvsroot/docstring/dps/test/test_transforms/test_doctitle.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_doctitle.py 2002/01/30 04:42:56 1.2 --- test_doctitle.py 2002/02/06 03:10:48 1.3 *************** *** 21,25 **** def suite(): ! parser = Parser(debug=UnitTestFolder.debug) s = DPSTestSupport.TransformTestSuite(parser) s.generateTests(totest) --- 21,25 ---- def suite(): ! parser = Parser() s = DPSTestSupport.TransformTestSuite(parser) s.generateTests(totest) *************** *** 88,92 **** Test unexpected section title. <block_quote> ! <system_warning level="3"> <paragraph> Unexpected section title at line 4. --- 88,92 ---- Test unexpected section title. <block_quote> ! <system_warning level="4" type="SEVERE"> <paragraph> Unexpected section title at line 4. *************** *** 104,108 **** <title> Title ! <system_warning level="0"> <paragraph> Title underline too short at line 2. --- 104,108 ---- <title> Title ! <system_warning level="1" type="INFO"> <paragraph> Title underline too short at line 2. *************** *** 146,150 **** """\ <document> ! <system_warning level="3"> <paragraph> Missing underline for overline at line 1. --- 146,150 ---- """\ <document> ! <system_warning level="4" type="SEVERE"> <paragraph> Missing underline for overline at line 1. *************** *** 160,164 **** """\ <document> ! <system_warning level="3"> <paragraph> Missing underline for overline at line 1. --- 160,164 ---- """\ <document> ! <system_warning level="4" type="SEVERE"> <paragraph> Missing underline for overline at line 1. *************** *** 177,181 **** <title> Long Title ! <system_warning level="0"> <paragraph> Title overline too short at line 1. --- 177,181 ---- <title> Long Title ! <system_warning level="1" type="INFO"> <paragraph> Title overline too short at line 1. *************** *** 192,196 **** """\ <document> ! <system_warning level="3"> <paragraph> Title overline & underline mismatch at line 1. --- 192,196 ---- """\ <document> ! <system_warning level="4" type="SEVERE"> <paragraph> Title overline & underline mismatch at line 1. *************** *** 372,376 **** <paragraph> Paragraph 3. ! <system_warning level="3"> <paragraph> Title level inconsistent at line 15: --- 372,376 ---- <paragraph> Paragraph 3. ! <system_warning level="4" type="SEVERE"> <paragraph> Title level inconsistent at line 15: *************** *** 423,427 **** <paragraph> Paragraph 3. ! <system_warning level="3"> <paragraph> Title level inconsistent at line 19: --- 423,427 ---- <paragraph> Paragraph 3. ! <system_warning level="4" type="SEVERE"> <paragraph> Title level inconsistent at line 19: |
From: David G. <go...@us...> - 2002-02-06 03:10:41
|
Update of /cvsroot/docstring/dps/test/test_transforms In directory usw-pr-cvs1:/tmp/cvs-serv11308/dps/test/test_transforms Modified Files: test_docinfo.py Log Message: updated Index: test_docinfo.py =================================================================== RCS file: /cvsroot/docstring/dps/test/test_transforms/test_docinfo.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_docinfo.py 2002/01/30 04:42:50 1.3 --- test_docinfo.py 2002/02/06 03:10:38 1.4 *************** *** 21,25 **** def suite(): ! parser = Parser(debug=UnitTestFolder.debug) s = DPSTestSupport.TransformTestSuite(parser) s.generateTests(totest) --- 21,25 ---- def suite(): ! parser = Parser() s = DPSTestSupport.TransformTestSuite(parser) s.generateTests(totest) *************** *** 103,107 **** <paragraph> Abstract 2 (should generate a warning). ! <system_warning level="2"> <paragraph> There can only be one abstract. --- 103,107 ---- <paragraph> Abstract 2 (should generate a warning). ! <system_warning level="2" type="WARNING"> <paragraph> There can only be one abstract. *************** *** 142,146 **** <paragraph> must be a paragraph ! <system_warning level="2"> <paragraph> Cannot extract bibliographic field "Author" containing anything other than a single paragraph. --- 142,146 ---- <paragraph> must be a paragraph ! <system_warning level="2" type="WARNING"> <paragraph> Cannot extract bibliographic field "Author" containing anything other than a single paragraph. *************** *** 153,157 **** <paragraph> paragraph. ! <system_warning level="2"> <paragraph> Cannot extract compound bibliographic field "Date". --- 153,157 ---- <paragraph> paragraph. ! <system_warning level="2" type="WARNING"> <paragraph> Cannot extract compound bibliographic field "Date". *************** *** 160,164 **** Version <field_body> ! <system_warning level="2"> <paragraph> Cannot extract empty bibliographic field "Version". --- 160,164 ---- Version <field_body> ! <system_warning level="2" type="WARNING"> <paragraph> Cannot extract empty bibliographic field "Version". *************** *** 239,243 **** Authors <field_body> ! <system_warning level="2"> <paragraph> Cannot extract empty bibliographic field "Authors". --- 239,243 ---- Authors <field_body> ! <system_warning level="2" type="WARNING"> <paragraph> Cannot extract empty bibliographic field "Authors". *************** *** 253,257 **** <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. --- 253,257 ---- <paragraph> Two ! <system_warning level="2" type="WARNING"> <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. *************** *** 263,267 **** <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. --- 263,267 ---- <list_item> <list_item> ! <system_warning level="2" type="WARNING"> <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. *************** *** 276,280 **** <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. --- 276,280 ---- <paragraph> Two ! <system_warning level="2" type="WARNING"> <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. *************** *** 289,293 **** <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. --- 289,293 ---- <paragraph> Two ! <system_warning level="2" type="WARNING"> <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. |
From: David G. <go...@us...> - 2002-02-06 03:10:15
|
Update of /cvsroot/docstring/dps/test In directory usw-pr-cvs1:/tmp/cvs-serv10933/dps/test Modified Files: DPSTestSupport.py Log Message: updated Index: DPSTestSupport.py =================================================================== RCS file: /cvsroot/docstring/dps/test/DPSTestSupport.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** DPSTestSupport.py 2002/01/30 04:47:11 1.4 --- DPSTestSupport.py 2002/02/06 03:10:12 1.5 *************** *** 223,227 **** if self.runInDebugger: pdb.set_trace() ! doctree = utils.newdocument(warninglevel=4, errorlevel=4) self.parser.parse(self.input, doctree) for transformClass in self.transforms: --- 223,228 ---- if self.runInDebugger: pdb.set_trace() ! doctree = utils.newdocument(warninglevel=5, errorlevel=5, ! debug=UnitTestFolder.debug) self.parser.parse(self.input, doctree) for transformClass in self.transforms: *************** *** 236,241 **** print '-' * 70 print self.input ! doctree = utils.newdocument( ! languagecode='en', warninglevel=4, errorlevel=4) self.parser.parse(self.input, doctree) print '-' * 70 --- 237,242 ---- print '-' * 70 print self.input ! doctree = utils.newdocument(warninglevel=5, errorlevel=5, ! debug=UnitTestFolder.debug) self.parser.parse(self.input, doctree) print '-' * 70 |
From: David G. <go...@us...> - 2002-02-06 03:08:45
|
Update of /cvsroot/docstring/dps/spec In directory usw-pr-cvs1:/tmp/cvs-serv9597/dps/spec Modified Files: pep-0258.txt Log Message: - Updated error handling. Index: pep-0258.txt =================================================================== RCS file: /cvsroot/docstring/dps/spec/pep-0258.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pep-0258.txt 2001/08/16 02:28:00 1.3 --- pep-0258.txt 2002/02/06 03:08:42 1.4 *************** *** 352,373 **** system warnings: ! - Level-0, "information": A minor issue that can be ignored. ! There is no effect on the processing. Typically level-0 system ! warnings are not reported. ! - Level-1, "warning": An issue that should be addressed. If ignored, there may be unpredictable problems with the output. ! - Level-2, "error": An error that should be addressed. If ignored, the output will contain errors. ! - Level-3, "severe": A severe error that must be addressed. ! Typically level-3 system warnings are turned into exceptions which halt processing. If ignored, the output will contain severe errors. ! Although the warning levels above were devised independently, they ! have a strong correspondence to VMS error condition severity ! levels [9]. The names in quotes were borrowed from VMS. --- 352,379 ---- system warnings: ! - Level-0, "DEBUG": An internal reporting issue. There is no ! effect on the processing. Level-0 system warnings are ! handled separately from the others. ! - Level-1, "INFO": A minor issue that can be ignored. There is no ! effect on the processing. Typically level-1 system warnings are ! not reported. ! ! - Level-2, "WARNING": An issue that should be addressed. If ignored, there may be unpredictable problems with the output. ! - Level-3, "ERROR": An error that should be addressed. If ignored, the output will contain errors. ! - Level-4, "SEVERE": A severe error that must be addressed. ! Typically level-4 system warnings are turned into exceptions which halt processing. If ignored, the output will contain severe errors. ! Although the initial warning levels were devised independently, ! they have a strong correspondence to VMS error condition severity ! levels [9]; the names in quotes for levels 1 through 4 were ! borrowed from VMS. Error handling has since been influenced by ! the log4j project [10]. *************** *** 396,401 **** 5841pro_027.html#error_cond_severity ! [10] http://www.python.org/sigs/doc-sig/ Project Web Site --- 402,409 ---- 5841pro_027.html#error_cond_severity ! [10] http://jakarta.apache.org/log4j/ + [11] http://www.python.org/sigs/doc-sig/ + Project Web Site *************** *** 413,417 **** This document borrows ideas from the archives of the Python ! Doc-SIG [10]. Thanks to all members past & present. --- 421,425 ---- This document borrows ideas from the archives of the Python ! Doc-SIG [11]. Thanks to all members past & present. |