| 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 """Miscellaneous node types. | 6 """Miscellaneous node types. |
| 7 """ | 7 """ |
| 8 | 8 |
| 9 import os.path | 9 import os.path |
| 10 import re | 10 import re |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 for lang, ctx, fallback in self.GetConfigurations(): | 326 for lang, ctx, fallback in self.GetConfigurations(): |
| 327 self.SetOutputLanguage(lang or self.GetSourceLanguage()) | 327 self.SetOutputLanguage(lang or self.GetSourceLanguage()) |
| 328 self.SetOutputContext(ctx) | 328 self.SetOutputContext(ctx) |
| 329 self.SetFallbackToDefaultLayout(fallback) | 329 self.SetFallbackToDefaultLayout(fallback) |
| 330 | 330 |
| 331 for node in self.ActiveDescendants(): | 331 for node in self.ActiveDescendants(): |
| 332 if isinstance(node, (io.FileNode, include.IncludeNode, misc.PartNode, | 332 if isinstance(node, (io.FileNode, include.IncludeNode, misc.PartNode, |
| 333 structure.StructureNode, variant.SkeletonNode)): | 333 structure.StructureNode, variant.SkeletonNode)): |
| 334 input_path = node.GetInputPath() | 334 input_path = node.GetInputPath() |
| 335 if input_path is not None: | 335 if input_path is not None: |
| 336 input_files.add(input_path) | 336 input_files.add(self.ToRealPath(input_path)) |
| 337 |
| 338 # If it's a flattened node, grab inlined resources too. |
| 339 if node.name == 'structure' and node.attrs['flattenhtml'] == 'true': |
| 340 node.RunPreSubstitutionGatherer() |
| 341 input_files.update(node.GetHtmlResourceFilenames()) |
| 342 |
| 337 self.SetOutputLanguage(old_output_language) | 343 self.SetOutputLanguage(old_output_language) |
| 338 return sorted(map(self.ToRealPath, input_files)) | 344 return sorted(input_files) |
| 339 | 345 |
| 340 def GetFirstIdsFile(self): | 346 def GetFirstIdsFile(self): |
| 341 """Returns a usable path to the first_ids file, if set, otherwise | 347 """Returns a usable path to the first_ids file, if set, otherwise |
| 342 returns None. | 348 returns None. |
| 343 | 349 |
| 344 The first_ids_file attribute is by default relative to the | 350 The first_ids_file attribute is by default relative to the |
| 345 base_dir of the .grd file, but may be prefixed by GRIT_DIR/, | 351 base_dir of the .grd file, but may be prefixed by GRIT_DIR/, |
| 346 which makes it relative to the directory of grit.py | 352 which makes it relative to the directory of grit.py |
| 347 (e.g. GRIT_DIR/../gritsettings/resource_ids). | 353 (e.g. GRIT_DIR/../gritsettings/resource_ids). |
| 348 """ | 354 """ |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 by parameters of the same name. | 541 by parameters of the same name. |
| 536 """ | 542 """ |
| 537 node = IdentifierNode() | 543 node = IdentifierNode() |
| 538 node.StartParsing('identifier', parent) | 544 node.StartParsing('identifier', parent) |
| 539 node.HandleAttribute('name', name) | 545 node.HandleAttribute('name', name) |
| 540 node.HandleAttribute('id', id) | 546 node.HandleAttribute('id', id) |
| 541 node.HandleAttribute('comment', comment) | 547 node.HandleAttribute('comment', comment) |
| 542 node.HandleAttribute('systemid', systemid) | 548 node.HandleAttribute('systemid', systemid) |
| 543 node.EndParsing() | 549 node.EndParsing() |
| 544 return node | 550 return node |
| OLD | NEW |