| OLD | NEW |
| 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 '''Container nodes that don't have any logic. | 6 '''Container nodes that don't have any logic. |
| 7 ''' | 7 ''' |
| 8 | 8 |
| 9 | 9 |
| 10 from grit.node import base | 10 from grit.node import base |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 class MessagesNode(GroupingNode): | 35 class MessagesNode(GroupingNode): |
| 36 '''The <messages> element.''' | 36 '''The <messages> element.''' |
| 37 def _IsValidChild(self, child): | 37 def _IsValidChild(self, child): |
| 38 return isinstance(child, (message.MessageNode, misc.IfNode)) | 38 return isinstance(child, (message.MessageNode, misc.IfNode)) |
| 39 | 39 |
| 40 def ItemFormatter(self, t): | 40 def ItemFormatter(self, t): |
| 41 '''Return the stringtable itemformatter if an RC is being formatted.''' | 41 '''Return the stringtable itemformatter if an RC is being formatted.''' |
| 42 if t in ['rc_all', 'rc_translateable', 'rc_nontranslateable']: | 42 if t in ['rc_all', 'rc_translateable', 'rc_nontranslateable']: |
| 43 from grit.format import rc # avoid circular dep by importing here | 43 from grit.format import rc # avoid circular dep by importing here |
| 44 return rc.StringTable() | 44 return rc.StringTable() |
| 45 elif t == 'c_format': |
| 46 from grit.format import c_format |
| 47 return c_format.StringTable() |
| 45 elif t == 'js_map_format': | 48 elif t == 'js_map_format': |
| 46 from grit.format import js_map_format | 49 from grit.format import js_map_format |
| 47 return js_map_format.StringTable() | 50 return js_map_format.StringTable() |
| 48 | 51 |
| 49 | 52 |
| 50 class StructuresNode(GroupingNode): | 53 class StructuresNode(GroupingNode): |
| 51 '''The <structures> element.''' | 54 '''The <structures> element.''' |
| 52 def _IsValidChild(self, child): | 55 def _IsValidChild(self, child): |
| 53 return isinstance(child, (structure.StructureNode, misc.IfNode)) | 56 return isinstance(child, (structure.StructureNode, misc.IfNode)) |
| 54 | 57 |
| 55 | 58 |
| 56 class TranslationsNode(base.Node): | 59 class TranslationsNode(base.Node): |
| 57 '''The <translations> element.''' | 60 '''The <translations> element.''' |
| 58 def _IsValidChild(self, child): | 61 def _IsValidChild(self, child): |
| 59 return isinstance(child, (io.FileNode, misc.IfNode)) | 62 return isinstance(child, (io.FileNode, misc.IfNode)) |
| 60 | 63 |
| 61 | 64 |
| 62 class OutputsNode(base.Node): | 65 class OutputsNode(base.Node): |
| 63 '''The <outputs> element.''' | 66 '''The <outputs> element.''' |
| 64 def _IsValidChild(self, child): | 67 def _IsValidChild(self, child): |
| 65 return isinstance(child, (io.OutputNode, misc.IfNode)) | 68 return isinstance(child, (io.OutputNode, misc.IfNode)) |
| 66 | 69 |
| 67 | 70 |
| 68 class IdentifiersNode(GroupingNode): | 71 class IdentifiersNode(GroupingNode): |
| 69 '''The <identifiers> element.''' | 72 '''The <identifiers> element.''' |
| 70 def _IsValidChild(self, child): | 73 def _IsValidChild(self, child): |
| 71 from grit.node import misc | 74 from grit.node import misc |
| 72 return isinstance(child, misc.IdentifierNode) | 75 return isinstance(child, misc.IdentifierNode) |
| OLD | NEW |