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

Side by Side Diff: grit/node/empty.py

Issue 7994004: Initial source commit to grit-i18n project. (Closed) Base URL: http://grit-i18n.googlecode.com/svn/trunk/
Patch Set: Created 9 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « grit/node/custom/filename_unittest.py ('k') | grit/node/include.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 #!/usr/bin/python2.4
2 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 '''Container nodes that don't have any logic.
7 '''
8
9
10 from grit.node import base
11 from grit.node import include
12 from grit.node import structure
13 from grit.node import message
14 from grit.node import io
15 from grit.node import misc
16
17
18 class GroupingNode(base.Node):
19 '''Base class for all the grouping elements (<structures>, <includes>,
20 <messages> and <identifiers>).'''
21 def DefaultAttributes(self):
22 return {
23 'first_id' : '',
24 'comment' : '',
25 'fallback_to_english' : 'false',
26 }
27
28
29 class IncludesNode(GroupingNode):
30 '''The <includes> element.'''
31 def _IsValidChild(self, child):
32 return isinstance(child, (include.IncludeNode, misc.IfNode))
33
34
35 class MessagesNode(GroupingNode):
36 '''The <messages> element.'''
37 def _IsValidChild(self, child):
38 return isinstance(child, (message.MessageNode, misc.IfNode))
39
40 def ItemFormatter(self, t):
41 '''Return the stringtable itemformatter if an RC is being formatted.'''
42 if t in ['rc_all', 'rc_translateable', 'rc_nontranslateable']:
43 from grit.format import rc # avoid circular dep by importing here
44 return rc.StringTable()
45 elif t == 'js_map_format':
46 from grit.format import js_map_format
47 return js_map_format.StringTable()
48
49
50 class StructuresNode(GroupingNode):
51 '''The <structures> element.'''
52 def _IsValidChild(self, child):
53 return isinstance(child, (structure.StructureNode, misc.IfNode))
54
55
56 class TranslationsNode(base.Node):
57 '''The <translations> element.'''
58 def _IsValidChild(self, child):
59 return isinstance(child, (io.FileNode, misc.IfNode))
60
61
62 class OutputsNode(base.Node):
63 '''The <outputs> element.'''
64 def _IsValidChild(self, child):
65 return isinstance(child, (io.OutputNode, misc.IfNode))
66
67
68 class IdentifiersNode(GroupingNode):
69 '''The <identifiers> element.'''
70 def _IsValidChild(self, child):
71 from grit.node import misc
72 return isinstance(child, misc.IdentifierNode)
OLDNEW
« no previous file with comments | « grit/node/custom/filename_unittest.py ('k') | grit/node/include.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698