PEP 1: Make `text/x-rst` the default for the Content-Type header (#2355)

This commit is contained in:
CAM Gerlach 2022-02-24 14:45:26 -06:00 committed by GitHub
parent 9270420cf2
commit d795805141
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 12 deletions

View File

@ -208,8 +208,8 @@ The standard PEP workflow is:
* The title accurately describes the content.
* The PEP's language (spelling, grammar, sentence structure, etc.)
and code style (examples should match :pep:`7` & :pep:`8`) should be
correct and conformant. The PEP text will be automatically checked for
correct reStructuredText formatting when the pull request is submitted.
correct and conformant. The PEP text will be automatically checked for
correct reStructuredText formatting when the pull request is submitted.
PEPs with invalid reST markup will not be approved.
Editors are generally quite lenient about this initial review,
@ -596,7 +596,7 @@ optional and are described below. All other headers are required.
Status: <Draft | Active | Accepted | Provisional | Deferred | Rejected |
Withdrawn | Final | Superseded>
Type: <Standards Track | Informational | Process>
* Content-Type: <text/x-rst | text/plain>
* Content-Type: text/x-rst
* Requires: <pep numbers>
Created: <date created on, in dd-mmm-yyyy format>
* Python-Version: <version number>
@ -649,11 +649,9 @@ The Type header specifies the type of PEP: Standards Track,
Informational, or Process.
The format of a PEP is specified with a Content-Type header.
Valid values are ``text/plain`` for plaintext PEPs (see :pep:`9`)
and ``text/x-rst`` for reStructuredText PEPs (see :pep:`12`).
All new and active PEPs must use reStructuredText, but for backwards
compatibility, plain text is currently still the default if no
Content-Type header is present.
All PEPs must use reStructuredText (see :pep:`12`),
and have a value of ``text/x-rst``, the default.
Previously, plaintext PEPs used ``text/plain`` (see :pep:`9`).
The Created header records the date that the PEP was assigned a
number, while Post-History is used to record the dates of when new

View File

@ -6,6 +6,7 @@ PEP-Delegate: <PEP delegate's real name>
Discussions-To: <REQUIRED: URL of current canonical discussion thread>
Status: <REQUIRED: Draft | Active | Accepted | Provisional | Deferred | Rejected | Withdrawn | Final | Superseded>
Type: <REQUIRED: Standards Track | Informational | Process>
Content-Type: text/x-rst
Requires: <pep numbers>
Created: <date created on, in dd-mmm-yyyy format>
Python-Version: <version number>

View File

@ -260,7 +260,7 @@ def fixfile(inpath, input_lines, outfile):
v = date
elif k.lower() in ('content-type',):
url = PEPURL % 9
pep_type = v or 'text/plain'
pep_type = v or 'text/x-rst'
v = '<a href="%s">%s</a> ' % (url, escape(pep_type))
elif k.lower() == 'version':
if v.startswith('$' 'Revision: ') and v.endswith(' $'):
@ -569,7 +569,7 @@ def fix_rst_pep(inpath, input_lines, outfile):
def get_pep_type(input_lines):
"""
Return the Content-Type of the input. "text/plain" is the default.
Return the Content-Type of the input. "text/x-rst" is the default.
Return ``None`` if the input is not a PEP.
"""
pep_type = None
@ -579,11 +579,11 @@ def get_pep_type(input_lines):
# End of the RFC 2822 header (first blank line).
break
elif line.startswith('content-type: '):
pep_type = line.split()[1] or 'text/plain'
pep_type = line.split()[1] or 'text/x-rst'
break
elif line.startswith('pep: '):
# Default PEP type, used if no explicit content-type specified:
pep_type = 'text/plain'
pep_type = 'text/x-rst'
return pep_type