Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Unified Diff: tools/json_schema_compiler/highlighters/none_highlighter.py

Issue 10833024: Fix syntax highlighting in JSON Schema Compiler's preview server: don't crash (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: . Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/json_schema_compiler/highlighters/pygments_highlighter.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/json_schema_compiler/highlighters/none_highlighter.py
diff --git a/tools/json_schema_compiler/highlighters/none_highlighter.py b/tools/json_schema_compiler/highlighters/none_highlighter.py
index 873a00bcff758cbc1488d87a2ea29097998b074a..ac1cc2b4b2684e32e28efb33da9c8b8a527a1391 100644
--- a/tools/json_schema_compiler/highlighters/none_highlighter.py
+++ b/tools/json_schema_compiler/highlighters/none_highlighter.py
@@ -2,6 +2,8 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import cgi
+
class NoneHighlighter(object):
"""Highlighter that just wraps code in a <pre>.
"""
@@ -9,7 +11,7 @@ class NoneHighlighter(object):
return ''
def GetCodeElement(self, code, style):
- return '<pre>' + code + '</pre>'
+ return '<pre>' + cgi.escape(code) + '</pre>'
def DisplayName(self):
return 'none'
« no previous file with comments | « no previous file | tools/json_schema_compiler/highlighters/pygments_highlighter.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698