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

Side by Side Diff: grit/format/policy_templates/policy_template_generator.py

Issue 91233003: Improve platform support indications for policy documentation. (Closed) Base URL: http://grit-i18n.googlecode.com/svn/trunk/
Patch Set: Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | grit/format/policy_templates/writers/doc_writer.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 6
7 import copy 7 import copy
8 import types 8 import types
9 9
10 10
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 elif policy['type'] in ('string-enum', 'int-enum'): 141 elif policy['type'] in ('string-enum', 'int-enum'):
142 # Iterate through all the items of an enum-type policy, and add captions. 142 # Iterate through all the items of an enum-type policy, and add captions.
143 for item in policy['items']: 143 for item in policy['items']:
144 item['caption'] = self._ImportMessage(item['caption']) 144 item['caption'] = self._ImportMessage(item['caption'])
145 elif policy['type'] == 'dict' and 'example_value' in policy: 145 elif policy['type'] == 'dict' and 'example_value' in policy:
146 policy['example_value'] = self._PrintPolicyValue(policy['example_value']) 146 policy['example_value'] = self._PrintPolicyValue(policy['example_value'])
147 if policy['type'] != 'group': 147 if policy['type'] != 'group':
148 if not 'label' in policy: 148 if not 'label' in policy:
149 # If 'label' is not specified, then it defaults to 'caption': 149 # If 'label' is not specified, then it defaults to 'caption':
150 policy['label'] = policy['caption'] 150 policy['label'] = policy['caption']
151 policy['supported_on'] = self._ProcessSupportedOn( 151 policy['supported_on'] = self._ProcessSupportedOn(policy['supported_on'])
152 policy['supported_on'])
153 152
154 def _ProcessPolicyList(self, policy_list): 153 def _ProcessPolicyList(self, policy_list):
155 '''Adds localized message strings to each item in a list of policies and 154 '''Adds localized message strings to each item in a list of policies and
156 groups. Also breaks up the content of 'supported_on' attributes into lists 155 groups. Also breaks up the content of 'supported_on' attributes into lists
157 of dictionaries. 156 of dictionaries.
158 157
159 Args: 158 Args:
160 policy_list: A list of policies and groups. Message strings will be added 159 policy_list: A list of policies and groups. Message strings will be added
161 for each item and to their child items, recursively. 160 for each item and to their child items, recursively.
162 ''' 161 '''
163 for policy in policy_list: 162 for policy in policy_list:
164 self._ProcessPolicy(policy) 163 self._ProcessPolicy(policy)
165 164
166 def GetTemplateText(self, template_writer): 165 def GetTemplateText(self, template_writer):
167 '''Generates the text of the template from the arguments given 166 '''Generates the text of the template from the arguments given
168 to the constructor, using a given TemplateWriter. 167 to the constructor, using a given TemplateWriter.
169 168
170 Args: 169 Args:
171 template_writer: An object implementing TemplateWriter. Its methods 170 template_writer: An object implementing TemplateWriter. Its methods
172 are called here for each item of self._policy_groups. 171 are called here for each item of self._policy_groups.
173 172
174 Returns: 173 Returns:
175 The text of the generated template. 174 The text of the generated template.
176 ''' 175 '''
177 return template_writer.WriteTemplate(self._policy_data) 176 return template_writer.WriteTemplate(self._policy_data)
OLDNEW
« no previous file with comments | « no previous file | grit/format/policy_templates/writers/doc_writer.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698