Merge "Escape special HTML characters in warning messages."
am: a14c131154
Change-Id: Ia8a2afa3d765d7a07a5c7c732af9f66912c1483c
This commit is contained in:
commit
d83446d789
1 changed files with 14 additions and 5 deletions
|
@ -75,6 +75,7 @@ Use option --gencsv to output warning counts in CSV format.
|
|||
# emit_js_data():
|
||||
|
||||
import argparse
|
||||
import cgi
|
||||
import csv
|
||||
import multiprocessing
|
||||
import os
|
||||
|
@ -3149,6 +3150,14 @@ def emit_const_string_array(name, array):
|
|||
print '];'
|
||||
|
||||
|
||||
# Emit a JavaScript const string array for HTML.
|
||||
def emit_const_html_string_array(name, array):
|
||||
print 'const ' + name + ' = ['
|
||||
for s in array:
|
||||
print '"' + cgi.escape(strip_escape_string(s)) + '",'
|
||||
print '];'
|
||||
|
||||
|
||||
# Emit a JavaScript const object array.
|
||||
def emit_const_object_array(name, array):
|
||||
print 'const ' + name + ' = ['
|
||||
|
@ -3167,11 +3176,11 @@ def emit_js_data():
|
|||
emit_const_string_array('ProjectNames', project_names)
|
||||
emit_const_int_array('WarnPatternsSeverity',
|
||||
[w['severity'] for w in warn_patterns])
|
||||
emit_const_string_array('WarnPatternsDescription',
|
||||
[w['description'] for w in warn_patterns])
|
||||
emit_const_string_array('WarnPatternsOption',
|
||||
[w['option'] for w in warn_patterns])
|
||||
emit_const_string_array('WarningMessages', warning_messages)
|
||||
emit_const_html_string_array('WarnPatternsDescription',
|
||||
[w['description'] for w in warn_patterns])
|
||||
emit_const_html_string_array('WarnPatternsOption',
|
||||
[w['option'] for w in warn_patterns])
|
||||
emit_const_html_string_array('WarningMessages', warning_messages)
|
||||
emit_const_object_array('Warnings', warning_records)
|
||||
|
||||
draw_table_javascript = """
|
||||
|
|
Loading…
Reference in a new issue