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

Delta Between Two Patch Sets: cms/converters.py

Issue 6274620759998464: Issue 2450 - [cms] Extra semicolons being added to translatable strings (Closed)
Left Patch Set: Created May 4, 2015, 8:27 p.m.
Right Patch Set: More generic regexp Created May 5, 2015, 2:25 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 # coding: utf-8 1 # coding: utf-8
2 2
3 # This file is part of the Adblock Plus web scripts, 3 # This file is part of the Adblock Plus web scripts,
4 # Copyright (C) 2006-2015 Eyeo GmbH 4 # Copyright (C) 2006-2015 Eyeo GmbH
5 # 5 #
6 # Adblock Plus is free software: you can redistribute it and/or modify 6 # Adblock Plus is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License version 3 as 7 # it under the terms of the GNU General Public License version 3 as
8 # published by the Free Software Foundation. 8 # published by the Free Software Foundation.
9 # 9 #
10 # Adblock Plus is distributed in the hope that it will be useful, 10 # Adblock Plus is distributed in the hope that it will be useful,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 def parse(self, text, pagename): 54 def parse(self, text, pagename):
55 self.reset() 55 self.reset()
56 self._string = [] 56 self._string = []
57 self._fixed_strings = [] 57 self._fixed_strings = []
58 self._inside_fixed = False 58 self._inside_fixed = False
59 self._attrs = {} 59 self._attrs = {}
60 self._pagename = pagename 60 self._pagename = pagename
61 61
62 # Force-escape ampersands, otherwise the parser will autocomplete bogus 62 # Force-escape ampersands, otherwise the parser will autocomplete bogus
63 # entities. 63 # entities.
64 text = re.sub(r"&(?!\w+;)", "&", text) 64 text = re.sub(r"&(?!\S+;)", "&", text)
Sebastian Noack 2015/05/04 20:45:33 What's about hexadecimal escapes (e.g. ©). \w
Wladimir Palant 2015/05/05 14:26:14 Done.
65 65
66 try: 66 try:
67 self.feed(text) 67 self.feed(text)
68 return "".join(self._string), self._attrs, ["".join(s) for s in self._fixe d_strings] 68 return "".join(self._string), self._attrs, ["".join(s) for s in self._fixe d_strings]
69 finally: 69 finally:
70 self._string = None 70 self._string = None
71 self._attrs = None 71 self._attrs = None
72 self._pagename = None 72 self._pagename = None
73 self._inside_fixed = False 73 self._inside_fixed = False
74 self._fixed_strings = None 74 self._fixed_strings = None
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 stack.pop() 399 stack.pop()
400 stack[-1]["subitems"].append(item) 400 stack[-1]["subitems"].append(item)
401 stack.append(item) 401 stack.append(item)
402 return structured 402 return structured
403 403
404 converters = { 404 converters = {
405 "html": RawConverter, 405 "html": RawConverter,
406 "md": MarkdownConverter, 406 "md": MarkdownConverter,
407 "tmpl": TemplateConverter, 407 "tmpl": TemplateConverter,
408 } 408 }
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld