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

Side by Side Diff: tools/metrics/actions/print_style.py

Issue 180743027: Re-land: Change actions.txt to actions.xml (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 9 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
« no previous file with comments | « tools/metrics/actions/extract_actions_test.py ('k') | tools/metrics/common/diff_util.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 """Holds the constants for pretty printing actions.xml."""
6
7 import os
8 import sys
9
10 # Import the metrics/common module for pretty print xml.
11 sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'common'))
12 import pretty_print_xml
13
14 # Desired order for tag and tag attributes.
15 # { tag_name: [attribute_name, ...] }
16 ATTRIBUTE_ORDER = {
17 'action': ['name'],
18 'owner': [],
19 'description': [],
20 'obsolete': [],
21 }
22
23 # Tag names for top-level nodes whose children we don't want to indent.
24 TAGS_THAT_DONT_INDENT = ['actions']
25
26 # Extra vertical spacing rules for special tag names.
27 # {tag_name: (newlines_after_open, newlines_before_close, newlines_after_close)}
28 TAGS_THAT_HAVE_EXTRA_NEWLINE = {
29 'actions': (2, 1, 1),
30 'action': (1, 1, 1),
31 }
32
33 # Tags that we allow to be squished into a single line for brevity.
34 TAGS_THAT_ALLOW_SINGLE_LINE = ['owner', 'description', 'obsolete']
35
36 def GetPrintStyle():
37 """Returns an XmlStyle object for pretty printing actions."""
38 return pretty_print_xml.XmlStyle(ATTRIBUTE_ORDER,
39 TAGS_THAT_HAVE_EXTRA_NEWLINE,
40 TAGS_THAT_DONT_INDENT,
41 TAGS_THAT_ALLOW_SINGLE_LINE)
OLDNEW
« no previous file with comments | « tools/metrics/actions/extract_actions_test.py ('k') | tools/metrics/common/diff_util.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698