| Index: grit/format/resource_map.py
|
| ===================================================================
|
| --- grit/format/resource_map.py (revision 132)
|
| +++ grit/format/resource_map.py (working copy)
|
| @@ -104,17 +104,23 @@
|
|
|
| def _FormatSource(get_key, root, lang, output_dir):
|
| from grit.format import rc_header
|
| - from grit.node import include, structure
|
| + from grit.node import include, structure, message
|
| yield _FormatSourceHeader(root)
|
| tids = rc_header.GetIds(root)
|
| seen = set()
|
| + active_descendants = [item for item in root.ActiveDescendants()]
|
| for item in root:
|
| - if isinstance(item, (include.IncludeNode, structure.StructureNode)):
|
| + if isinstance(item, (include.IncludeNode,
|
| + structure.StructureNode,
|
| + message.MessageNode)):
|
| key = get_key(item)
|
| tid = item.attrs['name']
|
| if tid in tids and key not in seen:
|
| seen.add(key)
|
| - yield ' {"%s", %s},\n' % (key, tid)
|
| + # For messages, only include the active ones
|
| + if not isinstance(item, message.MessageNode) \
|
| + or item in active_descendants:
|
| + yield ' {"%s", %s},\n' % (key, tid)
|
| yield _FormatSourceFooter(root)
|
|
|
|
|
|
|