Chromium Code Reviews| Index: tools/grit/grit/format/policy_templates/writers/doc_writer.py |
| diff --git a/tools/grit/grit/format/policy_templates/writers/doc_writer.py b/tools/grit/grit/format/policy_templates/writers/doc_writer.py |
| index 320e79dd3b610b5bba83e0b6ebea5a7fc48ec960..2f6c049dacb60f078b4e074ef60408c90c75ff6f 100644 |
| --- a/tools/grit/grit/format/policy_templates/writers/doc_writer.py |
| +++ b/tools/grit/grit/format/policy_templates/writers/doc_writer.py |
| @@ -107,7 +107,7 @@ class DocWriter(xml_formatted_writer.XMLFormattedWriter): |
| def _AddDescription(self, parent, policy): |
| '''Adds a string containing the description of the policy. URLs are |
| replaced with links and the possible choices are enumerated in case |
| - of 'enum' type policies. |
| + of 'string-enum' and 'int-enum' type policies. |
| Args: |
| parent: The DOM node for which the feature list will be added. |
| @@ -116,11 +116,16 @@ class DocWriter(xml_formatted_writer.XMLFormattedWriter): |
| # Replace URLs with links in the description. |
| self._AddTextWithLinks(parent, policy['desc']) |
| # Add list of enum items. |
| - if policy['type'] == 'enum': |
| + if policy['type'] == 'int-enum': |
|
gfeher
2011/01/03 10:30:10
Please merge handling of 'int-enum' and 'string-en
danno
2011/01/07 12:24:25
Done.
|
| ul = self.AddElement(parent, 'ul') |
| for item in policy['items']: |
| self.AddElement( |
| - ul, 'li', {}, '%s = %s' % (item['value'], item['caption'])) |
| + ul, 'li', {}, '%d = %s' % (item['value'], item['caption'])) |
| + if policy['type'] == 'string-enum': |
| + ul = self.AddElement(parent, 'ul') |
| + for item in policy['items']: |
| + self.AddElement( |
| + ul, 'li', {}, '"%s" = %s' % (item['value'], item['caption'])) |
| def _AddFeatures(self, parent, policy): |
| '''Adds a string containing the list of supported features of a policy |
| @@ -253,10 +258,12 @@ class DocWriter(xml_formatted_writer.XMLFormattedWriter): |
| raise Exception('Expected boolean value.') |
| elif policy_type == 'string': |
| self.AddText(parent, '"%s"' % example_value) |
| - elif policy_type == 'enum': |
| + elif policy_type == 'int-enum': |
| self.AddText( |
| parent, |
| '0x%08x (Windows), %d (Linux/Mac)' % (example_value, example_value)) |
| + elif policy_type == 'string-enum': |
| + self.AddText(parent, '"%s"' % (example_value)) |
| elif policy_type == 'list': |
| self._AddListExample(parent, policy) |
| else: |
| @@ -407,7 +414,10 @@ class DocWriter(xml_formatted_writer.XMLFormattedWriter): |
| self.AddElement(h2, 'a', {'name': policy['name']}) |
| if policy['type'] != 'group': |
| # Normal policies get a full description. |
| - self.AddText(h2, policy['name']) |
| + if 'deprecated' in policy and policy['deprecated'] == True: |
| + self.AddText(h2, policy['name'] + " (DEPRECATED)") |
|
gfeher
2011/01/03 10:30:10
Do we want to localize the word 'deprecated'?
danno
2011/01/07 12:24:25
Done.
|
| + else: |
| + self.AddText(h2, policy['name']) |
| self.AddElement(parent2, 'span', {}, policy['caption']) |
| self._AddPolicyNote(parent2, policy) |
| self._AddPolicyDetails(parent2, policy) |
| @@ -424,6 +434,9 @@ class DocWriter(xml_formatted_writer.XMLFormattedWriter): |
| # Implementation of abstract methods of TemplateWriter: |
| # |
| + def IsDeprecatedPolicySupported(self, policy): |
| + return True |
| + |
| def WritePolicy(self, policy): |
| self._AddPolicyRow(self._summary_tbody, policy) |
| self._AddPolicySection(self._details_div, policy) |
| @@ -490,7 +503,8 @@ class DocWriter(xml_formatted_writer.XMLFormattedWriter): |
| self._TYPE_MAP = { |
| 'string': 'String (REG_SZ)', |
| 'main': 'Boolean (REG_DWORD)', |
| - 'enum': 'Integer (REG_DWORD)', |
| + 'int-enum': 'Integer (REG_DWORD)', |
| + 'string-enum': 'String (REG_SZ)', |
| 'list': 'List of strings', |
| } |
| # The CSS style-sheet used for the document. It will be used in Google |