docstring-checkins Mailing List for Docstring Processing System
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-04-21 15:40:42
|
Update of /cvsroot/docstring/web In directory usw-pr-cvs1:/tmp/cvs-serv32073/web Added Files: index.txt Log Message: project retirement --- NEW FILE: index.txt --- =============================== |Docstring Processing System| =============================== .. meta:: :http-equiv=Refresh: 15;URL=http://docutils.sourceforge.net/ :Date: $Date: 2002/04/21 15:40:39 $ The Docstring Processing System project has moved and been renamed! It is now called "Docutils_"; you should be redirected to the new location momentarily. `Click here to go to the Docutils project home page immediately.`__ You may also `visit the inactive Docstring Processing System home page`__. __ Docutils_ __ index-old.html .. _Docutils: http://docutils.sourceforge.net/ .. |Docstring Processing System| image:: title.png |
From: David G. <go...@us...> - 2002-04-21 15:40:29
|
Update of /cvsroot/docstring/web In directory usw-pr-cvs1:/tmp/cvs-serv31972/web Removed Files: index.html.template Log Message: project retirement --- index.html.template DELETED --- |
From: David G. <go...@us...> - 2002-04-21 15:40:19
|
Update of /cvsroot/docstring/web In directory usw-pr-cvs1:/tmp/cvs-serv31895/web Removed Files: index.html Log Message: project retirement --- index.html DELETED --- |
From: David G. <go...@us...> - 2002-04-21 15:40:09
|
Update of /cvsroot/docstring/web In directory usw-pr-cvs1:/tmp/cvs-serv31857/web Added Files: index-old.html.template Log Message: project retirement --- NEW FILE: index-old.html.template --- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!-- $Id: index-old.html.template,v 1.1 2002/04/21 15:40:06 goodger Exp $ --> # latest_dps_release = 'dps-0.4.tar.gz' # latest_rst_release = 'restructuredtext-0.4.tar.gz' <HTML> <HEAD> <TITLE>Python Docstring Processing System</TITLE> </HEAD> <BODY bgcolor="#F0F0FF"> <P><A HREF="http://sourceforge.net/projects/docstring/" ><IMG SRC="title.png" ALT="Docstring Processing System" BORDER=0 ALIGN=bottom></A></P> <P><FONT color="red">This project is now <B>inactive</B>. All development has been taken over by the <A HREF="http://docutils.sourceforge.het/">Docutils</A> project.</FONT></P> <P><I>last updated: `date`</I></P> <P>The purpose of the Python Docstring Processing System project is to create a standard, modular tool for extracting inline documentation from Python modules and converting it into useful formats, such as HTML, XML, and TeX.</P> <H2>Project Status</H2> <P>This project is now <B>inactive</B>. All development has been taken over by the <A HREF="http://docutils.sourceforge.het/">Docutils</A> project.</P> <P>This project consists of a Python package, “<TT>dps</TT>”. This contains utility modules and three subpackages, <TT>dps.parsers</TT>, <TT>dps.formatters</TT>, and <TT>dps.languages</TT>. Each of the subpackages will contain further modules or packages implementing individual components.</P> <P>Good progress is being made with regards to the parser interface. The <A HREF="dps/statemachine.py"><TT>dps.statemachine</TT></A> module is useful for line-based parsing of input text using regular expressions, and is being used by the <A HREF="http://structuredtext.sourceforge.net/" >reStructuredText</A> input parser.</P> <H3><A NAME="snapshots">CVS Snapshots</A></H3> <P>The final CVS snapshots are available below:</P> <UL> <LI><P><A HREF="http://docstring.sourceforge.net/dps-snapshot.tgz" >DPS code, tests, and specifications (no user docs yet)</A> Except for a few typos, this is equivalent to the final release package.</P></LI> <LI><P><A HREF="http://structuredtext.sourceforge.net/rst-snapshot.tgz" >reStructuredText code, tests, documentation, and specifications</A> Except for a few typos, this is equivalent to the final release package.</P></LI> <LI><P><A HREF="http://docstring.sourceforge.net/dps-web-snapshot.tgz" >DPS homepage files</A> </P></LI> </UL> <H3><A NAME="releases">Project Releases</A></H3> <P>Development has been suspended at this site. All new development is taking place at the <A HREF="http://docutils.sourceforge.net">Docutils</A> project.</P> <P>The <A HREF="http://prdownloads.sourceforge.net/docstring/`latest_dps_release`" >final project release package (`latest_dps_release`)</A> and past project releases can be downloaded from the <A HREF="http://sourceforge.net/project/showfiles.php?group_id=26626" >project files page</A>. The <A HREF="http://prdownloads.sourceforge.net/structuredtext/`latest_rst_release`" >final reStructuredText package (`latest_rst_release`)</A> is also required. <A HREF="http://sourceforge.net/cvs/?group_id=26626">Anonymous CVS access is available.</A> You can also <A HREF="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/~checkout~/docstring/dps/" >browse the latest source files (CVS) individually</A>, and read the final <A HREF="README.html" >README</A> and <A HREF="HISTORY.html" >HISTORY</A> files.</P> <H2>Specification</H2> <P>The specification consists of: candidate PEPs (<A HREF="http://www.python.org/peps/">Python Enhancement Proposals</A>), XML DTDs (document type definitions), an XML catalog file, and some notes. All of the specification files are located in the <TT>spec</TT> directory of the <A HREF="http://prdownloads.sourceforge.net/docstring/`latest_dps_release`">latest project release package (`latest_dps_release`)</A> (which may not be up to date). The up-to-date working documents (from CVS) may be accessed individually below, or from the <A HREF="#snapshots">snapshots</A> above. You can also <A HREF="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/~checkout~/docstring/dps/spec/" >browse the CVS repository</A> directly.</P> <UL> <LI><P><A HREF="spec/pep-0256.txt"> PEP 256: Docstring Processing System Framework</A> <BR>[<A HREF="http://www.python.org/peps/pep-0256.html" >PEP 256 in master repository</A>]<A HREF="#master">*</A> </P></LI> <LI><P><A HREF="spec/pep-0257.txt"> PEP 257: Docstring Conventions</A> <BR>[<A HREF="http://www.python.org/peps/pep-0257.html" >PEP 257 in master repository</A>]<A HREF="#master">*</A> </P></LI> <LI><P><A HREF="spec/pep-0258.txt"> PEP 258: DPS Generic Implementation Details</A> <BR>[<A HREF="http://www.python.org/peps/pep-0258.html" >PEP 258 in master repository</A>]<A HREF="#master">*</A> </P></LI> <LI><P><A HREF="spec/python-docstring-mode.txt"> Python Docstring Mode</A> </P></LI> <LI><P><A HREF="spec/gpdi.dtd"> Generic Plaintext Document Interface DTD</A> </P></LI> <LI><P><A HREF="spec/ppdi.dtd"> Python Plaintext Document Interface DTD</A> </P></LI> <LI><P><A HREF="spec/soextblx.dtd"> OASIS XML Exchange Table Model Declaration Module</A> </P></LI> <LI><P><A HREF="spec/dps.cat"> Python Docstring Processing System Catalog Data</A> </P></LI> <LI><P><A HREF="spec/dps-notes.txt"> Notes</A> </P></LI> </UL> <P><A NAME="master">*</A> The PEP titles above are links to local working copies, possibly newer than the versions checked in to the <A HREF="http://www.python.org/peps/">master PEP repository</A>.</P> <H2>Components</H2> <UL> <LI><P>Input Context Readers:</P> <UL> <LI><P>For standalone input files: <A HREF="http://docstring.sourceforge.net/dps/readers/standalone.py" ><TT>dps.readers.standalone</TT></A> </P></LI> <LI><P>More to be implemented: Python Source, Email, PEP, Wiki, Web Page, FAQ. </P></LI> </UL> <LI><P>Parsers:</P> <UL> <LI><P> <A HREF="http://structuredtext.sourceforge.net/">reStructuredText</A> </P></LI> </UL> <P>There's room for competition! Survival of the fittest? Amicable coexistence? Evolution by cross-pollination? Put your ideas into practice!</P> </LI> <LI><P>Output Format Writers:</P> <UL> <LI><P>Raw XML (corresponding to the DTDs in the spec): built-in.</P></LI> <LI><P>Pretty-printed pseudo-XML: <A HREF="http://docstring.sourceforge.net/dps/writers/pprint.py" ><TT>dps.writers.pprint</TT></A>.</P></LI> <LI><P>HTML 4.01 (loose) for CSS-1 stylesheets: <A HREF="http://docstring.sourceforge.net/dps/writers/html.py" ><TT>dps.writers.html</TT></A>.</P></LI> <LI><P>More to be implemented: other forms of XML (DocBook etc.), HTML 3.2, TeX, plain text, maybe even reStructuredText. </P></LI> </UL> <P>Please help develop one!</P> </LI> <LI><P>Languages:</P> <UL> <LI><P>English: under development.</P></LI> </UL> <P>Parlez-vous français? Sprechen ze Deutsch? Nihongo hanasemasu ka? </P> </LI> </UL> <H2>DPS Wants You!</H2> <P>This project will only succeed through the combined efforts of many. We're looking for contributions of testing, ideas, code, bug reports, administration, tasty snacks, computer equipment, and large sums of money. If you're interested in participating, please <A HREF="mailto:go...@us...">contact the project administrator</A>.</P> <H2>Project Info</H2> <UL> <LI><P><A HREF="http://sourceforge.net/projects/docstring/" >Project Summary page</A>: <A HREF="http://sourceforge.net/tracker/?group_id=26626&atid=387775" >Bug reports</A>, <A HREF="http://sourceforge.net/tracker/?group_id=26626&atid=387777" >patches</A>, <A HREF="http://sourceforge.net/tracker/?group_id=26626&atid=387778" >feature requests</A>, <A HREF="http://sourceforge.net/mail/?group_id=26626" >mailing lists</A>, <A HREF="http://sourceforge.net/news/?group_id=26626" >news</A></P></LI> <LI><P><A HREF="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/~checkout~/docstring/dps/" >Docstring Processing System CVS repository</A></P></LI> <LI><P>Project administrator: <A HREF="mailto:go...@us...">David Goodger</A></P></LI> <LI><P>Please direct discussions to the <A HREF="http://www.python.org/sigs/doc-sig/">Python Documentation Special Interest Group (Doc-SIG)</A>: <A HREF="mailto:do...@py...">do...@py...</A></P></LI> <LI><P>Page generated using Alex Martelli's <A HREF="http://aspn.activestate.com/ASPN/Python/Cookbook/Recipe/52305"> YAPTU</A> (Yet Another Python Templating Utility)</P></LI> <LI><P>Powered by <A href="http://www.python.org/"> <IMG src="PyBanner016.png" ALIGN="top" ALT="Python" BORDER="0"></A> </P></LI> <LI><P>Hosted by <A href="http://sourceforge.net"> <IMG src="http://sourceforge.net/sflogo.php?group_id=26626" width="88" height="31" border="0" alt="SourceForge Logo" ALIGN="top"></A> </P></LI> </UL> </BODY> </HTML> |
From: David G. <go...@us...> - 2002-04-20 16:25:00
|
Update of /cvsroot/docstring/dps In directory usw-pr-cvs1:/tmp/cvs-serv10354/dps Modified Files: HISTORY.txt Log Message: quoted "__", looked like reference Index: HISTORY.txt =================================================================== RCS file: /cvsroot/docstring/dps/HISTORY.txt,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** HISTORY.txt 19 Apr 2002 01:45:12 -0000 1.53 --- HISTORY.txt 20 Apr 2002 16:24:57 -0000 1.54 *************** *** 6,10 **** :Contact: go...@us... :Date: $Date$ ! :Website: http://docstring.sourceforge.net/ --- 6,10 ---- :Contact: go...@us... :Date: $Date$ ! :Web-site: http://docstring.sourceforge.net/ *************** *** 57,61 **** - Fixed link bookkeeping. - Added docstrings. ! - Extended Element.__iadd__ (``+=``) to lists of nodes. - Duplicate hyperlink names -> dupname attribute. - Allow any DOM implementation from ``asdom()`` method. (I think.) --- 57,61 ---- - Fixed link bookkeeping. - Added docstrings. ! - Extended ``Element.__iadd__`` (``+=``) to lists of nodes. - Duplicate hyperlink names -> dupname attribute. - Allow any DOM implementation from ``asdom()`` method. (I think.) |
From: David G. <go...@us...> - 2002-04-19 03:05:11
|
Update of /cvsroot/docstring/dps In directory usw-pr-cvs1:/tmp/cvs-serv8289/dps Added Files: MANIFEST.in Log Message: for distutils --- NEW FILE: MANIFEST.in --- include *.txt include *.py recursive-include spec * recursive-include test * |
From: David G. <go...@us...> - 2002-04-19 02:36:53
|
Update of /cvsroot/docstring/dps/test In directory usw-pr-cvs1:/tmp/cvs-serv1226/dps/test Modified Files: DPSTestSupport.py Log Message: fixed import Index: DPSTestSupport.py =================================================================== RCS file: /cvsroot/docstring/dps/test/DPSTestSupport.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** DPSTestSupport.py 16 Mar 2002 06:11:58 -0000 1.9 --- DPSTestSupport.py 19 Apr 2002 02:36:49 -0000 1.10 *************** *** 25,33 **** import sys, os import unittest, difflib, inspect, os, sys - - # try to import the current working version if possible - sys.path.insert(0, os.pardir) # running in test framework dir? import dps # or restructuredtext on path? - from dps import statemachine, nodes, urischemes, utils, transforms from dps.transforms import universal --- 25,29 ---- |
From: David G. <go...@us...> - 2002-04-19 01:45:39
|
Update of /cvsroot/docstring/dps In directory usw-pr-cvs1:/tmp/cvs-serv24055/dps Modified Files: README.txt Log Message: updated Index: README.txt =================================================================== RCS file: /cvsroot/docstring/dps/README.txt,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** README.txt 18 Apr 2002 02:54:47 -0000 1.5 --- README.txt 19 Apr 2002 01:45:36 -0000 1.6 *************** *** 9,19 **** Thank you for downloading the Python Docstring Processing System ! project arhive. As this is a work in progress, please check the ! project web site for updated working files. The latest release ! archive is available at ! http://sourceforge.net/project/showfiles.php?group_id=26626. To run the code, Python 2.0 or later must already be installed. You ! can get Python from http://www.python.org/. --- 9,22 ---- Thank you for downloading the Python Docstring Processing System ! project arhive. Development has been transferred to the Docutils_ ! project. As this is a work in progress, please check the ! project web site for updated working files. To run the code, Python 2.0 or later must already be installed. You ! can get Python from http://www.python.org/. You will also need the ! latest reStructuredText package, available from ! http://structuredtext.sourceforge.net/. ! ! .. _Docutils: http://docutils.sourceforge.net/ |
From: David G. <go...@us...> - 2002-04-19 01:45:15
|
Update of /cvsroot/docstring/dps In directory usw-pr-cvs1:/tmp/cvs-serv23983/dps Modified Files: HISTORY.txt Log Message: updated Index: HISTORY.txt =================================================================== RCS file: /cvsroot/docstring/dps/HISTORY.txt,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** HISTORY.txt 18 Apr 2002 02:57:42 -0000 1.52 --- HISTORY.txt 19 Apr 2002 01:45:12 -0000 1.53 *************** *** 13,19 **** I would like to acknowledge the people who have made a direct impact ! on the Python Docstring Processing System project, knowingly or not, ! in terms of encouragement, suggestions, criticism, bug reports, code ! contributions, and related projects: David Ascher, Fred Drake, Jim Fulton, Peter Funk, Doug Hellmann, --- 13,19 ---- I would like to acknowledge the people who have made a direct impact ! on the Python Docstring Processing System (DPS) project, knowingly or ! not, in terms of encouragement, suggestions, criticism, bug reports, ! code contributions, and related projects: David Ascher, Fred Drake, Jim Fulton, Peter Funk, Doug Hellmann, *************** *** 30,42 **** ! Release 0.4? (pending) ======================== ! Updated docstrings for new field list syntax (bibliographic info). ! Changed contact email addresses. * install.py: Added to project. * setup.py: Modified for import by install.py. * dps/__init__.py: Added docstring. --- 30,49 ---- ! Release 0.4 (2002-04-18) ======================== ! This is the final release of DPS as an independent package. ! Development is being transferred to the Docutils_ project immediately. ! ! .. _Docutils: http://docutils.sourceforge.net/ ! ! General: updated docstrings for new field list syntax (bibliographic ! info); changed contact email addresses. * install.py: Added to project. * setup.py: Modified for import by install.py. + + * COPYING.txt: Added to project. * dps/__init__.py: Added docstring. |
From: David G. <go...@us...> - 2002-04-19 01:42:17
|
Update of /cvsroot/docstring/dps In directory usw-pr-cvs1:/tmp/cvs-serv23415/dps Added Files: COPYING.txt Log Message: copyright details --- NEW FILE: COPYING.txt --- ========================================= Copying The Docstring Processing System ========================================= :Author: David Goodger :Contact: go...@us... :Date: $Date: 2002/04/19 01:42:14 $ :Web-site: http://docstring.sourceforge.net/ Most of the files included in this project are in the public domain, and therefore have no license requirement and no restrictions on copying or usage. The two exceptions are: - dps/roman.py, copyright 2001 by Mark Pilgrim, licensed under the `Python 2.1.1 license`_. - test/difflib.py, copyright by the Python Software Foundation, licensed under the `Python 2.2 license`_. This file is included for compatibility with Python versions less than 2.2; if you have Python 2.2 or higher, difflib.py is not needed and may be removed. (It's only used to report test failures anyhow; it isn't installed anywhere. The included file is a pre-generator version of the difflib.py module included in Python 2.2.) (Disclaimer: I am not a lawyer.) The Python license is OSI-approved_ and GPL-compatible_. Although complicated by multiple owners and lots of legalese, it basically lets you copy, use, modify, and redistribute files as long as you keep the copyright attribution intact, note any changes you make, and don't use the owner's name in vain. .. _Python 2.1.1 license: http://www.python.org/2.1.1/license.html .. _Python 2.2 license: http://www.python.org/2.2/license.html .. _OSI-approved: http://opensource.org/licenses/ .. _GPL-compatible: http://www.gnu.org/philosophy/license-list.html |
From: David G. <go...@us...> - 2002-04-18 02:57:45
|
Update of /cvsroot/docstring/dps In directory usw-pr-cvs1:/tmp/cvs-serv16734/dps Modified Files: HISTORY.txt Log Message: updated Index: HISTORY.txt =================================================================== RCS file: /cvsroot/docstring/dps/HISTORY.txt,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** HISTORY.txt 13 Apr 2002 17:09:12 -0000 1.51 --- HISTORY.txt 18 Apr 2002 02:57:42 -0000 1.52 *************** *** 25,32 **** Yee, Moshe Zadka ! (I'm still waiting for contributions of tasty snacks, computer ! equipment, and cold hard cash. :-) Hopefully I haven't forgotten ! anyone or misspelled any names; apologies (and please let me know!) if ! I have. --- 25,31 ---- Yee, Moshe Zadka ! (I'm still waiting for contributions of computer equipment and cold ! hard cash :-).) Hopefully I haven't forgotten anyone or misspelled ! any names; apologies (and please let me know!) if I have. *************** *** 53,57 **** - Extended Element.__iadd__ (``+=``) to lists of nodes. - Duplicate hyperlink names -> dupname attribute. ! - Allow any DOM implementation from ``asdom()`` method. (I think.) - _Node's always true. - Changed .pprint() to .pformat(); removed endtags from output. --- 52,56 ---- - Extended Element.__iadd__ (``+=``) to lists of nodes. - Duplicate hyperlink names -> dupname attribute. ! - Allow any DOM implementation from ``asdom()`` method. (I think.) - _Node's always true. - Changed .pprint() to .pformat(); removed endtags from output. *************** *** 75,79 **** - Added element hierarchy base classes. - Removed generic 'directive'. ! - 'errorhandler' -> 'reporter'. ``dps.utils.Reporter`` reform. - Added document.languagecode. - Added Visitor classes, ``Node.walk()`` & ``Node.walkabout()``. --- 74,78 ---- - Added element hierarchy base classes. - Removed generic 'directive'. ! - 'errorhandler' -> 'reporter'. ``dps.utils.Reporter`` reform. - Added document.languagecode. - Added Visitor classes, ``Node.walk()`` & ``Node.walkabout()``. *************** *** 98,103 **** - Added "BackLinkable" mixin. ! * dps/roman.py: Added to project. Written by and courtesy of Mark ! Pilgrim. From http://diveintopython.org. * dps/statemachine.py (1.3): --- 97,102 ---- - Added "BackLinkable" mixin. ! * dps/roman.py: Added to project. Written by and courtesy of Mark ! Pilgrim. From http://diveintopython.org. * dps/statemachine.py (1.3): *************** *** 116,119 **** --- 115,119 ---- methods of StateMachineWS, and to 'extractindented' function. - Added 'atbof' and 'ateof' methods to StateMachine. + - Added support for 'TransitionCorrection' exception. * dps/urischemes.py: Known URI schemes; added to project. *************** *** 144,148 **** - Added setup_parse() so unoverridden parse() could raise a NotImplementedError. ! - Moved Parser class to __init__.py, with updates. Module removed from project. --- 144,148 ---- - Added setup_parse() so unoverridden parse() could raise a NotImplementedError. ! - Moved Parser class to __init__.py, with updates. Module removed from project. *************** *** 165,175 **** - Added label for table of contents title. ! * dps/transforms: Subpackage added. Thanks to Ueli Schlaepfer for the initial work. ! * dps/formatters: Removed subpackage from project. Replaced by "writers". ! * test: Subdirectory added. The top-level consists of a modular test framework begun by Garth Kidd. --- 165,175 ---- - Added label for table of contents title. ! * dps/transforms: Subpackage added. Thanks to Ueli Schlaepfer for the initial work. ! * dps/formatters: Removed subpackage from project. Replaced by "writers". ! * test: Subdirectory added. The top-level consists of a modular test framework begun by Garth Kidd. *************** *** 287,292 **** ======================== ! PEP numbers assigned 2001-06-06. PEPs first posted to comp.lang.python ! 2001-06-13. * spec/pep-0256.txt: --- 287,292 ---- ======================== ! PEP numbers assigned 2001-06-06. PEPs first posted to ! comp.lang.python 2001-06-13. * spec/pep-0256.txt: *************** *** 311,315 **** - Catch `EOFError` to end statemachine processing. - Relaxed State.initialtransitions contents: entries can be strings ! as well as tuples. (Also argument to State.maketransitions().) * dps/test_statemachine.py: Modified tests for statemachine.py --- 311,315 ---- - Catch `EOFError` to end statemachine processing. - Relaxed State.initialtransitions contents: entries can be strings ! as well as tuples. (Also argument to State.maketransitions().) * dps/test_statemachine.py: Modified tests for statemachine.py *************** *** 330,333 **** --- 330,334 ---- mode: indented-text indent-tabs-mode: nil + sentence-end-double-space: t fill-column: 70 End: |
From: David G. <go...@us...> - 2002-04-18 02:56:57
|
Update of /cvsroot/docstring/dps/dps In directory usw-pr-cvs1:/tmp/cvs-serv16546/dps/dps Modified Files: statemachine.py Log Message: - Added support for TransitionCorrection exception. Index: statemachine.py =================================================================== RCS file: /cvsroot/docstring/dps/dps/statemachine.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** statemachine.py 25 Jan 2002 23:58:36 -0000 1.13 --- statemachine.py 18 Apr 2002 02:56:54 -0000 1.14 *************** *** 28,31 **** --- 28,32 ---- - `TransitionMethodNotFound` - `UnexpectedIndentationError` + - `TransitionCorrection`: Raised to switch to another transition. Functions: *************** *** 105,115 **** __docformat__ = 'restructuredtext' - __all__ = ['StateMachine', 'StateMachineWS', 'SearchStateMachine', - 'SearchStateMachineWS', 'State', 'StateWS', - 'UnknownStateError', 'DuplicateStateError', - 'UnknownTransitionError', 'DuplicateTransitionError', - 'TransitionPatternNotFound', 'TransitionMethodNotFound', - 'UnexpectedIndentationError', 'string2lines', 'extractindented'] - import sys, re, string --- 106,109 ---- *************** *** 357,378 **** """ if self.debug: ! print >>sys.stderr, ('\nStateMachine.matchtransition: state "%s",' ! ' transitions "%s"' % ! (state.__class__.__name__, ! [t for t in state.transitionorder])) for name in state.transitionorder: ! pattern, method, nextstate = state.transitions[name] ! if self.debug: ! print >>sys.stderr, ('\nStateMachine.matchtransition: ' ! 'Trying transition "%s" in state "%s".' % ! (name, state.__class__.__name__)) ! match = self.match(pattern) ! if match: if self.debug: ! print >>sys.stderr, ('\nStateMachine.matchtransition: ' ! 'Matched transition "%s" in state ' ! '"%s".' % (name, ! state.__class__.__name__)) ! return method(match, context, nextstate) else: return context, None, [] # no match --- 351,378 ---- """ if self.debug: ! print >>sys.stderr, ( ! '\nStateMachine.matchtransition: state="%s", transitions=%r.' ! % (state.__class__.__name__, state.transitionorder)) for name in state.transitionorder: ! while 1: ! pattern, method, nextstate = state.transitions[name] if self.debug: ! print >>sys.stderr, ( ! '\nStateMachine.matchtransition: Trying transition ' ! '"%s" in state "%s".' ! % (name, state.__class__.__name__)) ! match = self.match(pattern) ! if match: ! if self.debug: ! print >>sys.stderr, ( ! '\nStateMachine.matchtransition: Matched ' ! 'transition "%s" in state "%s".' ! % (name, state.__class__.__name__)) ! try: ! return method(match, context, nextstate) ! except TransitionCorrection, detail: ! name = str(detail) ! continue # try again with new transition name ! break else: return context, None, [] # no match *************** *** 983,986 **** --- 983,993 ---- class TransitionMethodNotFound(Exception): pass class UnexpectedIndentationError(Exception): pass + + + class TransitionCorrection(Exception): + + """ + Raise from within a transition method to switch to another transition. + """ |
From: David G. <go...@us...> - 2002-04-18 02:55:01
|
Update of /cvsroot/docstring/dps/spec In directory usw-pr-cvs1:/tmp/cvs-serv16052/dps/spec Modified Files: dps-notes.txt Log Message: fixed whitespace & updated Index: dps-notes.txt =================================================================== RCS file: /cvsroot/docstring/dps/spec/dps-notes.txt,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** dps-notes.txt 13 Apr 2002 17:09:21 -0000 1.35 --- dps-notes.txt 18 Apr 2002 02:54:58 -0000 1.36 *************** *** 18,22 **** [Tibs:] Eventually we need to have direct documentation in there on how it all hangs together - the DTD is not enough ! (indeed, is it still meant to be correct? [Yes, it is.]). - Rework PEP 257, separating style from spec from tools, wrt DPS? See --- 18,22 ---- [Tibs:] Eventually we need to have direct documentation in there on how it all hangs together - the DTD is not enough ! (indeed, is it still meant to be correct? [Yes, it is.]). - Rework PEP 257, separating style from spec from tools, wrt DPS? See *************** *** 35,49 **** - Get cracking on the DPS itself! ! - Add layout component to framework? Or part of the formatter? ! - Add validation? See http://pytrex.sourceforge.net, RELAX NG. ! - Write modules for common transforms. See `Unimplemented Transforms`_ ! below. - Ask Python-dev for opinions (GvR for a pronouncement) on special variables (__author__, __version__, etc.): convenience vs. namespace ! pollution. Ask opinions on whether or not the DPS should recognize & ! use them. - Once doctree.txt is fleshed out, how about breaking (most of) it up --- 35,49 ---- - Get cracking on the DPS itself! ! - Add layout component to framework? Or part of the formatter? ! - Add validation? See http://pytrex.sourceforge.net, RELAX NG. ! - Write modules for common transforms. See `Unimplemented ! Transforms`_ below. - Ask Python-dev for opinions (GvR for a pronouncement) on special variables (__author__, __version__, etc.): convenience vs. namespace ! pollution. Ask opinions on whether or not the DPS should recognize ! & use them. - Once doctree.txt is fleshed out, how about breaking (most of) it up *************** *** 60,74 **** - Remove complex import code. - Rename gpdi.dtd to docutils.dtd. ! - Rename writers/html.py to html4_css1.py. With aliases? - Provide a mechanism to pass options to Readers, Writers, and Parsers ! through dps.core.publish/Publisher? Or create custom Reader/Writer/Parser objects first, and pass *them* to publish/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.) - Perhaps store a name->id mapping file? This could be stored --- 60,74 ---- - Remove complex import code. - Rename gpdi.dtd to docutils.dtd. ! - Rename writers/html.py to html4_css1.py. With aliases? - Provide a mechanism to pass options to Readers, Writers, and Parsers ! through dps.core.publish/Publisher? Or create custom Reader/Writer/Parser objects first, and pass *them* to publish/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.) - Perhaps store a name->id mapping file? This could be stored *************** *** 82,86 **** - Considerations for an HTML Writer [#]_: ! - Boolean attributes. ``<element boolean>`` is good, ``<element boolean="boolean">`` is bad. Use a special value in attribute mappings, such as ``None``? --- 82,86 ---- - Considerations for an HTML Writer [#]_: ! - Boolean attributes. ``<element boolean>`` is good, ``<element boolean="boolean">`` is bad. Use a special value in attribute mappings, such as ``None``? *************** *** 106,109 **** --- 106,112 ---- and substitutions for dynamic stuff. + - Improve the granularity of document parts in the HTML writer, so + that one could just grab the parts needed. + Coding Conventions *************** *** 114,118 **** PEPs, with the following clarifications: ! - 4 spaces per indentation level. No tabs. - No one-liner compound statements (i.e., no ``if x: return``: use two lines & indentation), except for degenerate class or method --- 117,121 ---- PEPs, with the following clarifications: ! - 4 spaces per indentation level. No tabs. - No one-liner compound statements (i.e., no ``if x: return``: use two lines & indentation), except for degenerate class or method *************** *** 121,126 **** - "CamelCase" shall be used for class names. - Use "lowercase" or "lowercase_with_underscores" for function, ! method, and variable names. For short names, maximum two joined ! words, use lowercase (e.g. 'tagname'). For long names with three or more joined words, or where it's hard to parse the split between two words, use lowercase_with_underscores (e.g., 'note_explicit_target', --- 124,129 ---- - "CamelCase" shall be used for class names. - Use "lowercase" or "lowercase_with_underscores" for function, ! method, and variable names. For short names, maximum two joined ! words, use lowercase (e.g. 'tagname'). For long names with three or more joined words, or where it's hard to parse the split between two words, use lowercase_with_underscores (e.g., 'note_explicit_target', *************** *** 160,164 **** Should this be done before or after reference-resolving transforms ! are applied? What about references from within one subdocument to inside another? --- 163,167 ---- Should this be done before or after reference-resolving transforms ! are applied? What about references from within one subdocument to inside another? *************** *** 168,175 **** 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 Distributors_ below.) --- 171,178 ---- 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 Distributors_ below.) *************** *** 211,215 **** - functions (+ formal parameters & defaults) ! (Extract comments too? For example, comments at the start of a module would be a good place for bibliographic field lists.) --- 214,218 ---- - functions (+ formal parameters & defaults) ! (Extract comments too? For example, comments at the start of a module would be a good place for bibliographic field lists.) *************** *** 254,273 **** 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 ! piece missing. What *kind* or *style* of HTML output do we want? ! PyDoc-style, LibRefMan style, etc. (many people will want to specify ! and control their own style). Is the output style specific to a ! particular output format (XML, HTML, etc.)? Is the style specific to ! 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. --- 257,276 ---- 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 ! piece missing. What *kind* or *style* of HTML output do we want? ! PyDoc-style, LibRefMan style, etc. (many people will want to specify ! and control their own style). Is the output style specific to a ! particular output format (XML, HTML, etc.)? Is the style specific to ! 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. |
From: David G. <go...@us...> - 2002-04-18 02:54:51
|
Update of /cvsroot/docstring/dps In directory usw-pr-cvs1:/tmp/cvs-serv16021/dps Modified Files: README.txt Log Message: fixed whitespace & updated Index: README.txt =================================================================== RCS file: /cvsroot/docstring/dps/README.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** README.txt 14 Apr 2002 19:40:54 -0000 1.4 --- README.txt 18 Apr 2002 02:54:47 -0000 1.5 *************** *** 9,18 **** Thank you for downloading the Python Docstring Processing System ! project arhive. As this is a work in progress, please check the ! project web site for updated working files. The latest release archive ! is available at http://sourceforge.net/project/showfiles.php?group_id=26626. ! To run the code, Python 2.0 or later must already be installed. You can get Python from http://www.python.org/. --- 9,18 ---- Thank you for downloading the Python Docstring Processing System ! project arhive. As this is a work in progress, please check the ! project web site for updated working files. The latest release ! archive is available at http://sourceforge.net/project/showfiles.php?group_id=26626. ! To run the code, Python 2.0 or later must already be installed. You can get Python from http://www.python.org/. *************** *** 26,30 **** releases. ! * setup.py: Installation script. See "Installation" below. * install.py: Quick & dirty installation script. --- 26,30 ---- releases. ! * setup.py: Installation script. See "Installation" below. * install.py: Quick & dirty installation script. *************** *** 32,36 **** * dps: The project source directory, installed as a Python package. ! * spec: The project specification directory. Contains PEPs (Python Enhancement Proposals) and XML DTDs (document type definitions) --- 32,36 ---- * dps: The project source directory, installed as a Python package. ! * spec: The project specification directory. Contains PEPs (Python Enhancement Proposals) and XML DTDs (document type definitions) *************** *** 39,45 **** ============ ! The first step is to expand the .tar.gz archive. It contains a ! distutils setup file "setup.py". OS-specific installation instructions ! follow. Linux, Unix, MacOS X --- 39,45 ---- ============ ! The first step is to expand the .tar.gz archive. It contains a ! distutils setup file "setup.py". OS-specific installation ! instructions follow. Linux, Unix, MacOS X *************** *** 57,62 **** If the python executable isn't on your path, you'll have to specify ! the complete path, such as /usr/local/bin/python. You may need root ! permissions to complete this step. You can also just run install.py; it does the same thing. --- 57,62 ---- If the python executable isn't on your path, you'll have to specify ! the complete path, such as /usr/local/bin/python. You may need ! root permissions to complete this step. You can also just run install.py; it does the same thing. *************** *** 89,102 **** If the file isn't a "Python module", the line endings are probably also wrong, and you will need to set up your system to recognize ! ".py" file extensions as Python files. See http://gotools.sourceforge.net/mac/python.html for detailed ! instructions. Once set up, it's easiest to start over by expanding the archive again. ! 3. The distutils options window will appear. From the "Command" popup list choose "install", click "Add", then click "OK". If install.py is a "Python module" (see step 2 above if it isn't), you ! can run it instead of the above. The distutils options window will not appear. --- 89,102 ---- If the file isn't a "Python module", the line endings are probably also wrong, and you will need to set up your system to recognize ! ".py" file extensions as Python files. See http://gotools.sourceforge.net/mac/python.html for detailed ! instructions. Once set up, it's easiest to start over by expanding the archive again. ! 3. The distutils options window will appear. From the "Command" popup list choose "install", click "Add", then click "OK". If install.py is a "Python module" (see step 2 above if it isn't), you ! can run it instead of the above. The distutils options window will not appear. *************** *** 106,122 **** The package modules are mostly in their infancy, continually growing ! and evolving. The module evolution is being driven by the reStructuredText parser project; see ! http://structuredtext.sourceforge.net. The dps.statemachine module is ! usable independently. It contains extensive inline documentation (in reStructuredText format). The specs, the package structure, and the skeleton modules may also be ! of interest to you. Contributions are welcome! ! Local Variables: ! mode: indented-text ! indent-tabs-mode: nil ! fill-column: 70 ! End: --- 106,124 ---- The package modules are mostly in their infancy, continually growing ! and evolving. The module evolution is being driven by the reStructuredText parser project; see ! http://structuredtext.sourceforge.net. The dps.statemachine module is ! usable independently. It contains extensive inline documentation (in reStructuredText format). The specs, the package structure, and the skeleton modules may also be ! of interest to you. Contributions are welcome! ! .. ! Local Variables: ! mode: indented-text ! indent-tabs-mode: nil ! sentence-end-double-space: t ! fill-column: 70 ! End: |
From: David G. <go...@us...> - 2002-04-18 02:54:08
|
Update of /cvsroot/docstring/dps In directory usw-pr-cvs1:/tmp/cvs-serv15824/dps Modified Files: setup.py Log Message: Version, copyright update Index: setup.py =================================================================== RCS file: /cvsroot/docstring/dps/setup.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** setup.py 6 Feb 2002 03:04:19 -0000 1.6 --- setup.py 18 Apr 2002 02:54:05 -0000 1.7 *************** *** 10,17 **** #long_description = '', url = 'http://docstring.sourceforge.net/', ! version = '0.3+', author = 'David Goodger', author_email = 'go...@us...', ! license = 'public domain', packages = ['dps', 'dps.readers', 'dps.parsers', 'dps.writers', 'dps.transforms', 'dps.languages']) --- 10,17 ---- #long_description = '', url = 'http://docstring.sourceforge.net/', ! version = '0.4', author = 'David Goodger', author_email = 'go...@us...', ! license = 'public domain, Python (see COPYING.txt)', packages = ['dps', 'dps.readers', 'dps.parsers', 'dps.writers', 'dps.transforms', 'dps.languages']) |
From: David G. <go...@us...> - 2002-04-18 02:53:55
|
Update of /cvsroot/docstring/dps/spec In directory usw-pr-cvs1:/tmp/cvs-serv15718/dps/spec Modified Files: pysource-reader.txt Log Message: fixed whitespace Index: pysource-reader.txt =================================================================== RCS file: /cvsroot/docstring/dps/spec/pysource-reader.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pysource-reader.txt 28 Mar 2002 04:33:05 -0000 1.2 --- pysource-reader.txt 18 Apr 2002 02:53:52 -0000 1.3 *************** *** 14,18 **** For definitive element hierarchy details, see the "Python Plaintext Document Interface DTD" XML document type definition, ppdi.dtd_ (which ! modifies the generic gpdi.dtd_). Descriptions below list 'DTD elements' (XML 'generic identifiers' or tag names) corresponding to syntax constructs. --- 14,18 ---- For definitive element hierarchy details, see the "Python Plaintext Document Interface DTD" XML document type definition, ppdi.dtd_ (which ! modifies the generic gpdi.dtd_). Descriptions below list 'DTD elements' (XML 'generic identifiers' or tag names) corresponding to syntax constructs. *************** *** 28,32 **** In Python docstrings, interpreted text is used to classify and mark up program identifiers, such as the names of variables, functions, ! classes, and modules. If the identifier alone is given, its role is inferred implicitly according to the Python namespace lookup rules. For functions and methods (even when dynamically assigned), --- 28,32 ---- In Python docstrings, interpreted text is used to classify and mark up program identifiers, such as the names of variables, functions, ! classes, and modules. If the identifier alone is given, its role is inferred implicitly according to the Python namespace lookup rules. For functions and methods (even when dynamically assigned), *************** *** 41,45 **** """ ! Extend `Storer`. Class attribute `instances` keeps track of the number of `Keeper` objects instantiated. """ --- 41,45 ---- """ ! Extend `Storer`. Class attribute `instances` keeps track of the number of `Keeper` objects instantiated. """ *************** *** 76,80 **** 'function', 'module_attribute', 'class_attribute', 'instance_attribute', 'variable', 'parameter', 'type', ! 'exception_class', 'exception', 'warning_class', or 'warning'. Other roles may be defined. --- 76,80 ---- 'function', 'module_attribute', 'class_attribute', 'instance_attribute', 'variable', 'parameter', 'type', ! 'exception_class', 'exception', 'warning_class', or 'warning'. Other roles may be defined. |
From: David G. <go...@us...> - 2002-04-18 02:53:45
|
Update of /cvsroot/docstring/dps/spec In directory usw-pr-cvs1:/tmp/cvs-serv15664/dps/spec Modified Files: pep-0258.txt Log Message: fixed whitespace Index: pep-0258.txt =================================================================== RCS file: /cvsroot/docstring/dps/spec/pep-0258.txt,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** pep-0258.txt 13 Apr 2002 17:00:21 -0000 1.9 --- pep-0258.txt 18 Apr 2002 02:53:42 -0000 1.10 *************** *** 183,188 **** specifies: ! A future statement must appear near the top of the module. The ! only lines that can appear before a future statement are: * the module docstring (if any), --- 183,188 ---- specifies: ! A future statement must appear near the top of the module. ! The only lines that can appear before a future statement are: * the module docstring (if any), *************** *** 315,320 **** 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? --- 315,320 ---- 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? *************** *** 324,339 **** - PEP: RFC-822 headers, "PEP xxxx" and "RFC xxxx" conversion to ! URIs. Either interpret PEPs' indented sections or convert existing ! PEPs to reStructuredText (or both?). - 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. ! Support for templates of some sort? (After <body>, before </body>?) - FAQ: Structured "question & answer(s)" constructs. ! - Compound document: Merge chapters into a book. Master TOC file? --- 324,341 ---- - PEP: RFC-822 headers, "PEP xxxx" and "RFC xxxx" conversion to ! URIs. Either interpret PEPs' indented sections or convert ! existing PEPs to reStructuredText (or both?). - 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. ! Support for templates of some sort? (After <body>, before ! </body>?) - FAQ: Structured "question & answer(s)" constructs. ! - Compound document: Merge chapters into a book. Master TOC file? *************** *** 407,411 **** Examples: ! - XML: Various forms, such as DocBook. Also, raw doctree XML. - HTML --- 409,413 ---- Examples: ! - XML: Various forms, such as DocBook. Also, raw doctree XML. - HTML |
From: David G. <go...@us...> - 2002-04-18 02:53:34
|
Update of /cvsroot/docstring/dps/spec In directory usw-pr-cvs1:/tmp/cvs-serv15639/dps/spec Modified Files: pep-0257.txt Log Message: fixed whitespace Index: pep-0257.txt =================================================================== RCS file: /cvsroot/docstring/dps/spec/pep-0257.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pep-0257.txt 28 Mar 2002 04:35:18 -0000 1.3 --- pep-0257.txt 18 Apr 2002 02:53:31 -0000 1.4 *************** *** 44,48 **** A docstring is a string literal that occurs as the first statement ! in a module, function, class, or method definition. Such a docstring becomes the __doc__ special attribute of that object. --- 44,48 ---- A docstring is a string literal that occurs as the first statement ! in a module, function, class, or method definition. Such a docstring becomes the __doc__ special attribute of that object. *************** *** 159,163 **** by the module, with a one-line summary of each. (These summaries generally give less detail than the summary line in the object's ! docstring.) The docstring for a package (i.e., the docstring of the package's __init__.py module) should also list the modules and subpackages exported by the package. --- 159,163 ---- by the module, with a one-line summary of each. (These summaries generally give less detail than the summary line in the object's ! docstring.) The docstring for a package (i.e., the docstring of the package's __init__.py module) should also list the modules and subpackages exported by the package. *************** *** 190,194 **** case sensitive and the argument names can be used for keyword arguments, so the docstring should document the correct argument ! names. It is best to list each argument on a separate line. For example:: --- 190,194 ---- case sensitive and the argument names can be used for keyword arguments, so the docstring should document the correct argument ! names. It is best to list each argument on a separate line. For example:: |
From: David G. <go...@us...> - 2002-04-18 02:53:24
|
Update of /cvsroot/docstring/dps/spec In directory usw-pr-cvs1:/tmp/cvs-serv15599/dps/spec Modified Files: doctree.txt Log Message: fixed whitespace Index: doctree.txt =================================================================== RCS file: /cvsroot/docstring/dps/spec/doctree.txt,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** doctree.txt 16 Mar 2002 06:11:11 -0000 1.8 --- doctree.txt 18 Apr 2002 02:53:21 -0000 1.9 *************** *** 8,23 **** This document describes the internal data structure representing ! document trees in the Python Docstring Processing System. The data structure is defined by the hierarchy of classes in the ``dps.nodes`` ! module. It is also formally described by the `Generic Plaintext Document Interface DTD`_ XML document type definition, gpdi.dtd_, which is the definitive source for element hierarchy details. Below is a simplified diagram of the hierarchy of element types in the ! DPS document tree structure. An element may contain any other elements ! immediately below it in the diagram. Note text is in square brackets. ! Element types in parentheses indicate recursive or one-to-many ! relationships; sections may contain (sub)sections, tables contain ! further body elements, etc. :: +--------------------------------------------------------------------+ --- 8,23 ---- This document describes the internal data structure representing ! document trees in the Python Docstring Processing System. The data structure is defined by the hierarchy of classes in the ``dps.nodes`` ! module. It is also formally described by the `Generic Plaintext Document Interface DTD`_ XML document type definition, gpdi.dtd_, which is the definitive source for element hierarchy details. Below is a simplified diagram of the hierarchy of element types in the ! DPS document tree structure. An element may contain any other ! elements immediately below it in the diagram. Note text is in square ! brackets. Element types in parentheses indicate recursive or ! one-to-many relationships; sections may contain (sub)sections, tables ! contain further body elements, etc. :: +--------------------------------------------------------------------+ *************** *** 43,49 **** A class hierarchy has been implemented in nodes.py where the position ! of the element (the level at which it can occur) is significant. E.G., ! Root, Structural, Body, Inline classes etc. Certain transformations ! will be easier because we can use isinstance() on them. The elements making up DPS document trees can be categorized into the --- 43,50 ---- A class hierarchy has been implemented in nodes.py where the position ! of the element (the level at which it can occur) is significant. ! E.G., Root, Structural, Body, Inline classes etc. Certain ! transformations will be easier because we can use isinstance() on ! them. The elements making up DPS document trees can be categorized into the *************** *** 201,205 **** ================ The ``%basic.atts;`` parameter entity lists attributes common to all ! elements. See `Common Attributes`_. --- 202,206 ---- ================ The ``%basic.atts;`` parameter entity lists attributes common to all ! elements. See `Common Attributes`_. *************** *** 238,242 **** Having added the "horizontal rule" construct to the reStructuredText_ spec, a decision had to be made as to how to reflect the construct in ! the implementation of the document tree. Given this source:: Document --- 239,243 ---- Having added the "horizontal rule" construct to the reStructuredText_ spec, a decision had to be made as to how to reflect the construct in ! the implementation of the document tree. Given this source:: Document *************** *** 250,254 **** The horizontal rule indicates a "transition" (in prose terms) or the ! start of a new "division". Before implementation, the parsed document tree would be:: --- 251,255 ---- The horizontal rule indicates a "transition" (in prose terms) or the ! start of a new "division". Before implementation, the parsed document tree would be:: *************** *** 263,272 **** Paragraph ! There are several possibilities for the implementation. Solution 3 was chosen. ! 1. Implement horizontal rules as "divisions" or segments. A "division" ! is a title-less, non-hierarchical section. The first try at an ! implementation looked like this:: <document> --- 264,273 ---- Paragraph ! There are several possibilities for the implementation. Solution 3 was chosen. ! 1. Implement horizontal rules as "divisions" or segments. A ! "division" is a title-less, non-hierarchical section. The first ! try at an implementation looked like this:: <document> *************** *** 281,287 **** But the two paragraphs are really at the same level; they shouldn't ! appear to be at different levels. There's really an invisible ! "first division". The horizontal rule splits the document body into ! two segments, which should be treated uniformly. 2. Treating "divisions" uniformly brings us to the second --- 282,288 ---- But the two paragraphs are really at the same level; they shouldn't ! appear to be at different levels. There's really an invisible ! "first division". The horizontal rule splits the document body ! into two segments, which should be treated uniformly. 2. Treating "divisions" uniformly brings us to the second *************** *** 300,308 **** With this change, documents and sections will directly contain ! divisions and sections, but not body elements. Only divisions will ! directly contain body elements. Even without a horizontal rule anywhere, the body elements of a document or section would be ! contained within a division element. This makes the document tree ! deeper. This is similar to the way HTML treats document contents: grouped within a <BODY> element. --- 301,309 ---- With this change, documents and sections will directly contain ! divisions and sections, but not body elements. Only divisions will ! directly contain body elements. Even without a horizontal rule anywhere, the body elements of a document or section would be ! contained within a division element. This makes the document tree ! deeper. This is similar to the way HTML treats document contents: grouped within a <BODY> element. *************** *** 320,326 **** A transition would be a "point element", not containing anything, ! only identifying a point within the document structure. This keeps the document tree flatter, but the idea of a "point element" like ! "transition" smells bad. A transition isn't a thing itself, it's the space between two divisions. --- 321,327 ---- A transition would be a "point element", not containing anything, ! only identifying a point within the document structure. This keeps the document tree flatter, but the idea of a "point element" like ! "transition" smells bad. A transition isn't a thing itself, it's the space between two divisions. |
From: David G. <go...@us...> - 2002-04-14 19:40:57
|
Update of /cvsroot/docstring/dps In directory usw-pr-cvs1:/tmp/cvs-serv24794/dps Modified Files: README.txt Log Message: updated Index: README.txt =================================================================== RCS file: /cvsroot/docstring/dps/README.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** README.txt 23 Aug 2001 03:53:45 -0000 1.3 --- README.txt 14 Apr 2002 19:40:54 -0000 1.4 *************** *** 98,102 **** If install.py is a "Python module" (see step 2 above if it isn't), you ! can run it instead of the above. The distutils options windown will not appear. --- 98,102 ---- If install.py is a "Python module" (see step 2 above if it isn't), you ! can run it instead of the above. The distutils options window will not appear. |
From: David G. <go...@us...> - 2002-04-13 17:09:23
|
Update of /cvsroot/docstring/dps/spec In directory usw-pr-cvs1:/tmp/cvs-serv16216/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.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** dps-notes.txt 4 Apr 2002 05:53:11 -0000 1.34 --- dps-notes.txt 13 Apr 2002 17:09:21 -0000 1.35 *************** *** 72,93 **** dps/readers. Potential nastiness.) ! - Add "name" -> "id" attribute conversion. We must have unique, ! SGML-ID-friendly id's and a one-to-one mapping for later lookup. ! ! - Remove dependency on names as sole distinguishing characteristic. ! Use IDs instead. ! ! - Perhaps get rid of "name" attributes altoghether? Certainly get ! rid of the "_:1:_" abominations. ! ! - Perhaps keep a name->id mapping file? This could be stored ! permanently, read by subsequent processing runs, and updated with ! new entries. ("Persistent ID mapping"?) ! ! - When resolving reference IDs from names, we must check for ! non-existent mappings. In the Writer or in a transform? ! - Add support for "refids" attribute on footnotes & citations, for ! backlinks. - Considerations for an HTML Writer [#]_: --- 72,82 ---- dps/readers. Potential nastiness.) ! - Perhaps store a name->id mapping file? This could be stored ! permanently, read by subsequent processing runs, and updated with ! new entries. ("Persistent ID mapping"?) ! - The name->id conversion and hyperlink resolution code needs to be ! checked for correctness and refactored. I'm afraid it's a bit of a ! spaghetti mess now. - Considerations for an HTML Writer [#]_: *************** *** 110,113 **** --- 99,108 ---- .. [#] Source: `HTML 4.0 in Netscape and Explorer`__. __ http://www.webreference.com/dev/html4nsie/index.html + + - Allow for style sheet info to be passed in, either as a <LINK>, or + as embedded style info. + + - Construct a templating system, as in ht2html/yaptu, using directives + and substitutions for dynamic stuff. |
From: David G. <go...@us...> - 2002-04-13 17:09:15
|
Update of /cvsroot/docstring/dps In directory usw-pr-cvs1:/tmp/cvs-serv16179/dps Modified Files: HISTORY.txt Log Message: updated Index: HISTORY.txt =================================================================== RCS file: /cvsroot/docstring/dps/HISTORY.txt,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** HISTORY.txt 28 Mar 2002 05:18:06 -0000 1.50 --- HISTORY.txt 13 Apr 2002 17:09:12 -0000 1.51 *************** *** 223,227 **** - Added 'type' attribute to 'system_warning', removed 'warning'. - Changed "system_warning" to "system_message"; added backlink ! attribute "refids". - Reworked option lists. - Removed "abstract" --- 223,227 ---- - Added 'type' attribute to 'system_warning', removed 'warning'. - Changed "system_warning" to "system_message"; added backlink ! attribute "backrefs". - Reworked option lists. - Removed "abstract" *************** *** 231,235 **** - Added "raw". - Added "refid" attribute to "title" for two-way Tables of Contents. ! - Added "refids" attribute to "footnote" & "citation" for backlinks. * spec/pdpi.dtd: --- 231,236 ---- - Added "raw". - Added "refid" attribute to "title" for two-way Tables of Contents. ! - Added "backrefs" attribute to "footnote" & "citation" for ! backlinks. * spec/pdpi.dtd: |
From: David G. <go...@us...> - 2002-04-13 17:08:15
|
Update of /cvsroot/docstring/dps/dps In directory usw-pr-cvs1:/tmp/cvs-serv15882/dps/dps Modified Files: nodes.py Log Message: Reworked references. Index: nodes.py =================================================================== RCS file: /cvsroot/docstring/dps/dps/nodes.py,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** nodes.py 28 Mar 2002 04:46:24 -0000 1.38 --- nodes.py 13 Apr 2002 17:08:10 -0000 1.39 *************** *** 24,28 **** from types import IntType, SliceType, StringType, TupleType, ListType from UserString import MutableString ! from dps import utils import dps --- 24,28 ---- from types import IntType, SliceType, StringType, TupleType, ListType from UserString import MutableString ! import utils import dps *************** *** 244,248 **** def starttag(self): parts = [self.tagname] ! for name, value in self.attlist: if value is None: # boolean attribute parts.append(name) --- 244,248 ---- def starttag(self): parts = [self.tagname] ! for name, value in self.attlist(): if value is None: # boolean attribute parts.append(name) *************** *** 336,339 **** --- 336,343 ---- return self.attributes.has_key(attr) + def delattr(self, attr): + if self.attributes.has_key(attr): + del self.attributes[attr] + def setdefault(self, key, failobj=None): return self.attributes.setdefault(key, failobj) *************** *** 447,451 **** # ======== ! class ToBeResolved: resolved = 0 --- 451,455 ---- # ======== ! class Resolvable: resolved = 0 *************** *** 454,459 **** class BackLinkable: ! def add_refid(self, refid): ! self.setdefault('refid', []).append(refid) --- 458,463 ---- class BackLinkable: ! def add_backref(self, refid): ! self.setdefault('backrefs', []).append(refid) *************** *** 494,502 **** class Inline: pass - class Referential(ToBeResolved): ! refnode = None ! """Resolved reference to a node.""" --- 498,509 ---- class Inline: pass + class Referential(Resolvable): pass + #refnode = None + #"""Resolved reference to a node.""" ! class Targetable(Resolvable): ! ! referenced = 0 *************** *** 523,531 **** nodes.""" ! self.external_targets = {} ! """Mapping of target names to external target nodes.""" ! self.indirect_targets = {} ! """Mapping of target names to indirect target nodes.""" self.substitution_defs = {} --- 530,541 ---- nodes.""" ! self.external_targets = [] ! """List of external target nodes.""" ! self.internal_targets = [] ! """List of internal target nodes.""" ! ! self.indirect_targets = [] ! """List of indirect target nodes.""" self.substitution_defs = {} *************** *** 533,537 **** self.refnames = {} ! """Mapping of reference names to lists of reference nodes.""" self.nameids = {} --- 543,550 ---- self.refnames = {} ! """Mapping of names to lists of referencing nodes.""" ! ! self.refids = {} ! """Mapping of ids to lists of referencing nodes.""" self.nameids = {} *************** *** 569,578 **** """List of symbol footnote_reference nodes.""" self.pending = [] """List of pending elements @@@.""" - self.anonymous_start = 1 - """Initial anonymous hyperlink number.""" - self.autofootnote_start = 1 """Initial auto-numbered footnote number.""" --- 582,594 ---- """List of symbol footnote_reference nodes.""" + self.footnotes = [] + """List of manually-numbered footnote nodes.""" + + self.citations = [] + """List of citation nodes.""" + self.pending = [] """List of pending elements @@@.""" self.autofootnote_start = 1 """Initial auto-numbered footnote number.""" *************** *** 598,602 **** id = node['id'] if self.ids.has_key(id) and self.ids[id] is not node: ! msg = self.reporter.error('Duplicate ID: "%s".' % id) msgnode += msg else: --- 614,618 ---- id = node['id'] if self.ids.has_key(id) and self.ids[id] is not node: ! msg = self.reporter.severe('Duplicate ID: "%s".' % id) msgnode += msg else: *************** *** 611,642 **** self.ids[id] = node if node.has_key('name'): ! name = node['name'] ! self.nameids[name] = id return id ! def note_implicit_target(self, targetnode, msgnode=None): if msgnode == None: msgnode = self.messages ! id = self.set_id(targetnode, msgnode) ! name = targetnode['name'] if self.explicit_targets.has_key(name) \ or self.implicit_targets.has_key(name): msg = self.reporter.info( ! 'Duplicate implicit target name: "%s".' % name, refid=id) msgnode += msg self.clear_target_names(name, self.implicit_targets) ! del targetnode['name'] ! targetnode['dupname'] = name ! self.implicit_targets[name] = targetnode ! def note_explicit_target(self, targetnode, msgnode=None): if msgnode == None: msgnode = self.messages ! id = self.set_id(targetnode, msgnode) ! name = targetnode['name'] if self.explicit_targets.has_key(name): level = 2 ! if targetnode.has_key('refuri'): # external target, dups OK ! refuri = targetnode['refuri'] t = self.explicit_targets[name] if t.has_key('name') and t.has_key('refuri') \ --- 627,659 ---- self.ids[id] = node if node.has_key('name'): ! self.nameids[node['name']] = id return id ! def note_implicit_target(self, target, msgnode=None): if msgnode == None: msgnode = self.messages ! id = self.set_id(target, msgnode) ! name = target['name'] if self.explicit_targets.has_key(name) \ or self.implicit_targets.has_key(name): msg = self.reporter.info( ! 'Duplicate implicit target name: "%s".' % name, backrefs=[id]) msgnode += msg self.clear_target_names(name, self.implicit_targets) ! del target['name'] ! target['dupname'] = name ! self.implicit_targets[name] = None ! else: ! self.implicit_targets[name] = target ! def note_explicit_target(self, target, msgnode=None): if msgnode == None: msgnode = self.messages ! id = self.set_id(target, msgnode) ! name = target['name'] if self.explicit_targets.has_key(name): level = 2 ! if target.has_key('refuri'): # external target, dups OK ! refuri = target['refuri'] t = self.explicit_targets[name] if t.has_key('name') and t.has_key('refuri') \ *************** *** 645,661 **** msg = self.reporter.system_message( level, 'Duplicate explicit target name: "%s".' % name, ! refid=id) msgnode += msg self.clear_target_names(name, self.explicit_targets, self.implicit_targets) if level > 1: ! del targetnode['name'] ! targetnode['dupname'] = name elif self.implicit_targets.has_key(name): msg = self.reporter.info( ! 'Duplicate implicit target name: "%s".' % name, refid=id) msgnode += msg self.clear_target_names(name, self.implicit_targets) ! self.explicit_targets[name] = targetnode def clear_target_names(self, name, *targetdicts): --- 662,678 ---- msg = self.reporter.system_message( level, 'Duplicate explicit target name: "%s".' % name, ! backrefs=[id]) msgnode += msg self.clear_target_names(name, self.explicit_targets, self.implicit_targets) if level > 1: ! del target['name'] ! target['dupname'] = name elif self.implicit_targets.has_key(name): msg = self.reporter.info( ! 'Duplicate implicit target name: "%s".' % name, backrefs=[id]) msgnode += msg self.clear_target_names(name, self.implicit_targets) ! self.explicit_targets[name] = target def clear_target_names(self, name, *targetdicts): *************** *** 671,709 **** self.refnames.setdefault(node['refname'], []).append(node) ! def note_external_target(self, targetnode): ! self.external_targets[targetnode['name']] = targetnode ! def note_indirect_target(self, targetnode): ! self.indirect_targets[targetnode['name']] = targetnode ! self.note_refname(targetnode) ! def note_anonymous_target(self, targetnode): ! self.anonymous_targets.append(targetnode) ! def note_anonymous_ref(self, refnode): ! self.anonymous_refs.append(refnode) def note_autofootnote(self, footnote): self.autofootnotes.append(footnote) ! def note_autofootnote_ref(self, refnode): ! self.autofootnote_refs.append(refnode) def note_symbol_footnote(self, footnote): self.symbol_footnotes.append(footnote) ! def note_symbol_footnote_ref(self, refnode): ! self.symbol_footnote_refs.append(refnode) ! def note_footnote_ref(self, refnode): ! self.footnote_refs.setdefault(refnode['refname'], []).append(refnode) ! self.note_refname(refnode) ! def note_citation_ref(self, refnode): ! self.citation_refs.setdefault(refnode['refname'], []).append(refnode) ! self.note_refname(refnode) ! def note_substitution_def(self, substitutiondefnode, msgnode=None): ! name = substitutiondefnode['name'] if self.substitution_defs.has_key(name): msg = self.reporter.error( --- 688,748 ---- self.refnames.setdefault(node['refname'], []).append(node) ! def note_refid(self, node): ! self.refids.setdefault(node['refid'], []).append(node) ! def note_external_target(self, target): ! self.external_targets.append(target) ! def note_internal_target(self, target): ! self.internal_targets.append(target) ! def note_indirect_target(self, target): ! self.indirect_targets.append(target) ! if target.has_key('name'): ! self.note_refname(target) ! ! def note_anonymous_target(self, target): ! self.set_id(target) ! self.anonymous_targets.append(target) ! ! def note_anonymous_ref(self, ref): ! self.anonymous_refs.append(ref) def note_autofootnote(self, footnote): + self.set_id(footnote) self.autofootnotes.append(footnote) ! def note_autofootnote_ref(self, ref): ! self.set_id(ref) ! self.autofootnote_refs.append(ref) def note_symbol_footnote(self, footnote): + self.set_id(footnote) self.symbol_footnotes.append(footnote) ! def note_symbol_footnote_ref(self, ref): ! self.set_id(ref) ! self.symbol_footnote_refs.append(ref) ! def note_footnote(self, footnote): ! self.set_id(footnote) ! self.footnotes.append(footnote) ! def note_footnote_ref(self, ref): ! self.set_id(ref) ! self.footnote_refs.setdefault(ref['refname'], []).append(ref) ! self.note_refname(ref) ! def note_citation(self, citation): ! self.set_id(citation) ! self.citations.append(citation) ! ! def note_citation_ref(self, ref): ! self.set_id(ref) ! self.citation_refs.setdefault(ref['refname'], []).append(ref) ! self.note_refname(ref) ! ! def note_substitution_def(self, subdef, msgnode=None): ! name = subdef['name'] if self.substitution_defs.has_key(name): msg = self.reporter.error( *************** *** 716,727 **** del oldnode['name'] # keep only the last definition ! self.substitution_defs[name] = substitutiondefnode ! def note_substitution_ref(self, subrefnode): self.substitution_refs.setdefault( ! subrefnode['refname'], []).append(subrefnode) ! def note_pending(self, pendingnode): ! self.pending.append(pendingnode) --- 755,766 ---- del oldnode['name'] # keep only the last definition ! self.substitution_defs[name] = subdef ! def note_substitution_ref(self, subref): self.substitution_refs.setdefault( ! subref['refname'], []).append(subref) ! def note_pending(self, pending): ! self.pending.append(pending) *************** *** 835,839 **** class comment(Special, PreBibliographic, TextElement): pass class substitution_definition(Special, TextElement): pass ! class target(Special, Inline, TextElement, ToBeResolved): pass class footnote(General, Element, BackLinkable): pass class citation(General, Element, BackLinkable): pass --- 874,878 ---- class comment(Special, PreBibliographic, TextElement): pass class substitution_definition(Special, TextElement): pass ! class target(Special, Inline, TextElement, Targetable): pass class footnote(General, Element, BackLinkable): pass class citation(General, Element, BackLinkable): pass *************** *** 907,914 **** internals = [ '.. internal attributes:', ! ' pending.transform: %s.%s' % (self.transform.__module__, self.transform.__name__), ! ' pending.stage: %r' % self.stage, ! ' pending.details:'] details = self.details.items() details.sort() --- 946,953 ---- internals = [ '.. internal attributes:', ! ' .transform: %s.%s' % (self.transform.__module__, self.transform.__name__), ! ' .stage: %r' % self.stage, ! ' .details:'] details = self.details.items() details.sort() *************** *** 945,949 **** class footnote_reference(Inline, Referential, TextElement): pass class citation_reference(Inline, Referential, TextElement): pass ! class substitution_reference(Inline, Referential, TextElement): pass class image(General, Inline, TextElement): pass class problematic(Inline, TextElement): pass --- 984,988 ---- class footnote_reference(Inline, Referential, TextElement): pass class citation_reference(Inline, Referential, TextElement): pass ! class substitution_reference(Inline, TextElement): pass class image(General, Inline, TextElement): pass class problematic(Inline, TextElement): pass |
From: David G. <go...@us...> - 2002-04-13 17:06:53
|
Update of /cvsroot/docstring/dps/dps/readers In directory usw-pr-cvs1:/tmp/cvs-serv15461/dps/dps/readers Modified Files: standalone.py Log Message: reordered transforms Index: standalone.py =================================================================== RCS file: /cvsroot/docstring/dps/dps/readers/standalone.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** standalone.py 12 Feb 2002 02:19:43 -0000 1.3 --- standalone.py 13 Apr 2002 17:06:49 -0000 1.4 *************** *** 30,38 **** """A single document tree.""" ! transforms = (frontmatter.DocTitle, frontmatter.DocInfo, - references.Hyperlinks, references.Footnotes, ! references.Substitutions,) def scan(self): --- 30,38 ---- """A single document tree.""" ! transforms = (references.Substitutions, ! frontmatter.DocTitle, frontmatter.DocInfo, references.Footnotes, ! references.Hyperlinks,) def scan(self): |
From: David G. <go...@us...> - 2002-04-13 17:06:21
|
Update of /cvsroot/docstring/dps/dps/transforms In directory usw-pr-cvs1:/tmp/cvs-serv15285/dps/dps/transforms Modified Files: references.py Log Message: Reworked reference resolution. Index: references.py =================================================================== RCS file: /cvsroot/docstring/dps/dps/transforms/references.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** references.py 16 Mar 2002 05:59:38 -0000 1.12 --- references.py 13 Apr 2002 17:06:18 -0000 1.13 *************** *** 23,129 **** class Hyperlinks(Transform): ! """ ! Resolve the various types of hyperlink targets and references. ! ! Shown in isolation, the following individual transforms are performed: ! ! 1. Anonymous references and targets:: ! ! <paragraph> ! <reference anonymous="1"> ! text ! <target anonymous="1"> ! ! Corresponding references and targets are assigned ids:: ! ! <paragraph> ! <reference anonymous="1" refid="id1"> ! text ! <target anonymous="1" id="id1"> ! ! 2. Chained targets:: ! ! <target id="id1" name="chained"> ! <target id="id2" name="external hyperlink" refuri="http://uri"> ! ! Attributes "refuri" and "refname" are migrated from the final concrete ! target up the chain of contiguous adjacent internal targets:: ! ! <target id="id1" name="chained" refuri="http://uri"> ! <target id="id2" name="external hyperlink" refuri="http://uri"> ! ! 3. a) Indirect targets:: ! ! <paragraph> ! <reference refname="indirect external"> ! indirect external ! <target id="id1" name="direct external" ! refuri="http://indirect"> ! <target id="id2" name="indirect external" ! refname="direct external"> ! ! Attributes "refuri" and "refname" are migrated back to all indirect ! targets from the final concrete target (i.e. not referring to ! another indirect target):: ! ! <paragraph> ! <reference refname="indirect external"> ! indirect external ! <target id="id1" name="direct external" ! refuri="http://indirect"> ! <target id="id2" name="indirect external" ! refuri="http://indirect"> ! ! If the "refuri" attribute is migrated, the preexisting "refname" ! attribute is dropped. This turns indirect external references into ! direct external references. ! ! b) Indirect internal references:: ! ! <target id="id1" name="final target"> ! <paragraph> ! <reference refname="indirect internal"> ! indirect internal ! <target id="id2" name="indirect internal 2" ! refname="final target"> ! <target id="id3" name="indirect internal" ! refname="indirect internal 2"> ! ! Targets which indirectly refer to an internal target become one-hop ! indirect (their "refname" attributes are directly set to the ! internal target's "name"). References which indirectly refer to an ! internal target become direct internal references:: ! ! <target id="id1" name="final target"> ! <paragraph> ! <reference refname="final target"> ! indirect internal ! <target id="id2" name="indirect internal 2" ! refname="final target"> ! <target id="id3" name="indirect internal" ! refname="final target"> ! ! 4. External references:: ! ! <paragraph> ! <reference refname="direct external"> ! direct external ! <target id="id1" name="direct external" refuri="http://direct"> ! ! The "refname" attribute is replaced by the direct "refuri" attribute:: ! ! <paragraph> ! <reference refuri="http://direct"> ! direct external ! <target id="id1" name="direct external" refuri="http://direct"> ! """ def transform(self): ! self.resolve_anonymous() self.resolve_chained_targets() self.resolve_indirect() ! self.resolve_external_references() def resolve_anonymous(self): if len(self.doctree.anonymous_refs) \ != len(self.doctree.anonymous_targets): --- 23,78 ---- class Hyperlinks(Transform): ! """Resolve the various types of hyperlink targets and references.""" def transform(self): ! stages = [] ! #stages.append('Beginning of references.Hyperlinks.transform()\n' + self.doctree.pformat()) self.resolve_chained_targets() + #stages.append('After references.Hyperlinks.resolve_chained_targets()\n' + self.doctree.pformat()) + self.resolve_anonymous() + #stages.append('After references.Hyperlinks.resolve_anonymous()\n' + self.doctree.pformat()) self.resolve_indirect() ! #stages.append('After references.Hyperlinks.resolve_indirect()\n' + self.doctree.pformat()) ! self.resolve_external_targets() ! #stages.append('After references.Hyperlinks.resolve_external_references()\n' + self.doctree.pformat()) ! self.resolve_internal_targets() ! #stages.append('After references.Hyperlinks.resolve_internal_references()\n' + self.doctree.pformat()) ! #import difflib ! #compare = difflib.Differ().compare ! #for i in range(len(stages) - 1): ! # print ''.join(compare(stages[i].splitlines(1), stages[i+1].splitlines(1))) ! ! def resolve_chained_targets(self): ! """ ! Attributes "refuri" and "refname" are migrated from the final direct ! target up the chain of contiguous adjacent internal targets, using ! `ChainedTargetResolver`. ! """ ! visitor = ChainedTargetResolver(self.doctree) ! self.doctree.walk(visitor) def resolve_anonymous(self): + """ + Link anonymous references to targets. Given:: + + <paragraph> + <reference anonymous="1"> + internal + <reference anonymous="1"> + external + <target anonymous="1" id="id1"> + <target anonymous="1" id="id2" refuri="http://external"> + + Corresponding references are linked via "refid" or resolved via + "refuri":: + + <paragraph> + <reference anonymous="1" refid="id1"> + text + <reference anonymous="1" refuri="http://external"> + external + <target anonymous="1" id="id1"> + <target anonymous="1" id="id2" refuri="http://external"> + """ if len(self.doctree.anonymous_refs) \ != len(self.doctree.anonymous_targets): *************** *** 133,248 **** len(self.doctree.anonymous_targets))) self.doctree.messages += msg return for i in range(len(self.doctree.anonymous_refs)): - name = '_:%s:_' % self.doctree.anonymous_start - self.doctree.anonymous_start += 1 ref = self.doctree.anonymous_refs[i] - ref['refname'] = name - self.doctree.note_refname(ref) target = self.doctree.anonymous_targets[i] ! target['name'] = name ! id = self.doctree.set_id(target) ! self.doctree.note_implicit_target(target, self.doctree) ! if target.hasattr('refname'): ! #ref['refname'] = target['refname'] ! self.doctree.note_indirect_target(target) ! elif target.hasattr('refuri'): ! #ref['refuri'] = target['refuri'] ! self.doctree.note_external_target(target) ! #else: ! # ref['refid'] = id ! ! def resolve_chained_targets(self): ! visitor = ChainedTargetResolver(self.doctree) ! self.doctree.walk(visitor) def resolve_indirect(self): ! for name, target in self.doctree.indirect_targets.items(): if not target.resolved: ! self.one_indirect_target(target) ! if target.hasattr('refname'): ! self.one_indirect_reference(target['name'], ! target['refname']) ! def one_indirect_target(self, target): ! name = target['name'] refname = target['refname'] if self.doctree.explicit_targets.has_key(refname): ! try: ! reftarget = self.doctree.explicit_targets[refname] ! except KeyError: ! self.nonexistent_indirect_target(name, refname, target) ! return ! if reftarget.hasattr('name'): ! if not reftarget.resolved and reftarget.hasattr('refname'): ! self.one_indirect_target(reftarget) # multiply indirect ! if reftarget.hasattr('refuri'): ! target['refuri'] = reftarget['refuri'] ! del target['refname'] ! self.doctree.note_external_target(target) ! elif reftarget.hasattr('refname'): ! target['refname'] = reftarget['refname'] ! #else: # @@@ ? ! # target['refid'] = reftarget['refid'] elif self.doctree.implicit_targets.has_key(refname): reftarget = self.doctree.implicit_targets[refname] try: ! target['refname'] = reftarget['name'] except KeyError: ! self.nonexistent_indirect_target(name, refname, target) return ! else: ! self.nonexistent_indirect_target(name, refname, target) ! return target.resolved = 1 ! def nonexistent_indirect_target(self, name, refname, target): ! if target.hasattr('anonymous'): ! naming = '(id="%s")' % target['id'] else: ! naming = '"%s"' % name msg = self.doctree.reporter.warning( 'Indirect hyperlink target %s refers to target "%s", ' ! 'which does not exist.' % (naming, refname)) self.doctree.messages += msg ! def one_indirect_reference(self, name, refname): ! try: ! reflist = self.doctree.refnames[name] ! except KeyError, instance: ! msg = self.doctree.reporter.info( ! 'Indirect hyperlink target "%s" is not referenced.' ! % name) ! self.doctree.messages += msg return ! for ref in self.doctree.refnames[name]: if ref.resolved: continue ! ref['refname'] = refname ref.resolved = 1 if isinstance(ref, nodes.target): ! self.one_indirect_reference(ref['name'], refname) ! def resolve_external_references(self): ! for name, target in self.doctree.external_targets.items(): if target.hasattr('refuri') and target.hasattr('name'): ! self.one_external_reference(name, target['refuri']) ! def one_external_reference(self, name, refuri): ! try: ! reflist = self.doctree.refnames[name] ! except KeyError, instance: ! msg = self.doctree.reporter.info( ! 'External hyperlink target "%s" is not referenced.' % name) ! self.doctree.messages += msg ! return ! for ref in self.doctree.refnames[name]: ! if ref.resolved: continue ! ref['refuri'] = refuri ! del ref['refname'] ! ref.resolved = 1 ! if isinstance(ref, nodes.target): ! self.one_external_reference(ref['name'], refuri) --- 82,345 ---- len(self.doctree.anonymous_targets))) self.doctree.messages += msg + msgid = self.doctree.set_id(msg) + for ref in self.doctree.anonymous_refs: + prb = nodes.problematic( + ref.rawsource, ref.rawsource, refid=msgid) + prbid = self.doctree.set_id(prb) + msg.add_backref(prbid) + ref.parent.replace(ref, prb) return for i in range(len(self.doctree.anonymous_refs)): ref = self.doctree.anonymous_refs[i] target = self.doctree.anonymous_targets[i] ! if target.hasattr('refuri'): ! ref['refuri'] = target['refuri'] ! ref.resolved = 1 ! else: ! ref['refid'] = target['id'] ! self.doctree.note_refid(ref) ! target.referenced = 1 def resolve_indirect(self): ! """ ! a) Indirect external references:: ! ! <paragraph> ! <reference refname="indirect external"> ! indirect external ! <target id="id1" name="direct external" ! refuri="http://indirect"> ! <target id="id2" name="indirect external" ! refname="direct external"> ! ! The "refuri" attribute is migrated back to all indirect targets from ! the final direct target (i.e. a target not referring to another ! indirect target):: ! ! <paragraph> ! <reference refname="indirect external"> ! indirect external ! <target id="id1" name="direct external" ! refuri="http://indirect"> ! <target id="id2" name="indirect external" ! refuri="http://indirect"> ! ! Once the attribute is migrated, the preexisting "refname" attribute ! is dropped. ! ! b) Indirect internal references:: ! ! <target id="id1" name="final target"> ! <paragraph> ! <reference refname="indirect internal"> ! indirect internal ! <target id="id2" name="indirect internal 2" ! refname="final target"> ! <target id="id3" name="indirect internal" ! refname="indirect internal 2"> ! ! Targets which indirectly refer to an internal target become one-hop ! indirect (their "refid" attributes are directly set to the internal ! target's "id"). References which indirectly refer to an internal ! target become direct internal references:: ! ! <target id="id1" name="final target"> ! <paragraph> ! <reference refid="id1"> ! indirect internal ! <target id="id2" name="indirect internal 2" refid="id1"> ! <target id="id3" name="indirect internal" refid="id1"> ! """ ! #import mypdb as pdb ! #pdb.set_trace() ! for target in self.doctree.indirect_targets: if not target.resolved: ! self.resolve_indirect_target(target) ! self.resolve_indirect_references(target) ! def resolve_indirect_target(self, target): refname = target['refname'] + reftarget = None if self.doctree.explicit_targets.has_key(refname): ! reftarget = self.doctree.explicit_targets[refname] elif self.doctree.implicit_targets.has_key(refname): reftarget = self.doctree.implicit_targets[refname] + if not reftarget: + self.nonexistent_indirect_target(target) + return + if isinstance(reftarget, nodes.target) \ + and not reftarget.resolved and reftarget.hasattr('refname'): + self.one_indirect_target(reftarget) # multiply indirect + if reftarget.hasattr('refuri'): + target['refuri'] = reftarget['refuri'] + if target.hasattr('name'): + self.doctree.note_external_target(target) + elif reftarget.hasattr('refid'): + target['refid'] = reftarget['refid'] + self.doctree.note_refid(target) + else: try: ! target['refid'] = reftarget['id'] ! self.doctree.note_refid(target) except KeyError: ! self.nonexistent_indirect_target(target) return ! del target['refname'] target.resolved = 1 + reftarget.referenced = 1 ! def nonexistent_indirect_target(self, target): ! naming = '' ! if target.hasattr('name'): ! naming = '"%s" ' % target['name'] ! reflist = self.doctree.refnames[target['name']] else: ! reflist = self.doctree.refnames[target['id']] ! naming += '(id="%s")' % target['id'] msg = self.doctree.reporter.warning( 'Indirect hyperlink target %s refers to target "%s", ' ! 'which does not exist.' % (naming, target['refname'])) self.doctree.messages += msg + msgid = self.doctree.set_id(msg) + for ref in reflist: + prb = nodes.problematic( + ref.rawsource, ref.rawsource, refid=msgid) + prbid = self.doctree.set_id(prb) + msg.add_backref(prbid) + ref.parent.replace(ref, prb) + target.resolved = 1 ! def resolve_indirect_references(self, target): ! if target.hasattr('refid'): ! attname = 'refid' ! call_if_named = 0 ! call_method = self.doctree.note_refid ! elif target.hasattr('refuri'): ! attname = 'refuri' ! call_if_named = 1 ! call_method = self.doctree.note_external_target ! else: return ! attval = target[attname] ! if target.hasattr('name'): ! name = target['name'] ! try: ! reflist = self.doctree.refnames[name] ! except KeyError, instance: ! if target.referenced: ! return ! msg = self.doctree.reporter.info( ! 'Indirect hyperlink target "%s" is not referenced.' ! % name) ! self.doctree.messages += msg ! target.referenced = 1 ! return ! delatt = 'refname' ! else: ! id = target['id'] ! try: ! reflist = self.doctree.refids[id] ! except KeyError, instance: ! if target.referenced: ! return ! msg = self.doctree.reporter.info( ! 'Indirect hyperlink target id="%s" is not referenced.' ! % id) ! self.doctree.messages += msg ! target.referenced = 1 ! return ! delatt = 'refid' ! for ref in reflist: if ref.resolved: continue ! del ref[delatt] ! ref[attname] = attval ! if not call_if_named or ref.hasattr('name'): ! call_method(ref) ref.resolved = 1 if isinstance(ref, nodes.target): ! self.resolve_indirect_references(ref) ! target.referenced = 1 ! def resolve_external_targets(self): ! """ ! Given:: ! ! <paragraph> ! <reference refname="direct external"> ! direct external ! <target id="id1" name="direct external" refuri="http://direct"> ! ! The "refname" attribute is replaced by the direct "refuri" attribute:: ! ! <paragraph> ! <reference refuri="http://direct"> ! direct external ! <target id="id1" name="direct external" refuri="http://direct"> ! """ ! for target in self.doctree.external_targets: if target.hasattr('refuri') and target.hasattr('name'): ! name = target['name'] ! refuri = target['refuri'] ! try: ! reflist = self.doctree.refnames[name] ! except KeyError, instance: ! if target.referenced: ! continue ! msg = self.doctree.reporter.info( ! 'External hyperlink target "%s" is not referenced.' ! % name) ! self.doctree.messages += msg ! target.referenced = 1 ! continue ! for ref in reflist: ! if ref.resolved: ! continue ! del ref['refname'] ! ref['refuri'] = refuri ! ref.resolved = 1 ! target.referenced = 1 ! def resolve_internal_targets(self): ! """ ! Given:: ! ! <paragraph> ! <reference refname="direct internal"> ! direct internal ! <target id="id1" name="direct internal"> ! ! The "refname" attribute is replaced by "refid" linking to the target's ! "id":: ! ! <paragraph> ! <reference refid="id1"> ! direct internal ! <target id="id1" name="direct internal"> ! """ ! for target in self.doctree.internal_targets: ! if target.hasattr('refuri') or target.hasattr('refid') \ ! or not target.hasattr('name'): continue ! name = target['name'] ! refid = target['id'] ! try: ! reflist = self.doctree.refnames[name] ! except KeyError, instance: ! if target.referenced: ! continue ! msg = self.doctree.reporter.info( ! 'Internal hyperlink target "%s" is not referenced.' ! % name) ! self.doctree.messages += msg ! target.referenced = 1 ! continue ! for ref in reflist: ! if ref.resolved: ! continue ! del ref['refname'] ! ref['refid'] = refid ! ref.resolved = 1 ! target.referenced = 1 *************** *** 253,257 **** "Chained targets" are multiple adjacent internal hyperlink targets which ! "point to" an external or indirect target. After the transform, all chained targets will effectively point to the same place. --- 350,354 ---- "Chained targets" are multiple adjacent internal hyperlink targets which ! "point to" an external or indirect target. After the transform, all chained targets will effectively point to the same place. *************** *** 259,284 **** <document> ! <target name="a"> ! <target name="b"> ! <target name="c" refuri="http://chained.external.targets"> ! <target name="d"> <paragraph> I'm known as "d". ! <target name="e"> ! <target name="f"> ! <target name="g" refname="d"> ``ChainedTargetResolver(doctree).walk()`` will transform the above into:: <document> ! <target name="a" refuri="http://chained.external.targets"> ! <target name="b" refuri="http://chained.external.targets"> ! <target name="c" refuri="http://chained.external.targets"> ! <target name="d"> <paragraph> I'm known as "d". ! <target name="e" refname="d"> ! <target name="f" refname="d"> ! <target name="g" refname="d"> """ --- 356,381 ---- <document> ! <target id="a" name="a"> ! <target id="b" name="b"> ! <target id="c" name="c" refuri="http://chained.external.targets"> ! <target id="d" name="d"> <paragraph> I'm known as "d". ! <target id="e" name="e"> ! <target id="id1"> ! <target id="f" name="f" refname="d"> ``ChainedTargetResolver(doctree).walk()`` will transform the above into:: <document> ! <target id="a" name="a" refuri="http://chained.external.targets"> ! <target id="b" name="b" refuri="http://chained.external.targets"> ! <target id="c" name="c" refuri="http://chained.external.targets"> ! <target id="d" name="d"> <paragraph> I'm known as "d". ! <target id="e" name="e" refname="d"> ! <target id="id1" refname="d"> ! <target id="f" name="f" refname="d"> """ *************** *** 288,312 **** def visit_target(self, node): if node.hasattr('refuri'): ! refuri = node['refuri'] ! index = node.parent.index(node) ! for i in range(index - 1, -1, -1): ! sibling = node.parent[i] ! if not isinstance(sibling, nodes.target) \ ! or sibling.hasattr('refuri') \ ! or sibling.hasattr('refname'): ! break ! sibling['refuri'] = refuri ! self.doctree.note_external_target(sibling) elif node.hasattr('refname'): ! refname = node['refname'] ! index = node.parent.index(node) ! for i in range(index - 1, -1, -1): ! sibling = node.parent[i] ! if not isinstance(sibling, nodes.target) \ ! or sibling.hasattr('refuri') \ ! or sibling.hasattr('refname'): ! break ! sibling['refname'] = refname ! self.doctree.note_indirect_target(sibling) --- 385,410 ---- def visit_target(self, node): if node.hasattr('refuri'): ! attname = 'refuri' ! call_if_named = self.doctree.note_external_target elif node.hasattr('refname'): ! attname = 'refname' ! call_if_named = self.doctree.note_indirect_target ! elif node.hasattr('refid'): ! attname = 'refid' ! call_if_named = None ! else: ! return ! attval = node[attname] ! index = node.parent.index(node) ! for i in range(index - 1, -1, -1): ! sibling = node.parent[i] ! if not isinstance(sibling, nodes.target) \ ! or sibling.hasattr('refuri') \ ! or sibling.hasattr('refname') \ ! or sibling.hasattr('refid'): ! break ! sibling[attname] = attval ! if sibling.hasattr('name') and call_if_named: ! call_if_named(sibling) *************** *** 314,318 **** """ ! Assign numbers and resolve links to autonumbered footnotes and references. Given the following ``doctree`` as input:: --- 412,417 ---- """ ! Assign numbers to autonumbered footnotes, and resolve links to footnotes, ! citations, and their references. Given the following ``doctree`` as input:: *************** *** 321,332 **** <paragraph> A labeled autonumbered footnote referece: ! <footnote_reference auto="1" refname="footnote"> <paragraph> An unlabeled autonumbered footnote referece: ! <footnote_reference auto="1"> ! <footnote auto="1"> <paragraph> Unlabeled autonumbered footnote. ! <footnote auto="1" name="footnote"> <paragraph> Labeled autonumbered footnote. --- 420,431 ---- <paragraph> A labeled autonumbered footnote referece: ! <footnote_reference auto="1" id="id1" refname="footnote"> <paragraph> An unlabeled autonumbered footnote referece: ! <footnote_reference auto="1" id="id2"> ! <footnote auto="1" id="id3"> <paragraph> Unlabeled autonumbered footnote. ! <footnote auto="1" id="footnote" name="footnote"> <paragraph> Labeled autonumbered footnote. *************** *** 343,358 **** <paragraph> A labeled autonumbered footnote referece: ! <footnote_reference auto="1" refname="footnote"> 2 <paragraph> An unlabeled autonumbered footnote referece: ! <footnote_reference auto="1" refname="1"> 1 ! <footnote auto="1" name="1"> <label> 1 <paragraph> Unlabeled autonumbered footnote. ! <footnote auto="1" name="footnote"> <label> 2 --- 442,457 ---- <paragraph> A labeled autonumbered footnote referece: ! <footnote_reference auto="1" id="id1" refid="footnote"> 2 <paragraph> An unlabeled autonumbered footnote referece: ! <footnote_reference auto="1" id="id2" refid="id3"> 1 ! <footnote auto="1" id="id3" backrefs="id2"> <label> 1 <paragraph> Unlabeled autonumbered footnote. ! <footnote auto="1" id="footnote" name="footnote" backrefs="id1"> <label> 2 *************** *** 362,369 **** Note that the footnotes are not in the same order as the references. ! The labels and reference text are added to the auto-numbered ! ``footnote`` and ``footnote_reference`` elements. The unlabeled ! auto-numbered footnote and reference are assigned name and refname ! attributes respectively, being the footnote number. After adding labels and reference text, the "auto" attributes can be --- 461,468 ---- Note that the footnotes are not in the same order as the references. ! The labels and reference text are added to the auto-numbered ``footnote`` ! and ``footnote_reference`` elements. Footnote elements are backlinked to ! their references via "refids" attributes. References are assigned "id" ! and "refid" attributes. After adding labels and reference text, the "auto" attributes can be *************** *** 394,412 **** self.autofootnote_labels = [] startnum = self.doctree.autofootnote_start ! self.number_footnotes() self.number_footnote_references(startnum) self.symbolize_footnotes() ! def number_footnotes(self): """ Assign numbers to autonumbered footnotes. ! For labeled footnotes, copy the number over to corresponding footnote ! references. """ for footnote in self.doctree.autofootnotes: while 1: ! label = str(self.doctree.autofootnote_start) ! self.doctree.autofootnote_start += 1 if not self.doctree.explicit_targets.has_key(label): break --- 493,512 ---- self.autofootnote_labels = [] startnum = self.doctree.autofootnote_start ! self.doctree.autofootnote_start = self.number_footnotes(startnum) self.number_footnote_references(startnum) self.symbolize_footnotes() + self.resolve_footnotes_and_citations() ! def number_footnotes(self, startnum): """ Assign numbers to autonumbered footnotes. ! For labeled autonumbered footnotes, copy the number over to ! corresponding footnote references. """ for footnote in self.doctree.autofootnotes: while 1: ! label = str(startnum) ! startnum += 1 if not self.doctree.explicit_targets.has_key(label): break *************** *** 418,421 **** --- 518,525 ---- for ref in self.doctree.footnote_refs.get(name, []): ref += nodes.Text(label) + ref.delattr('refname') + ref['refid'] = footnote['id'] + footnote.add_backref(ref['id']) + self.doctree.note_refid(ref) ref.resolved = 1 else: *************** *** 423,436 **** self.doctree.note_explicit_target(footnote, footnote) self.autofootnote_labels.append(label) def number_footnote_references(self, startnum): ! """Assign numbers to unlabeled autonumbered footnote references.""" i = 0 for ref in self.doctree.autofootnote_refs: ! if ref.resolved or ref.hasattr('refname'): continue try: ! ref += nodes.Text(self.autofootnote_labels[i]) ! ref['refname'] = self.autofootnote_labels[i] except IndexError: msg = self.doctree.reporter.error( --- 527,540 ---- self.doctree.note_explicit_target(footnote, footnote) self.autofootnote_labels.append(label) + return startnum def number_footnote_references(self, startnum): ! """Assign numbers to autonumbered footnote references.""" i = 0 for ref in self.doctree.autofootnote_refs: ! if ref.resolved or ref.hasattr('refid'): continue try: ! label = self.autofootnote_labels[i] except IndexError: msg = self.doctree.reporter.error( *************** *** 441,450 **** self.doctree.messages += msg for ref in self.doctree.autofootnote_refs[i:]: ! if not (ref.resolved or ref.hasattr('refname')): ! prb = nodes.problematic(ref.rawsource, ref.rawsource, ! refid=msgid) ! ref.parent.replace(ref, prb) ! # @@@ insert reference to each prb in msg? break ref.resolved = 1 i += 1 --- 545,561 ---- self.doctree.messages += msg for ref in self.doctree.autofootnote_refs[i:]: ! if ref.resolved or ref.hasattr('refname'): ! continue ! prb = nodes.problematic( ! ref.rawsource, ref.rawsource, refid=msgid) ! prbid = self.doctree.set_id(prb) ! msg.add_backref(prbid) ! ref.parent.replace(ref, prb) break + ref += nodes.Text(label) + footnote = self.doctree.explicit_targets[label] + ref['refid'] = footnote['id'] + self.doctree.note_refid(ref) + footnote.add_backref(ref['id']) ref.resolved = 1 i += 1 *************** *** 465,469 **** try: ref += nodes.Text(labels[i]) - ref['refid'] = self.doctree.symbol_footnotes[i]['id'] except IndexError: msg = self.doctree.reporter.error( --- 576,579 ---- *************** *** 473,485 **** self.doctree.messages += msg for ref in self.doctree.symbol_footnote_refs[i:]: ! if not (ref.resolved or ref.hasattr('refid')): ! prb = nodes.problematic(ref.rawsource, ref.rawsource, ! refid=msgid) ! ref.parent.replace(ref, prb) ! # @@@ insert reference to each prb in msg? break ! ref.resolved = 1 i += 1 class Substitutions(Transform): --- 583,627 ---- self.doctree.messages += msg for ref in self.doctree.symbol_footnote_refs[i:]: ! if ref.resolved or ref.hasattr('refid'): ! continue ! prb = nodes.problematic( ! ref.rawsource, ref.rawsource, refid=msgid) ! prbid = self.doctree.set_id(prb) ! msg.add_backref(prbid) ! ref.parent.replace(ref, prb) break ! footnote = self.doctree.symbol_footnotes[i] ! ref['refid'] = footnote['id'] ! self.doctree.note_refid(ref) ! footnote.add_backref(ref['id']) i += 1 + def resolve_footnotes_and_citations(self): + """ + Link manually-labeled footnotes and citations to/from their references. + """ + for footnote in self.doctree.footnotes: + label = footnote['name'] + if self.doctree.footnote_refs.has_key(label): + reflist = self.doctree.footnote_refs[label] + self.resolve_references(footnote, reflist) + for citation in self.doctree.citations: + label = citation['name'] + if self.doctree.citation_refs.has_key(label): + reflist = self.doctree.citation_refs[label] + self.resolve_references(citation, reflist) + + def resolve_references(self, note, reflist): + id = note['id'] + for ref in reflist: + if ref.resolved: + continue + ref.delattr('refname') + ref['refid'] = id + note.add_backref(ref['id']) + ref.resolved = 1 + note.resolved = 1 + + class Substitutions(Transform): *************** *** 522,528 **** self.doctree.messages += msg prb = nodes.problematic( ! ref.rawsource, '', refid=msgid, *ref.getchildren()) prbid = self.doctree.set_id(prb) ref.parent.replace(ref, prb) - msg['refid'] = prbid self.doctree.substitution_refs = None # release replaced references --- 664,670 ---- self.doctree.messages += msg prb = nodes.problematic( ! ref.rawsource, ref.rawsource, refid=msgid) prbid = self.doctree.set_id(prb) + msg.add_backref(prbid) ref.parent.replace(ref, prb) self.doctree.substitution_refs = None # release replaced references |