Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: cms/converters.py

Issue 29569602: Noissue - Replace flake8-putty with flake8-per-file-ignores, update to flake8 3 (cms) (Closed)
Patch Set: Created Oct. 8, 2017, 6:09 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cms/bin/translate.py ('k') | tox.ini » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # This file is part of the Adblock Plus web scripts, 1 # This file is part of the Adblock Plus web scripts,
2 # Copyright (C) 2006-present eyeo GmbH 2 # Copyright (C) 2006-present eyeo GmbH
3 # 3 #
4 # Adblock Plus is free software: you can redistribute it and/or modify 4 # Adblock Plus is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License version 3 as 5 # it under the terms of the GNU General Public License version 3 as
6 # published by the Free Software Foundation. 6 # published by the Free Software Foundation.
7 # 7 #
8 # Adblock Plus is distributed in the hope that it will be useful, 8 # Adblock Plus is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
(...skipping 16 matching lines...) Expand all
27 # Monkey-patch Markdown's isBlockLevel function to ensure that no paragraphs 27 # Monkey-patch Markdown's isBlockLevel function to ensure that no paragraphs
28 # are inserted into the <head> tag 28 # are inserted into the <head> tag
29 orig_isBlockLevel = markdown.util.isBlockLevel 29 orig_isBlockLevel = markdown.util.isBlockLevel
30 30
31 31
32 def isBlockLevel(tag): 32 def isBlockLevel(tag):
33 if tag == 'head': 33 if tag == 'head':
34 return True 34 return True
35 return orig_isBlockLevel(tag) 35 return orig_isBlockLevel(tag)
36 36
37
37 markdown.util.isBlockLevel = isBlockLevel 38 markdown.util.isBlockLevel = isBlockLevel
38 39
39 html_escapes = { 40 html_escapes = {
40 '<': '&lt;', 41 '<': '&lt;',
41 '>': '&gt;', 42 '>': '&gt;',
42 '&': '&amp;', 43 '&': '&amp;',
43 '"': '&quot;', 44 '"': '&quot;',
44 "'": '&#39;', 45 "'": '&#39;',
45 } 46 }
46 47
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 552
552 structured = [] 553 structured = []
553 stack = [{'level': 0, 'subitems': structured}] 554 stack = [{'level': 0, 'subitems': structured}]
554 for item in flat: 555 for item in flat:
555 while stack[-1]['level'] >= item['level']: 556 while stack[-1]['level'] >= item['level']:
556 stack.pop() 557 stack.pop()
557 stack[-1]['subitems'].append(item) 558 stack[-1]['subitems'].append(item)
558 stack.append(item) 559 stack.append(item)
559 return structured 560 return structured
560 561
562
561 converters = { 563 converters = {
562 'html': RawConverter, 564 'html': RawConverter,
563 'md': MarkdownConverter, 565 'md': MarkdownConverter,
564 'tmpl': TemplateConverter, 566 'tmpl': TemplateConverter,
565 } 567 }
OLDNEW
« no previous file with comments | « cms/bin/translate.py ('k') | tox.ini » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld