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.
generated HTML in your browser. (The local HTML without -i, the
remote HTML with -i; PEP 0 when no pep argument is given.)
Fix the help text for -i (referenced sf_username which wasn't
defined).
Sort the files when processing all of them (glob doesn't sort, alas).
fixanchor(): Adopt the algorithm for url recognition from faqwiz after
suggestion by Guido. Strip any trailing punctuation from the end
of the url.
Also, use .startswith() where appropriate.
e.g. "PEP 1".
fixanchor(): Turn preferred usage for PEP references into PEP url
using the new PEPURL template (which uses the canonical
www.python.org/peps url instead of the sourceforge.net site).
(Also, get rid of base argument in int() calls; base 10 is default.)
fixfile(): If we can't open the input file, print an error message and
continue on.