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

Side by Side Diff: cms/converters.py

Issue 29891645: Issue 5601 - Speed up static generation (Closed)
Patch Set: Created Sept. 25, 2018, 12:27 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 | « no previous file | cms/sources.py » ('j') | cms/sources.py » ('J')
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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 self._data = data 128 self._data = data
129 self._filename = filename 129 self._filename = filename
130 self._params = params 130 self._params = params
131 self._attribute_parser = AttributeParser(self.whitelist) 131 self._attribute_parser = AttributeParser(self.whitelist)
132 self._seen_defaults = {} 132 self._seen_defaults = {}
133 133
134 def localize_string( 134 def localize_string(
135 self, page, name, default, comment, localedata, escapes): 135 self, page, name, default, comment, localedata, escapes):
136 136
137 def escape(s): 137 def escape(s):
138 return re.sub(r'.', 138 return ''.join(escapes.get(c, c) for c in s)
139 lambda match: escapes.get(match.group(0),
140 match.group(0)),
141 s, flags=re.S)
142 139
143 def re_escape(s): 140 def re_escape(s):
144 return re.escape(escape(s)) 141 return re.escape(escape(s))
145 142
146 # Handle duplicated strings 143 # Handle duplicated strings
147 if default: 144 if default:
148 self._seen_defaults[(page, name)] = (default, comment) 145 self._seen_defaults[(page, name)] = (default, comment)
149 else: 146 else:
150 try: 147 try:
151 default, comment = self._seen_defaults[(page, name)] 148 default, comment = self._seen_defaults[(page, name)]
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 stack[-1]['subitems'].append(item) 523 stack[-1]['subitems'].append(item)
527 stack.append(item) 524 stack.append(item)
528 return structured 525 return structured
529 526
530 527
531 converters = { 528 converters = {
532 'html': RawConverter, 529 'html': RawConverter,
533 'md': MarkdownConverter, 530 'md': MarkdownConverter,
534 'tmpl': TemplateConverter, 531 'tmpl': TemplateConverter,
535 } 532 }
OLDNEW
« no previous file with comments | « no previous file | cms/sources.py » ('j') | cms/sources.py » ('J')

Powered by Google App Engine
This is Rietveld