From d795805141af2afa687a9d10396f5f9ad080fa42 Mon Sep 17 00:00:00 2001 From: CAM Gerlach Date: Thu, 24 Feb 2022 14:45:26 -0600 Subject: [PATCH] PEP 1: Make `text/x-rst` the default for the Content-Type header (#2355) --- pep-0001.txt | 14 ++++++-------- pep-0012/pep-NNNN.rst | 1 + pep2html.py | 8 ++++---- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/pep-0001.txt b/pep-0001.txt index 9958e0dff..fa4ac2e50 100644 --- a/pep-0001.txt +++ b/pep-0001.txt @@ -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: Type: - * Content-Type: + * Content-Type: text/x-rst * Requires: Created: * Python-Version: @@ -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 diff --git a/pep-0012/pep-NNNN.rst b/pep-0012/pep-NNNN.rst index 339fa7c4b..f5de08353 100644 --- a/pep-0012/pep-NNNN.rst +++ b/pep-0012/pep-NNNN.rst @@ -6,6 +6,7 @@ PEP-Delegate: Discussions-To: Status: Type: +Content-Type: text/x-rst Requires: Created: Python-Version: diff --git a/pep2html.py b/pep2html.py index 970c68dba..ba0ec100b 100755 --- a/pep2html.py +++ b/pep2html.py @@ -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 = '%s ' % (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