| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "tools/gn/standard_out.h" | 5 #include "tools/gn/standard_out.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 } | 232 } |
| 233 | 233 |
| 234 // Highlight up to the colon (if any). | 234 // Highlight up to the colon (if any). |
| 235 size_t chars_to_highlight = line.find(':'); | 235 size_t chars_to_highlight = line.find(':'); |
| 236 if (chars_to_highlight == std::string::npos) | 236 if (chars_to_highlight == std::string::npos) |
| 237 chars_to_highlight = line.size(); | 237 chars_to_highlight = line.size(); |
| 238 | 238 |
| 239 OutputString(line.substr(0, chars_to_highlight), DECORATION_YELLOW); | 239 OutputString(line.substr(0, chars_to_highlight), DECORATION_YELLOW); |
| 240 OutputString(line.substr(chars_to_highlight) + "\n"); | 240 OutputString(line.substr(chars_to_highlight) + "\n"); |
| 241 continue; | 241 continue; |
| 242 } else if (!line.empty() && !in_body) { | 242 } else if (is_markdown && !line.empty() && !in_body) { |
| 243 OutputString("```\n", DECORATION_NONE); | 243 OutputString("```\n", DECORATION_NONE); |
| 244 in_body = true; | 244 in_body = true; |
| 245 } | 245 } |
| 246 | 246 |
| 247 // Check for a comment. | 247 // Check for a comment. |
| 248 TextDecoration dec = DECORATION_NONE; | 248 TextDecoration dec = DECORATION_NONE; |
| 249 for (const auto& elem : line) { | 249 for (const auto& elem : line) { |
| 250 if (elem == '#' && !is_markdown) { | 250 if (elem == '#' && !is_markdown) { |
| 251 // Got a comment, draw dimmed. | 251 // Got a comment, draw dimmed. |
| 252 dec = DECORATION_DIM; | 252 dec = DECORATION_DIM; |
| 253 break; | 253 break; |
| 254 } else if (elem != ' ') { | 254 } else if (elem != ' ') { |
| 255 break; | 255 break; |
| 256 } | 256 } |
| 257 } | 257 } |
| 258 | 258 |
| 259 OutputString(line + "\n", dec); | 259 OutputString(line + "\n", dec); |
| 260 } | 260 } |
| 261 | 261 |
| 262 if (is_markdown && in_body) | 262 if (is_markdown && in_body) |
| 263 OutputString("\n```\n"); | 263 OutputString("\n```\n"); |
| 264 } | 264 } |
| 265 | 265 |
| OLD | NEW |