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

Side by Side Diff: cms/converters.py

Issue 4750268684042240: Issue 2428 - Allow <code> in translated strings (Closed)
Patch Set: Created April 28, 2015, 9:57 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 # HTML escaping is applied when this string is inserted into the document. 99 # HTML escaping is applied when this string is inserted into the document.
100 self._append_text(data) 100 self._append_text(data)
101 101
102 def handle_entityref(self, name): 102 def handle_entityref(self, name):
103 self._append_text(self.unescape("&%s;" % name)) 103 self._append_text(self.unescape("&%s;" % name))
104 104
105 def handle_charref(self, name): 105 def handle_charref(self, name):
106 self._append_text(self.unescape("&#%s;" % name)) 106 self._append_text(self.unescape("&#%s;" % name))
107 107
108 class Converter: 108 class Converter:
109 whitelist = set(["a", "em", "strong"]) 109 whitelist = set(["a", "em", "strong", "code"])
110 110
111 def __init__(self, params, key="pagedata"): 111 def __init__(self, params, key="pagedata"):
112 self._params = params 112 self._params = params
113 self._key = key 113 self._key = key
114 self._attribute_parser = AttributeParser(self.whitelist) 114 self._attribute_parser = AttributeParser(self.whitelist)
115 115
116 # Read in any parameters specified at the beginning of the file 116 # Read in any parameters specified at the beginning of the file
117 lines = params[key].splitlines(True) 117 lines = params[key].splitlines(True)
118 while lines and re.search(r"^\s*[\w\-]+\s*=", lines[0]): 118 while lines and re.search(r"^\s*[\w\-]+\s*=", lines[0]):
119 name, value = lines.pop(0).split("=", 1) 119 name, value = lines.pop(0).split("=", 1)
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 stack.pop() 395 stack.pop()
396 stack[-1]["subitems"].append(item) 396 stack[-1]["subitems"].append(item)
397 stack.append(item) 397 stack.append(item)
398 return structured 398 return structured
399 399
400 converters = { 400 converters = {
401 "html": RawConverter, 401 "html": RawConverter,
402 "md": MarkdownConverter, 402 "md": MarkdownConverter,
403 "tmpl": TemplateConverter, 403 "tmpl": TemplateConverter,
404 } 404 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld