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

Side by Side Diff: chrome/browser/web_dev_style/css_checker.py

Issue 1585923011: [Template Expressions] changing ${ leader to $i18n{ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix for $i18n comment Created 4 years, 10 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 unified diff | Download patch
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Presubmit script for Chromium WebUI resources. 5 """Presubmit script for Chromium WebUI resources.
6 6
7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
8 for more details about the presubmit API built into depot_tools, and see 8 for more details about the presubmit API built into depot_tools, and see
9 http://www.chromium.org/developers/web-development-style-guide for the rules 9 http://www.chromium.org/developers/web-development-style-guide for the rules
10 we're checking against here. 10 we're checking against here.
11 """ 11 """
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 re.DOTALL | re.VERBOSE) 48 re.DOTALL | re.VERBOSE)
49 return at_reg.sub('\\1', s) 49 return at_reg.sub('\\1', s)
50 50
51 def _remove_comments(s): 51 def _remove_comments(s):
52 return re.sub(re.compile(r'/\*.*?\*/', re.DOTALL), '', s) 52 return re.sub(re.compile(r'/\*.*?\*/', re.DOTALL), '', s)
53 53
54 def _remove_mixins(s): 54 def _remove_mixins(s):
55 return re.sub(re.compile(r'--[\d\w-]+: {.*?};', re.DOTALL), '', s) 55 return re.sub(re.compile(r'--[\d\w-]+: {.*?};', re.DOTALL), '', s)
56 56
57 def _remove_template_expressions(s): 57 def _remove_template_expressions(s):
58 return re.sub(re.compile(r'\${[^}]*}', re.DOTALL), '', s) 58 return re.sub(re.compile(r'\$i18n{[^}]*}', re.DOTALL), '', s)
59 59
60 def _remove_grit(s): 60 def _remove_grit(s):
61 grit_reg = re.compile(r""" 61 grit_reg = re.compile(r"""
62 <if[^>]+>.*?<\s*/\s*if[^>]*>| # <if> contents </if> 62 <if[^>]+>.*?<\s*/\s*if[^>]*>| # <if> contents </if>
63 <include[^>]+> # <include> 63 <include[^>]+> # <include>
64 """, 64 """,
65 re.DOTALL | re.VERBOSE) 65 re.DOTALL | re.VERBOSE)
66 return re.sub(grit_reg, '', s) 66 return re.sub(grit_reg, '', s)
67 67
68 def _rgb_from_hex(s): 68 def _rgb_from_hex(s):
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 error += check['after'](line) 413 error += check['after'](line)
414 check_errors.append(error) 414 check_errors.append(error)
415 if len(check_errors) > 0: 415 if len(check_errors) > 0:
416 file_errors.append('- %s\n%s' % 416 file_errors.append('- %s\n%s' %
417 (check['desc'], '\n'.join(check_errors))) 417 (check['desc'], '\n'.join(check_errors)))
418 if file_errors: 418 if file_errors:
419 results.append(self.output_api.PresubmitPromptWarning( 419 results.append(self.output_api.PresubmitPromptWarning(
420 '%s:\n%s' % (f[0], '\n\n'.join(file_errors)))) 420 '%s:\n%s' % (f[0], '\n\n'.join(file_errors))))
421 421
422 return results 422 return results
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/ntp/ntp_resource_cache.cc ('k') | chrome/browser/web_dev_style/css_checker_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698