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.
5 """Holds the constants for pretty printing actions.xml."""
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
14 # Desired order for tag and tag attributes.
15 # { tag_name: [attribute_name, ...] }
23 # Tag names for top-level nodes whose children we don't want to indent.
24 TAGS_THAT_DONT_INDENT
= ['actions']
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
= {
33 # Tags that we allow to be squished into a single line for brevity.
34 TAGS_THAT_ALLOW_SINGLE_LINE
= ['owner', 'description', 'obsolete']
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
)