Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env node | 1 #!/usr/bin/env node |
| 2 | 2 |
| 3 // Copyright 2017 The Chromium Authors. All rights reserved. | 3 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 4 // Use of this source code is governed by a BSD-style license that can be | 4 // Use of this source code is governed by a BSD-style license that can be |
| 5 // found in the LICENSE file. | 5 // found in the LICENSE file. |
| 6 | 6 |
| 7 'use strict'; | 7 'use strict'; |
| 8 | 8 |
| 9 const os = require('os'); | 9 const os = require('os'); |
| 10 const fs = require('fs'); | 10 const fs = require('fs'); |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 346 // Clean up the head element section. | 346 // Clean up the head element section. |
| 347 DOMUtil.tidyHeadElementSync(this.jsdom_.window.document, this); | 347 DOMUtil.tidyHeadElementSync(this.jsdom_.window.document, this); |
| 348 | 348 |
| 349 let scriptElement = | 349 let scriptElement = |
| 350 DOMUtil.getElementWithTestCodeSync(this.jsdom_.window.document, this); | 350 DOMUtil.getElementWithTestCodeSync(this.jsdom_.window.document, this); |
| 351 | 351 |
| 352 if (!scriptElement) | 352 if (!scriptElement) |
| 353 Util.logAndExit('TidyTask.processHTML_', 'Invalid <script> element.'); | 353 Util.logAndExit('TidyTask.processHTML_', 'Invalid <script> element.'); |
| 354 | 354 |
| 355 // Start with clang-foramt, then HTMLTidy and RegExp substitution. | 355 // Start with clang-foramt, then HTMLTidy and RegExp substitution. |
| 356 Module.runClangFormat( | 356 Module |
| 357 scriptElement.textContent, OPTIONS.ClangFormat, 3, this) | 357 .runClangFormat(scriptElement.textContent, OPTIONS.ClangFormat, 3, this) |
|
Raymond Toy
2017/05/23 16:47:18
Does this mean that you forgot to run tidy on the
| |
| 358 .then((formattedCodeString) => { | 358 .then((formattedCodeString) => { |
| 359 // Replace the original code with clang-formatted code. | 359 // Replace the original code with clang-formatted code. |
| 360 scriptElement.textContent = formattedCodeString; | 360 scriptElement.textContent = formattedCodeString; |
| 361 | 361 |
| 362 // Then tidy the text data from JSDOM. After this point, DOM | 362 // Then tidy the text data from JSDOM. After this point, DOM |
| 363 // manipulation is not possible anymore. | 363 // manipulation is not possible anymore. |
| 364 let pageString = this.jsdom_.serialize(); | 364 let pageString = this.jsdom_.serialize(); |
| 365 pageString = | 365 pageString = |
| 366 Module.runHTMLTidySync(pageString, OPTIONS.HTMLTidy, this); | 366 Module.runHTMLTidySync(pageString, OPTIONS.HTMLTidy, this); |
| 367 pageString = Module.runRegExpSwapSync( | 367 pageString = Module.runRegExpSwapSync( |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 553 | 553 |
| 554 if (files.length > 0) { | 554 if (files.length > 0) { |
| 555 let taskRunner = new TidyTaskRunner(files, options); | 555 let taskRunner = new TidyTaskRunner(files, options); |
| 556 taskRunner.startProcessing(); | 556 taskRunner.startProcessing(); |
| 557 } else { | 557 } else { |
| 558 Util.logAndExit('main', 'No files to process.'); | 558 Util.logAndExit('main', 'No files to process.'); |
| 559 } | 559 } |
| 560 } | 560 } |
| 561 | 561 |
| 562 main(); | 562 main(); |
| OLD | NEW |