Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(166)

Side by Side Diff: pkg/analysis_server/tool/spec/text_formatter.dart

Issue 1310263003: Reformat code to minimize churn (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /** 5 /**
6 * Code for converting HTML into text, for use in doc comments. 6 * Code for converting HTML into text, for use in doc comments.
7 */ 7 */
8 library text.formatter; 8 library text.formatter;
9 9
10 import 'package:html/dom.dart' as dom; 10 import 'package:html/dom.dart' as dom;
11 11
12 import 'codegen_tools.dart'; 12 import 'codegen_tools.dart';
13 13
14 final RegExp whitespace = new RegExp(r'\s'); 14 final RegExp whitespace = new RegExp(r'\s');
15 15
16 /** 16 /**
17 * Convert the HTML in [desc] into text, word wrapping at width [width]. 17 * Convert the HTML in [desc] into text, word wrapping at width [width].
18 * 18 *
19 * If [javadocStyle] is true, then the output is compatable with Javadoc, 19 * If [javadocStyle] is true, then the output is compatable with Javadoc,
20 * which understands certain HTML constructs. 20 * which understands certain HTML constructs.
21 */ 21 */
22 String nodesToText(List<dom.Node> desc, int width, bool javadocStyle, { 22 String nodesToText(List<dom.Node> desc, int width, bool javadocStyle,
23 bool removeTrailingNewLine: false}) { 23 {bool removeTrailingNewLine: false}) {
24 _TextFormatter formatter = new _TextFormatter(width, javadocStyle); 24 _TextFormatter formatter = new _TextFormatter(width, javadocStyle);
25 return formatter.collectCode(() { 25 return formatter.collectCode(() {
26 formatter.addAll(desc); 26 formatter.addAll(desc);
27 formatter.lineBreak(false); 27 formatter.lineBreak(false);
28 }, removeTrailingNewLine: removeTrailingNewLine); 28 }, removeTrailingNewLine: removeTrailingNewLine);
29 } 29 }
30 30
31 /** 31 /**
32 * Engine that transforms HTML to text. The input HTML is processed one 32 * Engine that transforms HTML to text. The input HTML is processed one
33 * character at a time, gathering characters into words and words into lines. 33 * character at a time, gathering characters into words and words into lines.
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 writeln(line); 237 writeln(line);
238 line = word; 238 line = word;
239 } 239 }
240 } else { 240 } else {
241 line = word; 241 line = word;
242 } 242 }
243 word = ''; 243 word = '';
244 } 244 }
245 } 245 }
246 } 246 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/tool/spec/from_html.dart ('k') | pkg/analysis_server/tool/spec/to_html.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698