We're already linking PEP numbers in "Replaces:", and "Requires:".
Adjusted the code so it can link "Superseded-By:".
Add the "Replaces:" header where they're missing.
The PEP summary/email lines that aren't the first line in their group
have an extra leading space because the previous line is printed with a
trailing space. The special lines read from pep-0000.txt should be
printed with no extra ending to be consistent with what the python2
version did with a print statement that ends with a comma.
* Refactored the file I/O model throughout, to support multiple
processing paths. PEP source text is now read into a list of lines.
* In ``fixfile()``:
- Updated its parameters for the new I/O model.
- Changed ``fo`` to ``outfile``, ``fi`` to ``inpath`` and
``input_lines``.
- Input is read in by iterating over the list of input lines, rather
than using "readlines()".
- Opening and closing of files is done by the caller, "make_html()".
- Added PEP number processing in Requires header.
- Linked "Content-Type: text/plain" to PEP 9.
* Added ``fix_rst_pep()``, which imports and calls Docutils code.
* Added ``get_pep_type()``, which checks for a Content-Type header and
returns the value, defaulting to "text/plain". If no PEP header is
found, ``None`` is returned: input is not a PEP.
* Added ``get_input_lines()`` to read input file into a list.
* Expanded ``make_html()`` to catch errors and process the different
PEP formats via the new ``PEP_TYPE_DISPATCH`` dict.
* Added ``check_requirements()`` to check both Python and Docutils
requirements. ``pep_type_error()`` is called if the required
software is not available.
* In ``main()``:
- Added an ``argv`` parameter, so that pep2html.py can be imported
and command-line options passed in. Yes, I use this functionality
in the Docutils "buildhtml.py" front end.
- Files skipped (due to an error) are not pushed onto the server.
fixfile(): Modify the Author: and Discussions-To: header handling for
the new required format. Since this uses Python 2.2's email package,
it should normalize either old style or new style addresses to the new
style for the web page.