Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python2 | 1 #!/usr/bin/env python2 |
| 2 # -*- coding: utf-8 -*- | 2 # -*- coding: utf-8 -*- |
| 3 | 3 |
| 4 # Copyright 2015 Google Inc. All Rights Reserved. | 4 # Copyright 2015 Google Inc. All Rights Reserved. |
| 5 # | 5 # |
| 6 # Licensed under the Apache License, Version 2.0 (the "License"); | 6 # Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 # you may not use this file except in compliance with the License. | 7 # you may not use this file except in compliance with the License. |
| 8 # You may obtain a copy of the License at | 8 # You may obtain a copy of the License at |
| 9 # | 9 # |
| 10 # http://www.apache.org/licenses/LICENSE-2.0 | 10 # http://www.apache.org/licenses/LICENSE-2.0 |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 264 first_script = scripts[0] if scripts else None | 264 first_script = scripts[0] if scripts else None |
| 265 | 265 |
| 266 logging.debug('Requiring scripts: %s', ', '.join(required_js_paths)) | 266 logging.debug('Requiring scripts: %s', ', '.join(required_js_paths)) |
| 267 | 267 |
| 268 # Insert the script tags in order. | 268 # Insert the script tags in order. |
| 269 for script_path in reversed(required_js_paths): | 269 for script_path in reversed(required_js_paths): |
| 270 logging.debug('Inserting `%s` script tag.', script_path) | 270 logging.debug('Inserting `%s` script tag.', script_path) |
| 271 path = os.path.join(root_path, boilerplate_dir, script_path) | 271 path = os.path.join(root_path, boilerplate_dir, script_path) |
| 272 script = soup.new_tag('script', src=path) | 272 script = soup.new_tag('script', src=path) |
| 273 if first_script is None: | 273 if first_script is None: |
| 274 soup.body.append(script) | 274 target = soup.body |
| 275 if not target: | |
| 276 if soup.html: | |
| 277 target = soup.html | |
| 278 else: | |
| 279 target = soup | |
|
Matt Giuca
2016/02/08 04:28:39
I'm confused; I thought you did this change awhile
Matthew Alger
2016/02/08 04:29:57
That was head tags and in another function.
I thi
Matt Giuca
2016/02/08 05:59:52
Acknowledged.
| |
| 280 target.append(script) | |
| 275 else: | 281 else: |
| 276 first_script.insert_before(script) | 282 first_script.insert_before(script) |
| 277 first_script = script | 283 first_script = script |
| 278 logging.debug('Injected `%s` script into `%s`.', script_path, html_path) | 284 logging.debug('Injected `%s` script into `%s`.', script_path, html_path) |
| 279 | 285 |
| 280 | 286 |
| 281 def inject_misc_tags(soup, chrome_app_manifest, root_path, html_path): | 287 def inject_misc_tags(soup, chrome_app_manifest, root_path, html_path): |
| 282 """ | 288 """ |
| 283 Injects meta and link tags into an HTML document. | 289 Injects meta and link tags into an HTML document. |
| 284 | 290 |
| (...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 855 configuration.generate_and_save(args.output, args.interactive) | 861 configuration.generate_and_save(args.output, args.interactive) |
| 856 | 862 |
| 857 elif args.mode == 'convert': | 863 elif args.mode == 'convert': |
| 858 config = configuration.load(args.config) | 864 config = configuration.load(args.config) |
| 859 convert_app(args.input, args.output, config, handler.captured_warnings, | 865 convert_app(args.input, args.output, config, handler.captured_warnings, |
| 860 args.force) | 866 args.force) |
| 861 | 867 |
| 862 | 868 |
| 863 if __name__ == '__main__': | 869 if __name__ == '__main__': |
| 864 sys.exit(main()) | 870 sys.exit(main()) |
| OLD | NEW |