Skip to content

Commit a91ec43

Browse files
ilevkivskyihugovk
authored andcommitted
Implement review comments, and add a test
1 parent 2f4c8fc commit a91ec43

File tree

4 files changed

+669
-3
lines changed

4 files changed

+669
-3
lines changed

peps/converters.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919
PEP_TEMPLATE = 'pages/pep-page.html'
2020
pep_url = lambda num: 'dev/peps/pep-{}/'.format(num)
2121

22+
# To simplify syntax highlighting, all literal blocks (those produced by ::)
23+
# in the following PEPs will be automatically highlighted using Python lexer.
24+
# PEP editors/authors could make simple PRs extending this list.
25+
# This will be not needed when PEPs are moved to RtD and all code blocks are
26+
# formatted using .. code:: language.
2227
PURE_PYTHON_PEPS = [483, 484, 526]
2328

2429
def get_peps_last_updated():
@@ -146,15 +151,15 @@ def convert_pep_page(pep_number, content):
146151
pep_content = BeautifulSoup(data['content'], 'lxml')
147152
body_links = pep_content.find_all("a")
148153
# Fix highlighting code
149-
code_blocks = pep_content.find_all("pre", class_="code")
154+
code_blocks = pep_content.find_all('pre', class_='code')
150155
for cb in code_blocks:
151156
del cb['class']
152157
div = pep_content.new_tag('div')
153158
div['class'] = ['highlight']
154159
cb.wrap(div)
155160
# Highlight existing pure-Python PEPs
156161
if int(pep_number) in PURE_PYTHON_PEPS:
157-
literal_blocks = pep_content.find_all("pre", class_="literal-block")
162+
literal_blocks = pep_content.find_all('pre', class_='literal-block')
158163
for lb in literal_blocks:
159164
block = lb.string
160165
if block:

0 commit comments

Comments
 (0)