Skip to content

Commit fba9086

Browse files
ilevkivskyihugovk
authored andcommitted
Implement review comments, and add a test
1 parent e340ac1 commit fba9086

File tree

5 files changed

+671
-5
lines changed

5 files changed

+671
-5
lines changed

base-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ django-waffle==0.14
3737
djangorestframework==3.8.2
3838
django-filter==1.1.0
3939

40-
pygments==2.1.3
40+
pygments==2.1.3 # This will be not needed when PEPs are moved to RtD.

peps/converters.py

Lines changed: 8 additions & 3 deletions
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():
@@ -145,16 +150,16 @@ def convert_pep_page(pep_number, content):
145150
# Fix PEP links
146151
pep_content = BeautifulSoup(data['content'], 'lxml')
147152
body_links = pep_content.find_all("a")
148-
# Fix hihglighting code
149-
code_blocks = pep_content.find_all("pre", class_="code")
153+
# Fix highlighting 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)